diff --git a/BMA.EHR.API.Command/BMA.EHR.API.Command.csproj b/BMA.EHR.API.Command/BMA.EHR.API.Command.csproj deleted file mode 100644 index 62424ae0..00000000 --- a/BMA.EHR.API.Command/BMA.EHR.API.Command.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net7.0 - enable - enable - - - - - - - - - - - - - - - - - - - diff --git a/BMA.EHR.API.Command/CommandAPIRegistration.cs b/BMA.EHR.API.Command/CommandAPIRegistration.cs deleted file mode 100644 index 18a4feea..00000000 --- a/BMA.EHR.API.Command/CommandAPIRegistration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace BMA.EHR.API.Command -{ - public static class CommandAPIRegistration - { - public static IMvcBuilder RegisterCommandControllers(this IMvcBuilder builder) - { - Assembly assembly = typeof(CommandAPIRegistration).Assembly; - builder.AddApplicationPart(assembly); - return builder; - } - } -} diff --git a/BMA.EHR.API.Command/FileDownloadResponse.cs b/BMA.EHR.API.Command/FileDownloadResponse.cs deleted file mode 100644 index 653309fb..00000000 --- a/BMA.EHR.API.Command/FileDownloadResponse.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace BMA.EHR.API.Command -{ - 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/BMA.EHR.API.Command/PartialClass.cs b/BMA.EHR.API.Command/PartialClass.cs deleted file mode 100644 index 6b08813b..00000000 --- a/BMA.EHR.API.Command/PartialClass.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Partial.Test -{ - public partial class PartialClass - { - public string GetString() - { - return "Return from class1"; - } - } -} diff --git a/BMA.EHR.API.Command/TestController.cs b/BMA.EHR.API.Command/TestController.cs deleted file mode 100644 index b73d2a2d..00000000 --- a/BMA.EHR.API.Command/TestController.cs +++ /dev/null @@ -1,16 +0,0 @@ -using BMA.EHR.Domain.Common; -using Microsoft.AspNetCore.Mvc; - -namespace BMA.EHR.API.Command -{ - [Route("api/test")] - [ApiController] - public class TestController : BaseController - { - [HttpGet] - public ActionResult Get() - { - return Success("Test", new { data = "11111" }); - } - } -} diff --git a/BMA.EHR.Application/ApplicationServicesRegistration.cs b/BMA.EHR.Application/ApplicationServicesRegistration.cs index 760700d9..e77b671e 100644 --- a/BMA.EHR.Application/ApplicationServicesRegistration.cs +++ b/BMA.EHR.Application/ApplicationServicesRegistration.cs @@ -1,4 +1,5 @@ using BMA.EHR.Application.Repositories; +using BMA.EHR.Application.Repositories.Commands; using BMA.EHR.Application.Repositories.MessageQueue; using Microsoft.Extensions.DependencyInjection; @@ -12,6 +13,7 @@ namespace BMA.EHR.Application services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); return services; } diff --git a/BMA.EHR.Application/Repositories/Commands/PlacementCommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/PlacementCommandRepository.cs new file mode 100644 index 00000000..8bfcd3db --- /dev/null +++ b/BMA.EHR.Application/Repositories/Commands/PlacementCommandRepository.cs @@ -0,0 +1,27 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Domain.Models.Commands; +using Microsoft.AspNetCore.Http; + +namespace BMA.EHR.Application.Repositories.Commands +{ + public class PlacementCommandRepository : GenericRepository + { + #region " Fields " + + private readonly IApplicationDBContext _dbContext; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destuctor " + + public PlacementCommandRepository(IApplicationDBContext dbContext, + IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor) + { + _dbContext = dbContext; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + } +} diff --git a/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj b/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj new file mode 100644 index 00000000..8687132a --- /dev/null +++ b/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj @@ -0,0 +1,46 @@ + + + + net7.0 + enable + enable + 0d97b8e7-fe6d-44da-9b8f-1c24fae4e9e0 + Linux + True + . + BMA.EHR.Command.Service + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BMA.EHR.Command.Service/ConfigureSwaggerOptions.cs b/BMA.EHR.Command.Service/ConfigureSwaggerOptions.cs new file mode 100644 index 00000000..a2823cea --- /dev/null +++ b/BMA.EHR.Command.Service/ConfigureSwaggerOptions.cs @@ -0,0 +1,84 @@ +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.Extensions.Options; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Reflection; + +namespace BMA.EHR.Command.Service +{ + public class ConfigureSwaggerOptions : IConfigureNamedOptions + { + private readonly IApiVersionDescriptionProvider _provider; + + public ConfigureSwaggerOptions( + IApiVersionDescriptionProvider provider) + { + _provider = provider; + } + + public void Configure(SwaggerGenOptions options) + { + // add swagger document for every API version discovered + foreach (var description in _provider.ApiVersionDescriptions) + { + options.EnableAnnotations(); + + options.SwaggerDoc( + description.GroupName, + CreateVersionInfo(description)); + } + + options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme + { + In = ParameterLocation.Header, + Description = "Please enter a valid token", + Name = "Authorization", + Type = SecuritySchemeType.Http, + BearerFormat = "JWT", + Scheme = "Bearer" + }); + + options.AddSecurityRequirement(new OpenApiSecurityRequirement + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Type = ReferenceType.SecurityScheme, + Id = "Bearer" + } + }, + new string[]{} + } + }); + + // generate the XML docs that'll drive the swagger docs + var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); + options.IncludeXmlComments(xmlPath); + } + + public void Configure(string name, SwaggerGenOptions options) + { + Configure(options); + } + + private OpenApiInfo CreateVersionInfo( + ApiVersionDescription desc) + { + var info = new OpenApiInfo() + { + Title = "BMA EHR Command Service Document", + Version = desc.ApiVersion.ToString() + }; + + if (desc.IsDeprecated) + { + info.Description += " This API version has been deprecated. Please use one of the new APIs available from the explorer."; + } + + return info; + } + } +} diff --git a/BMA.EHR.Command.Service/Dockerfile b/BMA.EHR.Command.Service/Dockerfile new file mode 100644 index 00000000..3f284066 --- /dev/null +++ b/BMA.EHR.Command.Service/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj", "BMA.EHR.Command.Service/"] +RUN dotnet restore "BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj" +COPY . . +WORKDIR "/src/BMA.EHR.Command.Service" +RUN dotnet build "BMA.EHR.Command.Service.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "BMA.EHR.Command.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "BMA.EHR.Command.Service.dll"] \ No newline at end of file diff --git a/BMA.EHR.Command.Service/Program.cs b/BMA.EHR.Command.Service/Program.cs new file mode 100644 index 00000000..fbd2f938 --- /dev/null +++ b/BMA.EHR.Command.Service/Program.cs @@ -0,0 +1,161 @@ +using BMA.EHR.Application; +using BMA.EHR.Command.Service; +using BMA.EHR.Domain.Middlewares; +using BMA.EHR.Infrastructure; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.Versioning; +using Microsoft.EntityFrameworkCore; +using Microsoft.IdentityModel.Logging; +using Microsoft.IdentityModel.Tokens; +using Serilog; +using Serilog.Exceptions; +using Serilog.Sinks.Elasticsearch; +using System.Reflection; +using System.Text; + +var builder = WebApplication.CreateBuilder(args); +{ + var issuer = builder.Configuration["Jwt:Issuer"]; + var key = builder.Configuration["Jwt:Key"]; + + + IdentityModelEventSource.ShowPII = true; + + 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")); + }); + + builder.Services.AddVersionedApiExplorer(setup => + { + setup.GroupNameFormat = "'v'VVV"; + setup.SubstituteApiVersionInUrl = true; + }); + + 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)) + }; + }); + builder.Services.AddAuthorization(); + + // use serilog + ConfigureLogs(); + builder.Host.UseSerilog(); + + // Add config CORS + builder.Services.AddCors(options => options.AddDefaultPolicy(builder => + { + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .SetIsOriginAllowedToAllowWildcardSubdomains(); + })); + + + // Add services to the container. + builder.Services.AddApplication(); + builder.Services.AddPersistence(builder.Configuration); + + builder.Services.AddControllers(options => + { + options.SuppressAsyncSuffixInActionNames = false; + }) + .AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); + + 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.MapHealthChecks("/health"); + + + app.UseHttpsRedirection(); + app.UseCors(); + app.UseAuthentication(); + app.UseAuthorization(); + app.UseDefaultFiles(); + app.UseStaticFiles(); + app.MapControllers(); + app.UseMiddleware(); + + // apply migrations + await using var scope = app.Services.CreateAsyncScope(); + await using var db = scope.ServiceProvider.GetRequiredService(); + 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(); + + Log.Logger = new LoggerConfiguration() + .Enrich.FromLogContext() + .MinimumLevel.Error() + .WriteTo.Console() + .Enrich.WithExceptionDetails() + .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(".", "-")}" + }; +} + diff --git a/BMA.EHR.Command.Service/Properties/launchSettings.json b/BMA.EHR.Command.Service/Properties/launchSettings.json new file mode 100644 index 00000000..65995b87 --- /dev/null +++ b/BMA.EHR.Command.Service/Properties/launchSettings.json @@ -0,0 +1,48 @@ +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5240" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7003;http://localhost:5240" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:51682", + "sslPort": 44303 + } + } +} \ No newline at end of file diff --git a/BMA.EHR.Command.Service/appsettings.Development.json b/BMA.EHR.Command.Service/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/BMA.EHR.Command.Service/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BMA.EHR.Command.Service/appsettings.json b/BMA.EHR.Command.Service/appsettings.json new file mode 100644 index 00000000..4c80fbc7 --- /dev/null +++ b/BMA.EHR.Command.Service/appsettings.json @@ -0,0 +1,35 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Information", + "System": "Warning" + } + } + }, + "ElasticConfiguration": { + "Uri": "http://localhost:9200" + }, + "AllowedHosts": "*", + "ConnectionStrings": { + //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB", + "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + }, + "Jwt": { + "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", + "Issuer": "https://identity.frappet.com/realms/bma-ehr" + }, + "EPPlus": { + "ExcelPackage": { + "LicenseContext": "NonCommercial" + } + }, + "MinIO": { + "Endpoint": "https://s3.frappet.com/", + "AccessKey": "frappet", + "SecretKey": "P@ssw0rd", + "BucketName": "bma-recruit" + }, + "Protocol": "HTTPS" +} \ No newline at end of file diff --git a/BMA.EHR.Command.Service/wwwroot/index.html b/BMA.EHR.Command.Service/wwwroot/index.html new file mode 100644 index 00000000..ece944ac --- /dev/null +++ b/BMA.EHR.Command.Service/wwwroot/index.html @@ -0,0 +1,184 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +

Result

+

+
+    

Events

+

+
+
+    
+
+
\ No newline at end of file
diff --git a/BMA.EHR.Command.Service/wwwroot/keycloak.js b/BMA.EHR.Command.Service/wwwroot/keycloak.js
new file mode 100644
index 00000000..936a3c3c
--- /dev/null
+++ b/BMA.EHR.Command.Service/wwwroot/keycloak.js
@@ -0,0 +1,1766 @@
+/*
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function(root, factory) {
+    if ( typeof exports === 'object' ) {
+        if ( typeof module === 'object' ) {
+            module.exports = factory( require("js-sha256"), require("base64-js") );
+        } else {
+            exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
+        }
+    } else {
+        /**
+        * [js-sha256]{@link https://github.com/emn178/js-sha256}
+        *
+        * @version 0.9.0
+        * @author Chen, Yi-Cyuan [emn178@gmail.com]
+        * @copyright Chen, Yi-Cyuan 2014-2017
+        * @license MIT
+        */
+        !function () { "use strict"; function t(t, i) { i ? (d[0] = d[16] = d[1] = d[2] = d[3] = d[4] = d[5] = d[6] = d[7] = d[8] = d[9] = d[10] = d[11] = d[12] = d[13] = d[14] = d[15] = 0, this.blocks = d) : this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], t ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = t } function i(i, r, s) { var e, n = typeof i; if ("string" === n) { var o, a = [], u = i.length, c = 0; for (e = 0; e < u; ++e)(o = i.charCodeAt(e)) < 128 ? a[c++] = o : o < 2048 ? (a[c++] = 192 | o >> 6, a[c++] = 128 | 63 & o) : o < 55296 || o >= 57344 ? (a[c++] = 224 | o >> 12, a[c++] = 128 | o >> 6 & 63, a[c++] = 128 | 63 & o) : (o = 65536 + ((1023 & o) << 10 | 1023 & i.charCodeAt(++e)), a[c++] = 240 | o >> 18, a[c++] = 128 | o >> 12 & 63, a[c++] = 128 | o >> 6 & 63, a[c++] = 128 | 63 & o); i = a } else { if ("object" !== n) throw new Error(h); if (null === i) throw new Error(h); if (f && i.constructor === ArrayBuffer) i = new Uint8Array(i); else if (!(Array.isArray(i) || f && ArrayBuffer.isView(i))) throw new Error(h) } i.length > 64 && (i = new t(r, !0).update(i).array()); var y = [], p = []; for (e = 0; e < 64; ++e) { var l = i[e] || 0; y[e] = 92 ^ l, p[e] = 54 ^ l } t.call(this, r, s), this.update(p), this.oKeyPad = y, this.inner = !0, this.sharedMemory = s } var h = "input is invalid type", r = "object" == typeof window, s = r ? window : {}; s.JS_SHA256_NO_WINDOW && (r = !1); var e = !r && "object" == typeof self, n = !s.JS_SHA256_NO_NODE_JS && "object" == typeof process && process.versions && process.versions.node; n ? s = global : e && (s = self); var o = !s.JS_SHA256_NO_COMMON_JS && "object" == typeof module && module.exports, a = "function" == typeof define && define.amd, f = !s.JS_SHA256_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer, u = "0123456789abcdef".split(""), c = [-2147483648, 8388608, 32768, 128], y = [24, 16, 8, 0], p = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], l = ["hex", "array", "digest", "arrayBuffer"], d = []; !s.JS_SHA256_NO_NODE_JS && Array.isArray || (Array.isArray = function (t) { return "[object Array]" === Object.prototype.toString.call(t) }), !f || !s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function (t) { return "object" == typeof t && t.buffer && t.buffer.constructor === ArrayBuffer }); var A = function (i, h) { return function (r) { return new t(h, !0).update(r)[i]() } }, w = function (i) { var h = A("hex", i); n && (h = b(h, i)), h.create = function () { return new t(i) }, h.update = function (t) { return h.create().update(t) }; for (var r = 0; r < l.length; ++r) { var s = l[r]; h[s] = A(s, i) } return h }, b = function (t, i) { var r = eval("require('crypto')"), s = eval("require('buffer').Buffer"), e = i ? "sha224" : "sha256", n = function (i) { if ("string" == typeof i) return r.createHash(e).update(i, "utf8").digest("hex"); if (null === i || void 0 === i) throw new Error(h); return i.constructor === ArrayBuffer && (i = new Uint8Array(i)), Array.isArray(i) || ArrayBuffer.isView(i) || i.constructor === s ? r.createHash(e).update(new s(i)).digest("hex") : t(i) }; return n }, v = function (t, h) { return function (r, s) { return new i(r, h, !0).update(s)[t]() } }, _ = function (t) { var h = v("hex", t); h.create = function (h) { return new i(h, t) }, h.update = function (t, i) { return h.create(t).update(i) }; for (var r = 0; r < l.length; ++r) { var s = l[r]; h[s] = v(s, t) } return h }; t.prototype.update = function (t) { if (!this.finalized) { var i, r = typeof t; if ("string" !== r) { if ("object" !== r) throw new Error(h); if (null === t) throw new Error(h); if (f && t.constructor === ArrayBuffer) t = new Uint8Array(t); else if (!(Array.isArray(t) || f && ArrayBuffer.isView(t))) throw new Error(h); i = !0 } for (var s, e, n = 0, o = t.length, a = this.blocks; n < o;) { if (this.hashed && (this.hashed = !1, a[0] = this.block, a[16] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = a[10] = a[11] = a[12] = a[13] = a[14] = a[15] = 0), i) for (e = this.start; n < o && e < 64; ++n)a[e >> 2] |= t[n] << y[3 & e++]; else for (e = this.start; n < o && e < 64; ++n)(s = t.charCodeAt(n)) < 128 ? a[e >> 2] |= s << y[3 & e++] : s < 2048 ? (a[e >> 2] |= (192 | s >> 6) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]) : s < 55296 || s >= 57344 ? (a[e >> 2] |= (224 | s >> 12) << y[3 & e++], a[e >> 2] |= (128 | s >> 6 & 63) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]) : (s = 65536 + ((1023 & s) << 10 | 1023 & t.charCodeAt(++n)), a[e >> 2] |= (240 | s >> 18) << y[3 & e++], a[e >> 2] |= (128 | s >> 12 & 63) << y[3 & e++], a[e >> 2] |= (128 | s >> 6 & 63) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]); this.lastByteIndex = e, this.bytes += e - this.start, e >= 64 ? (this.block = a[16], this.start = e - 64, this.hash(), this.hashed = !0) : this.start = e } return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes = this.bytes % 4294967296), this } }, t.prototype.finalize = function () { if (!this.finalized) { this.finalized = !0; var t = this.blocks, i = this.lastByteIndex; t[16] = this.block, t[i >> 2] |= c[3 & i], this.block = t[16], i >= 56 && (this.hashed || this.hash(), t[0] = this.block, t[16] = t[1] = t[2] = t[3] = t[4] = t[5] = t[6] = t[7] = t[8] = t[9] = t[10] = t[11] = t[12] = t[13] = t[14] = t[15] = 0), t[14] = this.hBytes << 3 | this.bytes >>> 29, t[15] = this.bytes << 3, this.hash() } }, t.prototype.hash = function () { var t, i, h, r, s, e, n, o, a, f = this.h0, u = this.h1, c = this.h2, y = this.h3, l = this.h4, d = this.h5, A = this.h6, w = this.h7, b = this.blocks; for (t = 16; t < 64; ++t)i = ((s = b[t - 15]) >>> 7 | s << 25) ^ (s >>> 18 | s << 14) ^ s >>> 3, h = ((s = b[t - 2]) >>> 17 | s << 15) ^ (s >>> 19 | s << 13) ^ s >>> 10, b[t] = b[t - 16] + i + b[t - 7] + h << 0; for (a = u & c, t = 0; t < 64; t += 4)this.first ? (this.is224 ? (e = 300032, w = (s = b[0] - 1413257819) - 150054599 << 0, y = s + 24177077 << 0) : (e = 704751109, w = (s = b[0] - 210244248) - 1521486534 << 0, y = s + 143694565 << 0), this.first = !1) : (i = (f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10), r = (e = f & u) ^ f & c ^ a, w = y + (s = w + (h = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7)) + (l & d ^ ~l & A) + p[t] + b[t]) << 0, y = s + (i + r) << 0), i = (y >>> 2 | y << 30) ^ (y >>> 13 | y << 19) ^ (y >>> 22 | y << 10), r = (n = y & f) ^ y & u ^ e, A = c + (s = A + (h = (w >>> 6 | w << 26) ^ (w >>> 11 | w << 21) ^ (w >>> 25 | w << 7)) + (w & l ^ ~w & d) + p[t + 1] + b[t + 1]) << 0, i = ((c = s + (i + r) << 0) >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10), r = (o = c & y) ^ c & f ^ n, d = u + (s = d + (h = (A >>> 6 | A << 26) ^ (A >>> 11 | A << 21) ^ (A >>> 25 | A << 7)) + (A & w ^ ~A & l) + p[t + 2] + b[t + 2]) << 0, i = ((u = s + (i + r) << 0) >>> 2 | u << 30) ^ (u >>> 13 | u << 19) ^ (u >>> 22 | u << 10), r = (a = u & c) ^ u & y ^ o, l = f + (s = l + (h = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7)) + (d & A ^ ~d & w) + p[t + 3] + b[t + 3]) << 0, f = s + (i + r) << 0; this.h0 = this.h0 + f << 0, this.h1 = this.h1 + u << 0, this.h2 = this.h2 + c << 0, this.h3 = this.h3 + y << 0, this.h4 = this.h4 + l << 0, this.h5 = this.h5 + d << 0, this.h6 = this.h6 + A << 0, this.h7 = this.h7 + w << 0 }, t.prototype.hex = function () { this.finalize(); var t = this.h0, i = this.h1, h = this.h2, r = this.h3, s = this.h4, e = this.h5, n = this.h6, o = this.h7, a = u[t >> 28 & 15] + u[t >> 24 & 15] + u[t >> 20 & 15] + u[t >> 16 & 15] + u[t >> 12 & 15] + u[t >> 8 & 15] + u[t >> 4 & 15] + u[15 & t] + u[i >> 28 & 15] + u[i >> 24 & 15] + u[i >> 20 & 15] + u[i >> 16 & 15] + u[i >> 12 & 15] + u[i >> 8 & 15] + u[i >> 4 & 15] + u[15 & i] + u[h >> 28 & 15] + u[h >> 24 & 15] + u[h >> 20 & 15] + u[h >> 16 & 15] + u[h >> 12 & 15] + u[h >> 8 & 15] + u[h >> 4 & 15] + u[15 & h] + u[r >> 28 & 15] + u[r >> 24 & 15] + u[r >> 20 & 15] + u[r >> 16 & 15] + u[r >> 12 & 15] + u[r >> 8 & 15] + u[r >> 4 & 15] + u[15 & r] + u[s >> 28 & 15] + u[s >> 24 & 15] + u[s >> 20 & 15] + u[s >> 16 & 15] + u[s >> 12 & 15] + u[s >> 8 & 15] + u[s >> 4 & 15] + u[15 & s] + u[e >> 28 & 15] + u[e >> 24 & 15] + u[e >> 20 & 15] + u[e >> 16 & 15] + u[e >> 12 & 15] + u[e >> 8 & 15] + u[e >> 4 & 15] + u[15 & e] + u[n >> 28 & 15] + u[n >> 24 & 15] + u[n >> 20 & 15] + u[n >> 16 & 15] + u[n >> 12 & 15] + u[n >> 8 & 15] + u[n >> 4 & 15] + u[15 & n]; return this.is224 || (a += u[o >> 28 & 15] + u[o >> 24 & 15] + u[o >> 20 & 15] + u[o >> 16 & 15] + u[o >> 12 & 15] + u[o >> 8 & 15] + u[o >> 4 & 15] + u[15 & o]), a }, t.prototype.toString = t.prototype.hex, t.prototype.digest = function () { this.finalize(); var t = this.h0, i = this.h1, h = this.h2, r = this.h3, s = this.h4, e = this.h5, n = this.h6, o = this.h7, a = [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, i >> 24 & 255, i >> 16 & 255, i >> 8 & 255, 255 & i, h >> 24 & 255, h >> 16 & 255, h >> 8 & 255, 255 & h, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, 255 & r, s >> 24 & 255, s >> 16 & 255, s >> 8 & 255, 255 & s, e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, 255 & e, n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, 255 & n]; return this.is224 || a.push(o >> 24 & 255, o >> 16 & 255, o >> 8 & 255, 255 & o), a }, t.prototype.array = t.prototype.digest, t.prototype.arrayBuffer = function () { this.finalize(); var t = new ArrayBuffer(this.is224 ? 28 : 32), i = new DataView(t); return i.setUint32(0, this.h0), i.setUint32(4, this.h1), i.setUint32(8, this.h2), i.setUint32(12, this.h3), i.setUint32(16, this.h4), i.setUint32(20, this.h5), i.setUint32(24, this.h6), this.is224 || i.setUint32(28, this.h7), t }, i.prototype = new t, i.prototype.finalize = function () { if (t.prototype.finalize.call(this), this.inner) { this.inner = !1; var i = this.array(); t.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(i), t.prototype.finalize.call(this) } }; var B = w(); B.sha256 = B, B.sha224 = w(!0), B.sha256.hmac = _(), B.sha224.hmac = _(!0), o ? module.exports = B : (s.sha256 = B.sha256, s.sha224 = B.sha224, a && define(function () { return B })) }();
+
+        /**
+         * [base64-js]{@link https://github.com/beatgammit/base64-js}
+         *
+         * @version v1.3.0
+         * @author Kirill, Fomichev
+         * @copyright Kirill, Fomichev 2014
+         * @license MIT
+         */
+        (function (r) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = r() } else if (typeof define === "function" && define.amd) { define([], r) } else { var e; if (typeof window !== "undefined") { e = window } else if (typeof global !== "undefined") { e = global } else if (typeof self !== "undefined") { e = self } else { e = this } e.base64js = r() } })(function () { var r, e, n; return function () { function r(e, n, t) { function o(f, i) { if (!n[f]) { if (!e[f]) { var u = "function" == typeof require && require; if (!i && u) return u(f, !0); if (a) return a(f, !0); var v = new Error("Cannot find module '" + f + "'"); throw v.code = "MODULE_NOT_FOUND", v } var d = n[f] = { exports: {} }; e[f][0].call(d.exports, function (r) { var n = e[f][1][r]; return o(n || r) }, d, d.exports, r, e, n, t) } return n[f].exports } for (var a = "function" == typeof require && require, f = 0; f < t.length; f++)o(t[f]); return o } return r }()({ "/": [function (r, e, n) { "use strict"; n.byteLength = d; n.toByteArray = h; n.fromByteArray = p; var t = []; var o = []; var a = typeof Uint8Array !== "undefined" ? Uint8Array : Array; var f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for (var i = 0, u = f.length; i < u; ++i) { t[i] = f[i]; o[f.charCodeAt(i)] = i } o["-".charCodeAt(0)] = 62; o["_".charCodeAt(0)] = 63; function v(r) { var e = r.length; if (e % 4 > 0) { throw new Error("Invalid string. Length must be a multiple of 4") } var n = r.indexOf("="); if (n === -1) n = e; var t = n === e ? 0 : 4 - n % 4; return [n, t] } function d(r) { var e = v(r); var n = e[0]; var t = e[1]; return (n + t) * 3 / 4 - t } function c(r, e, n) { return (e + n) * 3 / 4 - n } function h(r) { var e; var n = v(r); var t = n[0]; var f = n[1]; var i = new a(c(r, t, f)); var u = 0; var d = f > 0 ? t - 4 : t; for (var h = 0; h < d; h += 4) { e = o[r.charCodeAt(h)] << 18 | o[r.charCodeAt(h + 1)] << 12 | o[r.charCodeAt(h + 2)] << 6 | o[r.charCodeAt(h + 3)]; i[u++] = e >> 16 & 255; i[u++] = e >> 8 & 255; i[u++] = e & 255 } if (f === 2) { e = o[r.charCodeAt(h)] << 2 | o[r.charCodeAt(h + 1)] >> 4; i[u++] = e & 255 } if (f === 1) { e = o[r.charCodeAt(h)] << 10 | o[r.charCodeAt(h + 1)] << 4 | o[r.charCodeAt(h + 2)] >> 2; i[u++] = e >> 8 & 255; i[u++] = e & 255 } return i } function s(r) { return t[r >> 18 & 63] + t[r >> 12 & 63] + t[r >> 6 & 63] + t[r & 63] } function l(r, e, n) { var t; var o = []; for (var a = e; a < n; a += 3) { t = (r[a] << 16 & 16711680) + (r[a + 1] << 8 & 65280) + (r[a + 2] & 255); o.push(s(t)) } return o.join("") } function p(r) { var e; var n = r.length; var o = n % 3; var a = []; var f = 16383; for (var i = 0, u = n - o; i < u; i += f) { a.push(l(r, i, i + f > u ? u : i + f)) } if (o === 1) { e = r[n - 1]; a.push(t[e >> 2] + t[e << 4 & 63] + "==") } else if (o === 2) { e = (r[n - 2] << 8) + r[n - 1]; a.push(t[e >> 10] + t[e >> 4 & 63] + t[e << 2 & 63] + "=") } return a.join("") } }, {}] }, {}, [])("/") });
+
+        /**
+         * [promise-polyfill]{@link https://github.com/taylorhakes/promise-polyfill}
+         *
+         * @version v8.1.3
+         * @author Hakes, Taylor
+         * @copyright Hakes, Taylor 2014
+         * @license MIT
+         */
+        !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(e){return!(!e||"undefined"==typeof e.length)}function t(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}function r(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(r){return void f(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}function i(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof o)return e._state=3,e._value=n,void u(e);if("function"==typeof t)return void c(function(e,n){return function(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}function f(e,n){e._state=2,e._value=n,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}function c(e,n){var t=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var o=new this.constructor(t);return r(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){return new o(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(t,r){if(!n(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o});
+
+        var Keycloak = factory( root["sha256"], root["base64js"] );
+        root["Keycloak"] = Keycloak;
+
+        if ( typeof define === "function" && define.amd ) {
+            define( "keycloak", [], function () { return Keycloak; } );
+        }
+    }
+})(window, function (sha256_imported, base64js_imported) {
+    if (typeof Promise === 'undefined') {
+        throw Error('Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.');
+    }
+
+    var loggedPromiseDeprecation = false;
+
+    function logPromiseDeprecation() {
+        if (!loggedPromiseDeprecation) {
+            loggedPromiseDeprecation = true;
+            console.warn('[KEYCLOAK] Usage of legacy style promise methods such as `.error()` and `.success()` has been deprecated and support will be removed in future versions. Use standard style promise methods such as `.then() and `.catch()` instead.');
+        }
+    }
+
+    function Keycloak (config) {
+        if (!(this instanceof Keycloak)) {
+            return new Keycloak(config);
+        }
+
+        var kc = this;
+        var adapter;
+        var refreshQueue = [];
+        var callbackStorage;
+
+        var loginIframe = {
+            enable: true,
+            callbackList: [],
+            interval: 5
+        };
+
+        var scripts = document.getElementsByTagName('script');
+        for (var i = 0; i < scripts.length; i++) {
+            if ((scripts[i].src.indexOf('keycloak.js') !== -1 || scripts[i].src.indexOf('keycloak.min.js') !== -1) && scripts[i].src.indexOf('version=') !== -1) {
+                kc.iframeVersion = scripts[i].src.substring(scripts[i].src.indexOf('version=') + 8).split('&')[0];
+            }
+        }
+
+        var useNonce = true;
+        var logInfo = createLogger(console.info);
+        var logWarn = createLogger(console.warn);
+
+        kc.init = function (initOptions) {
+            kc.authenticated = false;
+
+            callbackStorage = createCallbackStorage();
+            var adapters = ['default', 'cordova', 'cordova-native'];
+
+            if (initOptions && adapters.indexOf(initOptions.adapter) > -1) {
+                adapter = loadAdapter(initOptions.adapter);
+            } else if (initOptions && typeof initOptions.adapter === "object") {
+                adapter = initOptions.adapter;
+            } else {
+                if (window.Cordova || window.cordova) {
+                    adapter = loadAdapter('cordova');
+                } else {
+                    adapter = loadAdapter();
+                }
+            }
+
+            if (initOptions) {
+                if (typeof initOptions.useNonce !== 'undefined') {
+                    useNonce = initOptions.useNonce;
+                }
+
+                if (typeof initOptions.checkLoginIframe !== 'undefined') {
+                    loginIframe.enable = initOptions.checkLoginIframe;
+                }
+
+                if (initOptions.checkLoginIframeInterval) {
+                    loginIframe.interval = initOptions.checkLoginIframeInterval;
+                }
+
+                if (initOptions.onLoad === 'login-required') {
+                    kc.loginRequired = true;
+                }
+
+                if (initOptions.responseMode) {
+                    if (initOptions.responseMode === 'query' || initOptions.responseMode === 'fragment') {
+                        kc.responseMode = initOptions.responseMode;
+                    } else {
+                        throw 'Invalid value for responseMode';
+                    }
+                }
+
+                if (initOptions.flow) {
+                    switch (initOptions.flow) {
+                        case 'standard':
+                            kc.responseType = 'code';
+                            break;
+                        case 'implicit':
+                            kc.responseType = 'id_token token';
+                            break;
+                        case 'hybrid':
+                            kc.responseType = 'code id_token token';
+                            break;
+                        default:
+                            throw 'Invalid value for flow';
+                    }
+                    kc.flow = initOptions.flow;
+                }
+
+                if (initOptions.timeSkew != null) {
+                    kc.timeSkew = initOptions.timeSkew;
+                }
+
+                if(initOptions.redirectUri) {
+                    kc.redirectUri = initOptions.redirectUri;
+                }
+
+                if (initOptions.silentCheckSsoRedirectUri) {
+                    kc.silentCheckSsoRedirectUri = initOptions.silentCheckSsoRedirectUri;
+                }
+
+                if (typeof initOptions.silentCheckSsoFallback === 'boolean') {
+                    kc.silentCheckSsoFallback = initOptions.silentCheckSsoFallback;
+                } else {
+                    kc.silentCheckSsoFallback = true;
+                }
+
+                if (initOptions.pkceMethod) {
+                    if (initOptions.pkceMethod !== "S256") {
+                        throw 'Invalid value for pkceMethod';
+                    }
+                    kc.pkceMethod = initOptions.pkceMethod;
+                }
+
+                if (typeof initOptions.enableLogging === 'boolean') {
+                    kc.enableLogging = initOptions.enableLogging;
+                } else {
+                    kc.enableLogging = false;
+                }
+
+                if (typeof initOptions.scope === 'string') {
+                    kc.scope = initOptions.scope;
+                }
+
+                if (typeof initOptions.messageReceiveTimeout === 'number' && initOptions.messageReceiveTimeout > 0) {
+                    kc.messageReceiveTimeout = initOptions.messageReceiveTimeout;
+                } else {
+                    kc.messageReceiveTimeout = 10000;
+                }
+            }
+
+            if (!kc.responseMode) {
+                kc.responseMode = 'fragment';
+            }
+            if (!kc.responseType) {
+                kc.responseType = 'code';
+                kc.flow = 'standard';
+            }
+
+            var promise = createPromise();
+
+            var initPromise = createPromise();
+            initPromise.promise.then(function() {
+                kc.onReady && kc.onReady(kc.authenticated);
+                promise.setSuccess(kc.authenticated);
+            }).catch(function(error) {
+                promise.setError(error);
+            });
+
+            var configPromise = loadConfig(config);
+
+            function onLoad() {
+                var doLogin = function(prompt) {
+                    if (!prompt) {
+                        options.prompt = 'none';
+                    }
+
+                    kc.login(options).then(function () {
+                        initPromise.setSuccess();
+                    }).catch(function (error) {
+                        initPromise.setError(error);
+                    });
+                }
+
+                var checkSsoSilently = function() {
+                    var ifrm = document.createElement("iframe");
+                    var src = kc.createLoginUrl({prompt: 'none', redirectUri: kc.silentCheckSsoRedirectUri});
+                    ifrm.setAttribute("src", src);
+                    ifrm.setAttribute("title", "keycloak-silent-check-sso");
+                    ifrm.style.display = "none";
+                    document.body.appendChild(ifrm);
+
+                    var messageCallback = function(event) {
+                        if (event.origin !== window.location.origin || ifrm.contentWindow !== event.source) {
+                            return;
+                        }
+
+                        var oauth = parseCallback(event.data);
+                        processCallback(oauth, initPromise);
+
+                        document.body.removeChild(ifrm);
+                        window.removeEventListener("message", messageCallback);
+                    };
+
+                    window.addEventListener("message", messageCallback);
+                };
+
+                var options = {};
+                switch (initOptions.onLoad) {
+                    case 'check-sso':
+                        if (loginIframe.enable) {
+                            setupCheckLoginIframe().then(function() {
+                                checkLoginIframe().then(function (unchanged) {
+                                    if (!unchanged) {
+                                        kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);
+                                    } else {
+                                        initPromise.setSuccess();
+                                    }
+                                }).catch(function (error) {
+                                    initPromise.setError(error);
+                                });
+                            });
+                        } else {
+                            kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);
+                        }
+                        break;
+                    case 'login-required':
+                        doLogin(true);
+                        break;
+                    default:
+                        throw 'Invalid value for onLoad';
+                }
+            }
+
+            function processInit() {
+                var callback = parseCallback(window.location.href);
+
+                if (callback) {
+                    window.history.replaceState(window.history.state, null, callback.newUrl);
+                }
+
+                if (callback && callback.valid) {
+                    return setupCheckLoginIframe().then(function() {
+                        processCallback(callback, initPromise);
+                    }).catch(function (error) {
+                        initPromise.setError(error);
+                    });
+                } else if (initOptions) {
+                    if (initOptions.token && initOptions.refreshToken) {
+                        setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);
+
+                        if (loginIframe.enable) {
+                            setupCheckLoginIframe().then(function() {
+                                checkLoginIframe().then(function (unchanged) {
+                                    if (unchanged) {
+                                        kc.onAuthSuccess && kc.onAuthSuccess();
+                                        initPromise.setSuccess();
+                                        scheduleCheckIframe();
+                                    } else {
+                                        initPromise.setSuccess();
+                                    }
+                                }).catch(function (error) {
+                                    initPromise.setError(error);
+                                });
+                            });
+                        } else {
+                            kc.updateToken(-1).then(function() {
+                                kc.onAuthSuccess && kc.onAuthSuccess();
+                                initPromise.setSuccess();
+                            }).catch(function(error) {
+                                kc.onAuthError && kc.onAuthError();
+                                if (initOptions.onLoad) {
+                                    onLoad();
+                                } else {
+                                    initPromise.setError(error);
+                                }
+                            });
+                        }
+                    } else if (initOptions.onLoad) {
+                        onLoad();
+                    } else {
+                        initPromise.setSuccess();
+                    }
+                } else {
+                    initPromise.setSuccess();
+                }
+            }
+
+            function domReady() {
+                var promise = createPromise();
+
+                var checkReadyState = function () {
+                    if (document.readyState === 'interactive' || document.readyState === 'complete') {
+                        document.removeEventListener('readystatechange', checkReadyState);
+                        promise.setSuccess();
+                    }
+                }
+                document.addEventListener('readystatechange', checkReadyState);
+
+                checkReadyState(); // just in case the event was already fired and we missed it (in case the init is done later than at the load time, i.e. it's done from code)
+
+                return promise.promise;
+            }
+
+            configPromise.then(function () {
+                domReady()
+                    .then(check3pCookiesSupported)
+                    .then(processInit)
+                    .catch(function (error) {
+                        promise.setError(error);
+                    });
+            });
+            configPromise.catch(function (error) {
+                promise.setError(error);
+            });
+
+            return promise.promise;
+        }
+
+        kc.login = function (options) {
+            return adapter.login(options);
+        }
+
+        function generateRandomData(len) {
+            // use web crypto APIs if possible
+            var array = null;
+            var crypto = window.crypto || window.msCrypto;
+            if (crypto && crypto.getRandomValues && window.Uint8Array) {
+                array = new Uint8Array(len);
+                crypto.getRandomValues(array);
+                return array;
+            }
+
+            // fallback to Math random
+            array = new Array(len);
+            for (var j = 0; j < array.length; j++) {
+                array[j] = Math.floor(256 * Math.random());
+            }
+            return array;
+        }
+
+        function generateCodeVerifier(len) {
+            return generateRandomString(len, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
+        }
+
+        function generateRandomString(len, alphabet){
+            var randomData = generateRandomData(len);
+            var chars = new Array(len);
+            for (var i = 0; i < len; i++) {
+                chars[i] = alphabet.charCodeAt(randomData[i] % alphabet.length);
+            }
+            return String.fromCharCode.apply(null, chars);
+        }
+
+        function generatePkceChallenge(pkceMethod, codeVerifier) {
+            switch (pkceMethod) {
+                // The use of the "plain" method is considered insecure and therefore not supported.
+                case "S256":
+                    // hash codeVerifier, then encode as url-safe base64 without padding
+                    var hashBytes = new Uint8Array(sha256_imported.arrayBuffer(codeVerifier));
+                    var encodedHash = base64js_imported.fromByteArray(hashBytes)
+                        .replace(/\+/g, '-')
+                        .replace(/\//g, '_')
+                        .replace(/\=/g, '');
+                    return encodedHash;
+                default:
+                    throw 'Invalid value for pkceMethod';
+            }
+        }
+
+        kc.createLoginUrl = function(options) {
+            var state = createUUID();
+            var nonce = createUUID();
+
+            var redirectUri = adapter.redirectUri(options);
+
+            var callbackState = {
+                state: state,
+                nonce: nonce,
+                redirectUri: encodeURIComponent(redirectUri)
+            };
+
+            if (options && options.prompt) {
+                callbackState.prompt = options.prompt;
+            }
+
+            var baseUrl;
+            if (options && options.action == 'register') {
+                baseUrl = kc.endpoints.register();
+            } else {
+                baseUrl = kc.endpoints.authorize();
+            }
+
+            var scope = options && options.scope || kc.scope;
+            if (!scope) {
+                // if scope is not set, default to "openid"
+                scope = "openid";
+            } else if (scope.indexOf("openid") === -1) {
+                // if openid scope is missing, prefix the given scopes with it
+                scope = "openid " + scope;
+            }
+
+            var url = baseUrl
+                + '?client_id=' + encodeURIComponent(kc.clientId)
+                + '&redirect_uri=' + encodeURIComponent(redirectUri)
+                + '&state=' + encodeURIComponent(state)
+                + '&response_mode=' + encodeURIComponent(kc.responseMode)
+                + '&response_type=' + encodeURIComponent(kc.responseType)
+                + '&scope=' + encodeURIComponent(scope);
+            if (useNonce) {
+                url = url + '&nonce=' + encodeURIComponent(nonce);
+            }
+
+            if (options && options.prompt) {
+                url += '&prompt=' + encodeURIComponent(options.prompt);
+            }
+
+            if (options && options.maxAge) {
+                url += '&max_age=' + encodeURIComponent(options.maxAge);
+            }
+
+            if (options && options.loginHint) {
+                url += '&login_hint=' + encodeURIComponent(options.loginHint);
+            }
+
+            if (options && options.idpHint) {
+                url += '&kc_idp_hint=' + encodeURIComponent(options.idpHint);
+            }
+
+            if (options && options.action && options.action != 'register') {
+                url += '&kc_action=' + encodeURIComponent(options.action);
+            }
+
+            if (options && options.locale) {
+                url += '&ui_locales=' + encodeURIComponent(options.locale);
+            }
+
+            if (kc.pkceMethod) {
+                var codeVerifier = generateCodeVerifier(96);
+                callbackState.pkceCodeVerifier = codeVerifier;
+                var pkceChallenge = generatePkceChallenge(kc.pkceMethod, codeVerifier);
+                url += '&code_challenge=' + pkceChallenge;
+                url += '&code_challenge_method=' + kc.pkceMethod;
+            }
+
+            callbackStorage.add(callbackState);
+
+            return url;
+        }
+
+        kc.logout = function(options) {
+            return adapter.logout(options);
+        }
+
+        kc.createLogoutUrl = function(options) {
+            var url = kc.endpoints.logout()
+                + '?redirect_uri=' + encodeURIComponent(adapter.redirectUri(options, false));
+
+            return url;
+        }
+
+        kc.register = function (options) {
+            return adapter.register(options);
+        }
+
+        kc.createRegisterUrl = function(options) {
+            if (!options) {
+                options = {};
+            }
+            options.action = 'register';
+            return kc.createLoginUrl(options);
+        }
+
+        kc.createAccountUrl = function(options) {
+            var realm = getRealmUrl();
+            var url = undefined;
+            if (typeof realm !== 'undefined') {
+                url = realm
+                + '/account'
+                + '?referrer=' + encodeURIComponent(kc.clientId)
+                + '&referrer_uri=' + encodeURIComponent(adapter.redirectUri(options));
+            }
+            return url;
+        }
+
+        kc.accountManagement = function() {
+            return adapter.accountManagement();
+        }
+
+        kc.hasRealmRole = function (role) {
+            var access = kc.realmAccess;
+            return !!access && access.roles.indexOf(role) >= 0;
+        }
+
+        kc.hasResourceRole = function(role, resource) {
+            if (!kc.resourceAccess) {
+                return false;
+            }
+
+            var access = kc.resourceAccess[resource || kc.clientId];
+            return !!access && access.roles.indexOf(role) >= 0;
+        }
+
+        kc.loadUserProfile = function() {
+            var url = getRealmUrl() + '/account';
+            var req = new XMLHttpRequest();
+            req.open('GET', url, true);
+            req.setRequestHeader('Accept', 'application/json');
+            req.setRequestHeader('Authorization', 'bearer ' + kc.token);
+
+            var promise = createPromise();
+
+            req.onreadystatechange = function () {
+                if (req.readyState == 4) {
+                    if (req.status == 200) {
+                        kc.profile = JSON.parse(req.responseText);
+                        promise.setSuccess(kc.profile);
+                    } else {
+                        promise.setError();
+                    }
+                }
+            }
+
+            req.send();
+
+            return promise.promise;
+        }
+
+        kc.loadUserInfo = function() {
+            var url = kc.endpoints.userinfo();
+            var req = new XMLHttpRequest();
+            req.open('GET', url, true);
+            req.setRequestHeader('Accept', 'application/json');
+            req.setRequestHeader('Authorization', 'bearer ' + kc.token);
+
+            var promise = createPromise();
+
+            req.onreadystatechange = function () {
+                if (req.readyState == 4) {
+                    if (req.status == 200) {
+                        kc.userInfo = JSON.parse(req.responseText);
+                        promise.setSuccess(kc.userInfo);
+                    } else {
+                        promise.setError();
+                    }
+                }
+            }
+
+            req.send();
+
+            return promise.promise;
+        }
+
+        kc.isTokenExpired = function(minValidity) {
+            if (!kc.tokenParsed || (!kc.refreshToken && kc.flow != 'implicit' )) {
+                throw 'Not authenticated';
+            }
+
+            if (kc.timeSkew == null) {
+                logInfo('[KEYCLOAK] Unable to determine if token is expired as timeskew is not set');
+                return true;
+            }
+
+            var expiresIn = kc.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + kc.timeSkew;
+            if (minValidity) {
+                if (isNaN(minValidity)) {
+                    throw 'Invalid minValidity';
+                }
+                expiresIn -= minValidity;
+            }
+            return expiresIn < 0;
+        }
+
+        kc.updateToken = function(minValidity) {
+            var promise = createPromise();
+
+            if (!kc.refreshToken) {
+                promise.setError();
+                return promise.promise;
+            }
+
+            minValidity = minValidity || 5;
+
+            var exec = function() {
+                var refreshToken = false;
+                if (minValidity == -1) {
+                    refreshToken = true;
+                    logInfo('[KEYCLOAK] Refreshing token: forced refresh');
+                } else if (!kc.tokenParsed || kc.isTokenExpired(minValidity)) {
+                    refreshToken = true;
+                    logInfo('[KEYCLOAK] Refreshing token: token expired');
+                }
+
+                if (!refreshToken) {
+                    promise.setSuccess(false);
+                } else {
+                    var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;
+                    var url = kc.endpoints.token();
+
+                    refreshQueue.push(promise);
+
+                    if (refreshQueue.length == 1) {
+                        var req = new XMLHttpRequest();
+                        req.open('POST', url, true);
+                        req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+                        req.withCredentials = true;
+
+                        params += '&client_id=' + encodeURIComponent(kc.clientId);
+
+                        var timeLocal = new Date().getTime();
+
+                        req.onreadystatechange = function () {
+                            if (req.readyState == 4) {
+                                if (req.status == 200) {
+                                    logInfo('[KEYCLOAK] Token refreshed');
+
+                                    timeLocal = (timeLocal + new Date().getTime()) / 2;
+
+                                    var tokenResponse = JSON.parse(req.responseText);
+
+                                    setToken(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], timeLocal);
+
+                                    kc.onAuthRefreshSuccess && kc.onAuthRefreshSuccess();
+                                    for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
+                                        p.setSuccess(true);
+                                    }
+                                } else {
+                                    logWarn('[KEYCLOAK] Failed to refresh token');
+
+                                    if (req.status == 400) {
+                                        kc.clearToken();
+                                    }
+
+                                    kc.onAuthRefreshError && kc.onAuthRefreshError();
+                                    for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
+                                        p.setError(true);
+                                    }
+                                }
+                            }
+                        };
+
+                        req.send(params);
+                    }
+                }
+            }
+
+            if (loginIframe.enable) {
+                var iframePromise = checkLoginIframe();
+                iframePromise.then(function() {
+                    exec();
+                }).catch(function(error) {
+                    promise.setError(error);
+                });
+            } else {
+                exec();
+            }
+
+            return promise.promise;
+        }
+
+        kc.clearToken = function() {
+            if (kc.token) {
+                setToken(null, null, null);
+                kc.onAuthLogout && kc.onAuthLogout();
+                if (kc.loginRequired) {
+                    kc.login();
+                }
+            }
+        }
+
+        function getRealmUrl() {
+            if (typeof kc.authServerUrl !== 'undefined') {
+                if (kc.authServerUrl.charAt(kc.authServerUrl.length - 1) == '/') {
+                    return kc.authServerUrl + 'realms/' + encodeURIComponent(kc.realm);
+                } else {
+                    return kc.authServerUrl + '/realms/' + encodeURIComponent(kc.realm);
+                }
+            } else {
+            	return undefined;
+            }
+        }
+
+        function getOrigin() {
+            if (!window.location.origin) {
+                return window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
+            } else {
+                return window.location.origin;
+            }
+        }
+
+        function processCallback(oauth, promise) {
+            var code = oauth.code;
+            var error = oauth.error;
+            var prompt = oauth.prompt;
+
+            var timeLocal = new Date().getTime();
+
+            if (oauth['kc_action_status']) {
+                kc.onActionUpdate && kc.onActionUpdate(oauth['kc_action_status']);
+            }
+
+            if (error) {
+                if (prompt != 'none') {
+                    var errorData = { error: error, error_description: oauth.error_description };
+                    kc.onAuthError && kc.onAuthError(errorData);
+                    promise && promise.setError(errorData);
+                } else {
+                    promise && promise.setSuccess();
+                }
+                return;
+            } else if ((kc.flow != 'standard') && (oauth.access_token || oauth.id_token)) {
+                authSuccess(oauth.access_token, null, oauth.id_token, true);
+            }
+
+            if ((kc.flow != 'implicit') && code) {
+                var params = 'code=' + code + '&grant_type=authorization_code';
+                var url = kc.endpoints.token();
+
+                var req = new XMLHttpRequest();
+                req.open('POST', url, true);
+                req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+
+                params += '&client_id=' + encodeURIComponent(kc.clientId);
+                params += '&redirect_uri=' + oauth.redirectUri;
+
+                if (oauth.pkceCodeVerifier) {
+                    params += '&code_verifier=' + oauth.pkceCodeVerifier;
+                }
+
+                req.withCredentials = true;
+
+                req.onreadystatechange = function() {
+                    if (req.readyState == 4) {
+                        if (req.status == 200) {
+
+                            var tokenResponse = JSON.parse(req.responseText);
+                            authSuccess(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], kc.flow === 'standard');
+                            scheduleCheckIframe();
+                        } else {
+                            kc.onAuthError && kc.onAuthError();
+                            promise && promise.setError();
+                        }
+                    }
+                };
+
+                req.send(params);
+            }
+
+            function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
+                timeLocal = (timeLocal + new Date().getTime()) / 2;
+
+                setToken(accessToken, refreshToken, idToken, timeLocal);
+
+                if (useNonce && ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||
+                    (kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||
+                    (kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce))) {
+
+                    logInfo('[KEYCLOAK] Invalid nonce, clearing token');
+                    kc.clearToken();
+                    promise && promise.setError();
+                } else {
+                    if (fulfillPromise) {
+                        kc.onAuthSuccess && kc.onAuthSuccess();
+                        promise && promise.setSuccess();
+                    }
+                }
+            }
+
+        }
+
+        function loadConfig(url) {
+            var promise = createPromise();
+            var configUrl;
+
+            if (!config) {
+                configUrl = 'keycloak.json';
+            } else if (typeof config === 'string') {
+                configUrl = config;
+            }
+
+            function setupOidcEndoints(oidcConfiguration) {
+                if (! oidcConfiguration) {
+                    kc.endpoints = {
+                        authorize: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/auth';
+                        },
+                        token: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/token';
+                        },
+                        logout: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/logout';
+                        },
+                        checkSessionIframe: function() {
+                            var src = getRealmUrl() + '/protocol/openid-connect/login-status-iframe.html';
+                            if (kc.iframeVersion) {
+                              src = src + '?version=' + kc.iframeVersion;
+                            }
+                            return src;
+                        },
+                        thirdPartyCookiesIframe: function() {
+                            var src = getRealmUrl() + '/protocol/openid-connect/3p-cookies/step1.html';
+                            if (kc.iframeVersion) {
+                                src = src + '?version=' + kc.iframeVersion;
+                            }
+                            return src;
+                        },
+                        register: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/registrations';
+                        },
+                        userinfo: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/userinfo';
+                        }
+                    };
+                } else {
+                    kc.endpoints = {
+                        authorize: function() {
+                            return oidcConfiguration.authorization_endpoint;
+                        },
+                        token: function() {
+                            return oidcConfiguration.token_endpoint;
+                        },
+                        logout: function() {
+                            if (!oidcConfiguration.end_session_endpoint) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.end_session_endpoint;
+                        },
+                        checkSessionIframe: function() {
+                            if (!oidcConfiguration.check_session_iframe) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.check_session_iframe;
+                        },
+                        register: function() {
+                            throw 'Redirection to "Register user" page not supported in standard OIDC mode';
+                        },
+                        userinfo: function() {
+                            if (!oidcConfiguration.userinfo_endpoint) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.userinfo_endpoint;
+                        }
+                    }
+                }
+            }
+
+            if (configUrl) {
+                var req = new XMLHttpRequest();
+                req.open('GET', configUrl, true);
+                req.setRequestHeader('Accept', 'application/json');
+
+                req.onreadystatechange = function () {
+                    if (req.readyState == 4) {
+                        if (req.status == 200 || fileLoaded(req)) {
+                            var config = JSON.parse(req.responseText);
+
+                            kc.authServerUrl = config['auth-server-url'];
+                            kc.realm = config['realm'];
+                            kc.clientId = config['resource'];
+                            setupOidcEndoints(null);
+                            promise.setSuccess();
+                        } else {
+                            promise.setError();
+                        }
+                    }
+                };
+
+                req.send();
+            } else {
+                if (!config.clientId) {
+                    throw 'clientId missing';
+                }
+
+                kc.clientId = config.clientId;
+
+                var oidcProvider = config['oidcProvider'];
+                if (!oidcProvider) {
+                    if (!config['url']) {
+                        var scripts = document.getElementsByTagName('script');
+                        for (var i = 0; i < scripts.length; i++) {
+                            if (scripts[i].src.match(/.*keycloak\.js/)) {
+                                config.url = scripts[i].src.substr(0, scripts[i].src.indexOf('/js/keycloak.js'));
+                                break;
+                            }
+                        }
+                    }
+                    if (!config.realm) {
+                        throw 'realm missing';
+                    }
+
+                    kc.authServerUrl = config.url;
+                    kc.realm = config.realm;
+                    setupOidcEndoints(null);
+                    promise.setSuccess();
+                } else {
+                    if (typeof oidcProvider === 'string') {
+                        var oidcProviderConfigUrl;
+                        if (oidcProvider.charAt(oidcProvider.length - 1) == '/') {
+                            oidcProviderConfigUrl = oidcProvider + '.well-known/openid-configuration';
+                        } else {
+                            oidcProviderConfigUrl = oidcProvider + '/.well-known/openid-configuration';
+                        }
+                        var req = new XMLHttpRequest();
+                        req.open('GET', oidcProviderConfigUrl, true);
+                        req.setRequestHeader('Accept', 'application/json');
+
+                        req.onreadystatechange = function () {
+                            if (req.readyState == 4) {
+                                if (req.status == 200 || fileLoaded(req)) {
+                                    var oidcProviderConfig = JSON.parse(req.responseText);
+                                    setupOidcEndoints(oidcProviderConfig);
+                                    promise.setSuccess();
+                                } else {
+                                    promise.setError();
+                                }
+                            }
+                        };
+
+                        req.send();
+                    } else {
+                        setupOidcEndoints(oidcProvider);
+                        promise.setSuccess();
+                    }
+                }
+            }
+
+            return promise.promise;
+        }
+
+        function fileLoaded(xhr) {
+            return xhr.status == 0 && xhr.responseText && xhr.responseURL.startsWith('file:');
+        }
+
+        function setToken(token, refreshToken, idToken, timeLocal) {
+            if (kc.tokenTimeoutHandle) {
+                clearTimeout(kc.tokenTimeoutHandle);
+                kc.tokenTimeoutHandle = null;
+            }
+
+            if (refreshToken) {
+                kc.refreshToken = refreshToken;
+                kc.refreshTokenParsed = decodeToken(refreshToken);
+            } else {
+                delete kc.refreshToken;
+                delete kc.refreshTokenParsed;
+            }
+
+            if (idToken) {
+                kc.idToken = idToken;
+                kc.idTokenParsed = decodeToken(idToken);
+            } else {
+                delete kc.idToken;
+                delete kc.idTokenParsed;
+            }
+
+            if (token) {
+                kc.token = token;
+                kc.tokenParsed = decodeToken(token);
+                kc.sessionId = kc.tokenParsed.session_state;
+                kc.authenticated = true;
+                kc.subject = kc.tokenParsed.sub;
+                kc.realmAccess = kc.tokenParsed.realm_access;
+                kc.resourceAccess = kc.tokenParsed.resource_access;
+
+                if (timeLocal) {
+                    kc.timeSkew = Math.floor(timeLocal / 1000) - kc.tokenParsed.iat;
+                }
+
+                if (kc.timeSkew != null) {
+                    logInfo('[KEYCLOAK] Estimated time difference between browser and server is ' + kc.timeSkew + ' seconds');
+
+                    if (kc.onTokenExpired) {
+                        var expiresIn = (kc.tokenParsed['exp'] - (new Date().getTime() / 1000) + kc.timeSkew) * 1000;
+                        logInfo('[KEYCLOAK] Token expires in ' + Math.round(expiresIn / 1000) + ' s');
+                        if (expiresIn <= 0) {
+                            kc.onTokenExpired();
+                        } else {
+                            kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn);
+                        }
+                    }
+                }
+            } else {
+                delete kc.token;
+                delete kc.tokenParsed;
+                delete kc.subject;
+                delete kc.realmAccess;
+                delete kc.resourceAccess;
+
+                kc.authenticated = false;
+            }
+        }
+
+        function decodeToken(str) {
+            str = str.split('.')[1];
+
+            str = str.replace(/-/g, '+');
+            str = str.replace(/_/g, '/');
+            switch (str.length % 4) {
+                case 0:
+                    break;
+                case 2:
+                    str += '==';
+                    break;
+                case 3:
+                    str += '=';
+                    break;
+                default:
+                    throw 'Invalid token';
+            }
+
+            str = decodeURIComponent(escape(atob(str)));
+
+            str = JSON.parse(str);
+            return str;
+        }
+
+        function createUUID() {
+            var hexDigits = '0123456789abcdef';
+            var s = generateRandomString(36, hexDigits).split("");
+            s[14] = '4';
+            s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
+            s[8] = s[13] = s[18] = s[23] = '-';
+            var uuid = s.join('');
+            return uuid;
+        }
+
+        function parseCallback(url) {
+            var oauth = parseCallbackUrl(url);
+            if (!oauth) {
+                return;
+            }
+
+            var oauthState = callbackStorage.get(oauth.state);
+
+            if (oauthState) {
+                oauth.valid = true;
+                oauth.redirectUri = oauthState.redirectUri;
+                oauth.storedNonce = oauthState.nonce;
+                oauth.prompt = oauthState.prompt;
+                oauth.pkceCodeVerifier = oauthState.pkceCodeVerifier;
+            }
+
+            return oauth;
+        }
+
+        function parseCallbackUrl(url) {
+            var supportedParams;
+            switch (kc.flow) {
+                case 'standard':
+                    supportedParams = ['code', 'state', 'session_state', 'kc_action_status'];
+                    break;
+                case 'implicit':
+                    supportedParams = ['access_token', 'token_type', 'id_token', 'state', 'session_state', 'expires_in', 'kc_action_status'];
+                    break;
+                case 'hybrid':
+                    supportedParams = ['access_token', 'token_type', 'id_token', 'code', 'state', 'session_state', 'expires_in', 'kc_action_status'];
+                    break;
+            }
+
+            supportedParams.push('error');
+            supportedParams.push('error_description');
+            supportedParams.push('error_uri');
+
+            var queryIndex = url.indexOf('?');
+            var fragmentIndex = url.indexOf('#');
+
+            var newUrl;
+            var parsed;
+
+            if (kc.responseMode === 'query' && queryIndex !== -1) {
+                newUrl = url.substring(0, queryIndex);
+                parsed = parseCallbackParams(url.substring(queryIndex + 1, fragmentIndex !== -1 ? fragmentIndex : url.length), supportedParams);
+                if (parsed.paramsString !== '') {
+                    newUrl += '?' + parsed.paramsString;
+                }
+                if (fragmentIndex !== -1) {
+                    newUrl += url.substring(fragmentIndex);
+                }
+            } else if (kc.responseMode === 'fragment' && fragmentIndex !== -1) {
+                newUrl = url.substring(0, fragmentIndex);
+                parsed = parseCallbackParams(url.substring(fragmentIndex + 1), supportedParams);
+                if (parsed.paramsString !== '') {
+                    newUrl += '#' + parsed.paramsString;
+                }
+            }
+
+            if (parsed && parsed.oauthParams) {
+                if (kc.flow === 'standard' || kc.flow === 'hybrid') {
+                    if ((parsed.oauthParams.code || parsed.oauthParams.error) && parsed.oauthParams.state) {
+                        parsed.oauthParams.newUrl = newUrl;
+                        return parsed.oauthParams;
+                    }
+                } else if (kc.flow === 'implicit') {
+                    if ((parsed.oauthParams.access_token || parsed.oauthParams.error) && parsed.oauthParams.state) {
+                        parsed.oauthParams.newUrl = newUrl;
+                        return parsed.oauthParams;
+                    }
+                }
+            }
+        }
+
+        function parseCallbackParams(paramsString, supportedParams) {
+            var p = paramsString.split('&');
+            var result = {
+                paramsString: '',
+                oauthParams: {}
+            }
+            for (var i = 0; i < p.length; i++) {
+                var split = p[i].indexOf("=");
+                var key = p[i].slice(0, split);
+                if (supportedParams.indexOf(key) !== -1) {
+                    result.oauthParams[key] = p[i].slice(split + 1);
+                } else {
+                    if (result.paramsString !== '') {
+                        result.paramsString += '&';
+                    }
+                    result.paramsString += p[i];
+                }
+            }
+            return result;
+        }
+
+        function createPromise() {
+            // Need to create a native Promise which also preserves the
+            // interface of the custom promise type previously used by the API
+            var p = {
+                setSuccess: function(result) {
+                    p.resolve(result);
+                },
+
+                setError: function(result) {
+                    p.reject(result);
+                }
+            };
+            p.promise = new Promise(function(resolve, reject) {
+                p.resolve = resolve;
+                p.reject = reject;
+            });
+
+            p.promise.success = function(callback) {
+                logPromiseDeprecation();
+
+                this.then(function handleSuccess(value) {
+                    callback(value);
+                });
+
+                return this;
+            }
+
+            p.promise.error = function(callback) {
+                logPromiseDeprecation();
+
+                this.catch(function handleError(error) {
+                    callback(error);
+                });
+
+                return this;
+            }
+
+            return p;
+        }
+
+        // Function to extend existing native Promise with timeout
+        function applyTimeoutToPromise(promise, timeout, errorMessage) {
+            var timeoutHandle = null;
+            var timeoutPromise = new Promise(function (resolve, reject) {
+                timeoutHandle = setTimeout(function () {
+                    reject({ "error": errorMessage || "Promise is not settled within timeout of " + timeout + "ms" });
+                }, timeout);
+            });
+
+            return Promise.race([promise, timeoutPromise]).finally(function () {
+                clearTimeout(timeoutHandle);
+            });
+        }
+
+        function setupCheckLoginIframe() {
+            var promise = createPromise();
+
+            if (!loginIframe.enable) {
+                promise.setSuccess();
+                return promise.promise;
+            }
+
+            if (loginIframe.iframe) {
+                promise.setSuccess();
+                return promise.promise;
+            }
+
+            var iframe = document.createElement('iframe');
+            loginIframe.iframe = iframe;
+
+            iframe.onload = function() {
+                var authUrl = kc.endpoints.authorize();
+                if (authUrl.charAt(0) === '/') {
+                    loginIframe.iframeOrigin = getOrigin();
+                } else {
+                    loginIframe.iframeOrigin = authUrl.substring(0, authUrl.indexOf('/', 8));
+                }
+                promise.setSuccess();
+            }
+
+            var src = kc.endpoints.checkSessionIframe();
+            iframe.setAttribute('src', src );
+            iframe.setAttribute('title', 'keycloak-session-iframe' );
+            iframe.style.display = 'none';
+            document.body.appendChild(iframe);
+
+            var messageCallback = function(event) {
+                if ((event.origin !== loginIframe.iframeOrigin) || (loginIframe.iframe.contentWindow !== event.source)) {
+                    return;
+                }
+
+                if (!(event.data == 'unchanged' || event.data == 'changed' || event.data == 'error')) {
+                    return;
+                }
+
+
+                if (event.data != 'unchanged') {
+                    kc.clearToken();
+                }
+
+                var callbacks = loginIframe.callbackList.splice(0, loginIframe.callbackList.length);
+
+                for (var i = callbacks.length - 1; i >= 0; --i) {
+                    var promise = callbacks[i];
+                    if (event.data == 'error') {
+                        promise.setError();
+                    } else {
+                        promise.setSuccess(event.data == 'unchanged');
+                    }
+                }
+            };
+
+            window.addEventListener('message', messageCallback, false);
+
+            return promise.promise;
+        }
+
+        function scheduleCheckIframe() {
+            if (loginIframe.enable) {
+                if (kc.token) {
+                    setTimeout(function() {
+                        checkLoginIframe().then(function(unchanged) {
+                            if (unchanged) {
+                                scheduleCheckIframe();
+                            }
+                        });
+                    }, loginIframe.interval * 1000);
+                }
+            }
+        }
+
+        function checkLoginIframe() {
+            var promise = createPromise();
+
+            if (loginIframe.iframe && loginIframe.iframeOrigin ) {
+                var msg = kc.clientId + ' ' + (kc.sessionId ? kc.sessionId : '');
+                loginIframe.callbackList.push(promise);
+                var origin = loginIframe.iframeOrigin;
+                if (loginIframe.callbackList.length == 1) {
+                    loginIframe.iframe.contentWindow.postMessage(msg, origin);
+                }
+            } else {
+                promise.setSuccess();
+            }
+
+            return promise.promise;
+        }
+
+        function check3pCookiesSupported() {
+            var promise = createPromise();
+
+            if (loginIframe.enable || kc.silentCheckSsoRedirectUri) {
+                var iframe = document.createElement('iframe');
+                iframe.setAttribute('src', kc.endpoints.thirdPartyCookiesIframe());
+                iframe.setAttribute('title', 'keycloak-3p-check-iframe' );
+                iframe.style.display = 'none';
+                document.body.appendChild(iframe);
+
+                var messageCallback = function(event) {
+                    if (iframe.contentWindow !== event.source) {
+                        return;
+                    }
+
+                    if (event.data !== "supported" && event.data !== "unsupported") {
+                        return;
+                    } else if (event.data === "unsupported") {
+                        loginIframe.enable = false;
+                        if (kc.silentCheckSsoFallback) {
+                            kc.silentCheckSsoRedirectUri = false;
+                        }
+                        logWarn("[KEYCLOAK] 3rd party cookies aren't supported by this browser. checkLoginIframe and " +
+                            "silent check-sso are not available.")
+                    }
+
+                    document.body.removeChild(iframe);
+                    window.removeEventListener("message", messageCallback);
+                    promise.setSuccess();
+                };
+
+                window.addEventListener('message', messageCallback, false);
+            } else {
+                promise.setSuccess();
+            }
+
+            return applyTimeoutToPromise(promise.promise, kc.messageReceiveTimeout, "Timeout when waiting for 3rd party check iframe message.");
+        }
+
+        function loadAdapter(type) {
+            if (!type || type == 'default') {
+                return {
+                    login: function(options) {
+                        window.location.replace(kc.createLoginUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    logout: function(options) {
+                        window.location.replace(kc.createLogoutUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    register: function(options) {
+                        window.location.replace(kc.createRegisterUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            window.location.href = accountUrl;
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                        return createPromise().promise;
+                    },
+
+                    redirectUri: function(options, encodeHash) {
+                        if (arguments.length == 1) {
+                            encodeHash = true;
+                        }
+
+                        if (options && options.redirectUri) {
+                            return options.redirectUri;
+                        } else if (kc.redirectUri) {
+                            return kc.redirectUri;
+                        } else {
+                            return location.href;
+                        }
+                    }
+                };
+            }
+
+            if (type == 'cordova') {
+                loginIframe.enable = false;
+                var cordovaOpenWindowWrapper = function(loginUrl, target, options) {
+                    if (window.cordova && window.cordova.InAppBrowser) {
+                        // Use inappbrowser for IOS and Android if available
+                        return window.cordova.InAppBrowser.open(loginUrl, target, options);
+                    } else {
+                        return window.open(loginUrl, target, options);
+                    }
+                };
+
+                var shallowCloneCordovaOptions = function (userOptions) {
+                    if (userOptions && userOptions.cordovaOptions) {
+                        return Object.keys(userOptions.cordovaOptions).reduce(function (options, optionName) {
+                            options[optionName] = userOptions.cordovaOptions[optionName];
+                            return options;
+                        }, {});
+                    } else {
+                        return {};
+                    }
+                };
+
+                var formatCordovaOptions = function (cordovaOptions) {
+                    return Object.keys(cordovaOptions).reduce(function (options, optionName) {
+                        options.push(optionName+"="+cordovaOptions[optionName]);
+                        return options;
+                    }, []).join(",");
+                };
+
+                var createCordovaOptions = function (userOptions) {
+                    var cordovaOptions = shallowCloneCordovaOptions(userOptions);
+                    cordovaOptions.location = 'no';
+                    if (userOptions && userOptions.prompt == 'none') {
+                        cordovaOptions.hidden = 'yes';
+                    }
+                    return formatCordovaOptions(cordovaOptions);
+                };
+
+                return {
+                    login: function(options) {
+                        var promise = createPromise();
+
+                        var cordovaOptions = createCordovaOptions(options);
+                        var loginUrl = kc.createLoginUrl(options);
+                        var ref = cordovaOpenWindowWrapper(loginUrl, '_blank', cordovaOptions);
+                        var completed = false;
+
+                        var closed = false;
+                        var closeBrowser = function() {
+                            closed = true;
+                            ref.close();
+                        };
+
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                var callback = parseCallback(event.url);
+                                processCallback(callback, promise);
+                                closeBrowser();
+                                completed = true;
+                            }
+                        });
+
+                        ref.addEventListener('loaderror', function(event) {
+                            if (!completed) {
+                                if (event.url.indexOf('http://localhost') == 0) {
+                                    var callback = parseCallback(event.url);
+                                    processCallback(callback, promise);
+                                    closeBrowser();
+                                    completed = true;
+                                } else {
+                                    promise.setError();
+                                    closeBrowser();
+                                }
+                            }
+                        });
+
+                        ref.addEventListener('exit', function(event) {
+                            if (!closed) {
+                                promise.setError({
+                                    reason: "closed_by_user"
+                                });
+                            }
+                        });
+
+                        return promise.promise;
+                    },
+
+                    logout: function(options) {
+                        var promise = createPromise();
+
+                        var logoutUrl = kc.createLogoutUrl(options);
+                        var ref = cordovaOpenWindowWrapper(logoutUrl, '_blank', 'location=no,hidden=yes,clearcache=yes');
+
+                        var error;
+
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                            }
+                        });
+
+                        ref.addEventListener('loaderror', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                            } else {
+                                error = true;
+                                ref.close();
+                            }
+                        });
+
+                        ref.addEventListener('exit', function(event) {
+                            if (error) {
+                                promise.setError();
+                            } else {
+                                kc.clearToken();
+                                promise.setSuccess();
+                            }
+                        });
+
+                        return promise.promise;
+                    },
+
+                    register : function(options) {
+                        var promise = createPromise();
+                        var registerUrl = kc.createRegisterUrl();
+                        var cordovaOptions = createCordovaOptions(options);
+                        var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                                var oauth = parseCallback(event.url);
+                                processCallback(oauth, promise);
+                            }
+                        });
+                        return promise.promise;
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            var ref = cordovaOpenWindowWrapper(accountUrl, '_blank', 'location=no');
+                            ref.addEventListener('loadstart', function(event) {
+                                if (event.url.indexOf('http://localhost') == 0) {
+                                    ref.close();
+                                }
+                            });
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                    },
+
+                    redirectUri: function(options) {
+                        return 'http://localhost';
+                    }
+                }
+            }
+
+            if (type == 'cordova-native') {
+                loginIframe.enable = false;
+
+                return {
+                    login: function(options) {
+                        var promise = createPromise();
+                        var loginUrl = kc.createLoginUrl(options);
+
+                        universalLinks.subscribe('keycloak', function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            var oauth = parseCallback(event.url);
+                            processCallback(oauth, promise);
+                        });
+
+                        window.cordova.plugins.browsertab.openUrl(loginUrl);
+                        return promise.promise;
+                    },
+
+                    logout: function(options) {
+                        var promise = createPromise();
+                        var logoutUrl = kc.createLogoutUrl(options);
+
+                        universalLinks.subscribe('keycloak', function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            kc.clearToken();
+                            promise.setSuccess();
+                        });
+
+                        window.cordova.plugins.browsertab.openUrl(logoutUrl);
+                        return promise.promise;
+                    },
+
+                    register : function(options) {
+                        var promise = createPromise();
+                        var registerUrl = kc.createRegisterUrl(options);
+                        universalLinks.subscribe('keycloak' , function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            var oauth = parseCallback(event.url);
+                            processCallback(oauth, promise);
+                        });
+                        window.cordova.plugins.browsertab.openUrl(registerUrl);
+                        return promise.promise;
+
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            window.cordova.plugins.browsertab.openUrl(accountUrl);
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                    },
+
+                    redirectUri: function(options) {
+                        if (options && options.redirectUri) {
+                            return options.redirectUri;
+                        } else if (kc.redirectUri) {
+                            return kc.redirectUri;
+                        } else {
+                            return "http://localhost";
+                        }
+                    }
+                }
+            }
+
+            throw 'invalid adapter type: ' + type;
+        }
+
+        var LocalStorage = function() {
+            if (!(this instanceof LocalStorage)) {
+                return new LocalStorage();
+            }
+
+            localStorage.setItem('kc-test', 'test');
+            localStorage.removeItem('kc-test');
+
+            var cs = this;
+
+            function clearExpired() {
+                var time = new Date().getTime();
+                for (var i = 0; i < localStorage.length; i++)  {
+                    var key = localStorage.key(i);
+                    if (key && key.indexOf('kc-callback-') == 0) {
+                        var value = localStorage.getItem(key);
+                        if (value) {
+                            try {
+                                var expires = JSON.parse(value).expires;
+                                if (!expires || expires < time) {
+                                    localStorage.removeItem(key);
+                                }
+                            } catch (err) {
+                                localStorage.removeItem(key);
+                            }
+                        }
+                    }
+                }
+            }
+
+            cs.get = function(state) {
+                if (!state) {
+                    return;
+                }
+
+                var key = 'kc-callback-' + state;
+                var value = localStorage.getItem(key);
+                if (value) {
+                    localStorage.removeItem(key);
+                    value = JSON.parse(value);
+                }
+
+                clearExpired();
+                return value;
+            };
+
+            cs.add = function(state) {
+                clearExpired();
+
+                var key = 'kc-callback-' + state.state;
+                state.expires = new Date().getTime() + (60 * 60 * 1000);
+                localStorage.setItem(key, JSON.stringify(state));
+            };
+        };
+
+        var CookieStorage = function() {
+            if (!(this instanceof CookieStorage)) {
+                return new CookieStorage();
+            }
+
+            var cs = this;
+
+            cs.get = function(state) {
+                if (!state) {
+                    return;
+                }
+
+                var value = getCookie('kc-callback-' + state);
+                setCookie('kc-callback-' + state, '', cookieExpiration(-100));
+                if (value) {
+                    return JSON.parse(value);
+                }
+            };
+
+            cs.add = function(state) {
+                setCookie('kc-callback-' + state.state, JSON.stringify(state), cookieExpiration(60));
+            };
+
+            cs.removeItem = function(key) {
+                setCookie(key, '', cookieExpiration(-100));
+            };
+
+            var cookieExpiration = function (minutes) {
+                var exp = new Date();
+                exp.setTime(exp.getTime() + (minutes*60*1000));
+                return exp;
+            };
+
+            var getCookie = function (key) {
+                var name = key + '=';
+                var ca = document.cookie.split(';');
+                for (var i = 0; i < ca.length; i++) {
+                    var c = ca[i];
+                    while (c.charAt(0) == ' ') {
+                        c = c.substring(1);
+                    }
+                    if (c.indexOf(name) == 0) {
+                        return c.substring(name.length, c.length);
+                    }
+                }
+                return '';
+            };
+
+            var setCookie = function (key, value, expirationDate) {
+                var cookie = key + '=' + value + '; '
+                    + 'expires=' + expirationDate.toUTCString() + '; ';
+                document.cookie = cookie;
+            }
+        };
+
+        function createCallbackStorage() {
+            try {
+                return new LocalStorage();
+            } catch (err) {
+            }
+
+            return new CookieStorage();
+        }
+
+        function createLogger(fn) {
+            return function() {
+                if (kc.enableLogging) {
+                    fn.apply(console, Array.prototype.slice.call(arguments));
+                }
+            };
+        }
+    }
+
+    return Keycloak;
+})
diff --git a/BMA.EHR.Command.Service/wwwroot/keycloak.json b/BMA.EHR.Command.Service/wwwroot/keycloak.json
new file mode 100644
index 00000000..9eba3b39
--- /dev/null
+++ b/BMA.EHR.Command.Service/wwwroot/keycloak.json
@@ -0,0 +1,7 @@
+{
+  "realm": "bma-ehr",
+  "auth-server-url": "https://identity.frappet.com",
+  "ssl-required": "external",
+  "resource": "bma-ehr",
+  "public-client": true
+}
\ No newline at end of file
diff --git a/BMA.EHR.Domain/Middlewares/ErrorHandlerMiddleware.cs b/BMA.EHR.Domain/Middlewares/ErrorHandlerMiddleware.cs
index 74b0d660..3bc1c9bf 100644
--- a/BMA.EHR.Domain/Middlewares/ErrorHandlerMiddleware.cs
+++ b/BMA.EHR.Domain/Middlewares/ErrorHandlerMiddleware.cs
@@ -31,18 +31,20 @@ namespace BMA.EHR.Domain.Middlewares
                 await _next(context);
 
                 var response = context.Response;
-                response.ContentType = "application/json";
+                
 
                 var responseModel = new ResponseObject();
                 responseModel.Status = response.StatusCode;
 
                 if (responseModel.Status == (int)HttpStatusCode.Unauthorized)
                 {
+                    response.ContentType = "application/json";
                     responseModel.Message = GlobalMessages.NotAuthorized;
                     await response.WriteAsJsonAsync(responseModel);
                 }
                 if (responseModel.Status == (int)HttpStatusCode.Forbidden)
                 {
+                    response.ContentType = "application/json";
                     responseModel.Message = GlobalMessages.ForbiddenAccess;
                     await response.WriteAsJsonAsync(responseModel);
                 }
diff --git a/BMA.EHR.Domain/Models/Commands/Core/Command.cs b/BMA.EHR.Domain/Models/Commands/Core/Command.cs
new file mode 100644
index 00000000..42f98831
--- /dev/null
+++ b/BMA.EHR.Domain/Models/Commands/Core/Command.cs
@@ -0,0 +1,44 @@
+using BMA.EHR.Domain.Models.Base;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BMA.EHR.Domain.Models.Commands.Core
+{
+    public abstract class Command : EntityBase
+    {
+        [MaxLength(10), Comment("เลขที่คำสั่ง")]
+        public string CommandNo { get; set; } = string.Empty;
+
+        [MaxLength(4), Comment("ปีที่ออกคำสั่ง")]
+        public string CommandYear { get; set; } = string.Empty;
+
+        [Required, Comment("รหัสอ้างอิงประเภทคำสั่ง")]
+        public Guid CommandTypeId { get; set; } = Guid.Empty;
+
+        public CommandType CommandType { get; set; }
+
+        [Required, Comment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง")]
+        public Guid IssuerOrganizationId { get; set; } = Guid.Empty;
+
+        [Required, Comment("หน่วยงานที่ออกคำสั่ง")]
+        public string IssuerOrganizationName { get; set; } = string.Empty;
+
+        [Required, Comment("รหัสอ้างอิงสถานะคำสั่ง")]
+        public Guid CommandStatusId { get; set; } = Guid.Empty;
+
+        public CommandStatus CommandStatus { get; set; }
+
+        [Required, Comment("รหัสอ้างอิงผู้มีอำนาจลงนาม")]
+        public Guid AuthorizedUserId { get; set; } = Guid.Empty;
+
+        [Required, Comment("ชื่อผู้มีอำนาจลงนาม")]
+        public string AuthorizedUserFullName { get; set; } = string.Empty;
+
+        public virtual List Documents { get; set; } = new();
+    }
+}
diff --git a/BMA.EHR.Domain/Models/Commands/Core/CommandDocument.cs b/BMA.EHR.Domain/Models/Commands/Core/CommandDocument.cs
new file mode 100644
index 00000000..9b35acc2
--- /dev/null
+++ b/BMA.EHR.Domain/Models/Commands/Core/CommandDocument.cs
@@ -0,0 +1,19 @@
+using BMA.EHR.Domain.Models.Base;
+using BMA.EHR.Domain.Models.Documents;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
+
+namespace BMA.EHR.Domain.Models.Commands.Core
+{
+    public class CommandDocument : EntityBase
+    {
+        [Required, Comment("ประเภทเอกสาร")]
+        public string Category { get; set; } = string.Empty;
+
+        [Required, Comment("อ้างอิงรหัสเอกสาร")]
+        public Document Document { get; set; }
+
+        [Required, Comment("อ้างอิงคำสั่ง")]
+        public virtual Command Command { get; set; }
+    }
+}
diff --git a/BMA.EHR.Domain/Models/Commands/Core/CommandStatus.cs b/BMA.EHR.Domain/Models/Commands/Core/CommandStatus.cs
new file mode 100644
index 00000000..b5e8b16b
--- /dev/null
+++ b/BMA.EHR.Domain/Models/Commands/Core/CommandStatus.cs
@@ -0,0 +1,12 @@
+using BMA.EHR.Domain.Models.Base;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
+
+namespace BMA.EHR.Domain.Models.Commands.Core
+{
+    public class CommandStatus : EntityBase
+    {
+        [Required, MaxLength(100), Comment("สถานะของคำสั่ง")]
+        public string Name { get; set; } = string.Empty;
+    }
+}
diff --git a/BMA.EHR.Domain/Models/Commands/Core/CommandType.cs b/BMA.EHR.Domain/Models/Commands/Core/CommandType.cs
new file mode 100644
index 00000000..46232e3d
--- /dev/null
+++ b/BMA.EHR.Domain/Models/Commands/Core/CommandType.cs
@@ -0,0 +1,15 @@
+using BMA.EHR.Domain.Models.Base;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
+
+namespace BMA.EHR.Domain.Models.Commands.Core
+{
+    public class CommandType : EntityBase
+    {
+        [Required, MaxLength(200), Comment("ชื่อคำสั่ง")]
+        public string Name { get; set; } = string.Empty;
+
+        [Required, MaxLength(100), Comment("ประเภทคำสั่ง")]
+        public string Category { get; set; } = string.Empty;
+    }
+}
diff --git a/BMA.EHR.Domain/Models/Commands/DeploymentChannel.cs b/BMA.EHR.Domain/Models/Commands/Core/DeploymentChannel.cs
similarity index 87%
rename from BMA.EHR.Domain/Models/Commands/DeploymentChannel.cs
rename to BMA.EHR.Domain/Models/Commands/Core/DeploymentChannel.cs
index 5341e343..bfd5bca0 100644
--- a/BMA.EHR.Domain/Models/Commands/DeploymentChannel.cs
+++ b/BMA.EHR.Domain/Models/Commands/Core/DeploymentChannel.cs
@@ -5,7 +5,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace BMA.EHR.Domain.Models.Commands
+namespace BMA.EHR.Domain.Models.Commands.Core
 {
     public class DeploymentChannel : EntityBase
     {
diff --git a/BMA.EHR.Domain/Models/Commands/PlacementCommand.cs b/BMA.EHR.Domain/Models/Commands/PlacementCommand.cs
new file mode 100644
index 00000000..e60ade81
--- /dev/null
+++ b/BMA.EHR.Domain/Models/Commands/PlacementCommand.cs
@@ -0,0 +1,32 @@
+using BMA.EHR.Domain.Models.Commands.Core;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BMA.EHR.Domain.Models.Commands
+{
+    public class PlacementCommand : Command
+    {
+        [Required, Comment("อ้างอิงรอบการสอบ")]
+        public Guid ExamRoundId { get; set; }
+
+        [Required, Comment("ตำแหน่งที่บรรจุ")]
+        public string PositionName { get; set; } = string.Empty;
+
+        [Required, Comment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)")]
+        public string ConclusionRegisterNo { get; set; } = string.Empty;
+
+        [Required, Comment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)")]
+        public DateTime ConclusionRegisterDate { get; set; } = DateTime.Now;
+
+        [Required, Comment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)")]
+        public string ConclusionResultNo { get; set; } = string.Empty;
+
+        [Required, Comment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)")]
+        public DateTime ConclusionResultDate { get; set; } = DateTime.Now;
+    }
+}
diff --git a/BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.Designer.cs
new file mode 100644
index 00000000..24db09ab
--- /dev/null
+++ b/BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.Designer.cs	
@@ -0,0 +1,11258 @@
+// 
+using System;
+using BMA.EHR.Infrastructure.Persistence;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace BMA.EHR.Infrastructure.Migrations
+{
+    [DbContext(typeof(ApplicationDBContext))]
+    [Migration("20230713075242_Add Placement Command Table and Command Core Table")]
+    partial class AddPlacementCommandTableandCommandCoreTable
+    {
+        /// 
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "7.0.9")
+                .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.BaseCommand", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AuthorizedUserFullName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อผู้มีอำนาจลงนาม");
+
+                    b.Property("AuthorizedUserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
+
+                    b.Property("CommandNo")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("เลขที่คำสั่ง");
+
+                    b.Property("CommandStatusId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงสถานะคำสั่ง");
+
+                    b.Property("CommandTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงประเภทคำสั่ง");
+
+                    b.Property("CommandYear")
+                        .IsRequired()
+                        .HasMaxLength(4)
+                        .HasColumnType("varchar(4)")
+                        .HasComment("ปีที่ออกคำสั่ง");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Discriminator")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property("IssuerOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง");
+
+                    b.Property("IssuerOrganizationName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("หน่วยงานที่ออกคำสั่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CommandStatusId");
+
+                    b.HasIndex("CommandTypeId");
+
+                    b.ToTable("BaseCommand");
+
+                    b.HasDiscriminator("Discriminator").HasValue("BaseCommand");
+
+                    b.UseTphMappingStrategy();
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.BaseCommandDocument", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทเอกสาร");
+
+                    b.Property("CommandId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CommandId");
+
+                    b.HasIndex("DocumentId");
+
+                    b.ToTable("CommandDocuments");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะของคำสั่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CommandStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ประเภทคำสั่ง");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อคำสั่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CommandTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsSendEmail")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsSendInbox")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("DeploymentChannels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("Detail")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property("FileName")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("varchar(255)");
+
+                    b.Property("FileSize")
+                        .HasColumnType("int");
+
+                    b.Property("FileType")
+                        .IsRequired()
+                        .HasMaxLength(128)
+                        .HasColumnType("varchar(128)");
+
+                    b.Property("ObjectRefId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Documents");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ยังไม่ชัวใช้อะไรเป็นkey");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LimitLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("LimitLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("NumLeave")
+                        .HasColumnType("double")
+                        .HasComment("จำนวนที่ลาได้");
+
+                    b.Property("TypeLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("LimitLeaveId");
+
+                    b.HasIndex("TypeLeaveId");
+
+                    b.ToTable("LimitTypeLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)");
+
+                    b.Property("Ability")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("AvatarId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("AvatarRef")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("BirthDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเกิด");
+
+                    b.Property("BloodGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มเลือด");
+
+                    b.Property("CitizenId")
+                        .HasMaxLength(13)
+                        .HasColumnType("varchar(13)")
+                        .HasComment("รหัสบัตรประชาชน");
+
+                    b.Property("Couple")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("คู่สมรส");
+
+                    b.Property("CoupleCareer")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("อาชีพคู่สมรส");
+
+                    b.Property("CoupleFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อคู่สมรส");
+
+                    b.Property("CoupleLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลคู่สมรส");
+
+                    b.Property("CoupleLastNameOld")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลคู่สมรส(เดิม)");
+
+                    b.Property("CouplePrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าคู่สมรส");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUser")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("varchar(250)");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("CurrentAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ที่อยู่ปัจจุบัน");
+
+                    b.Property("CurrentDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตปัจจุบัน");
+
+                    b.Property("CurrentProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดปัจจุบัน");
+
+                    b.Property("CurrentSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id แขวงปัจจุบัน");
+
+                    b.Property("CurrentZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ปัจจุบัน");
+
+                    b.Property("DateAppoint")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DateRetire")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("EmployeeClass")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทลูกจ้าง");
+
+                    b.Property("EmployeeType")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทการจ้าง");
+
+                    b.Property("EntryStatus")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)");
+
+                    b.Property("FatherCareer")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("อาชีพบิดา");
+
+                    b.Property("FatherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อบิดา");
+
+                    b.Property("FatherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลบิดา");
+
+                    b.Property("FatherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบิดา");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("FirstNameOld")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ(เดิม)");
+
+                    b.Property("GenderId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เพศ");
+
+                    b.Property("GovAgeAbsent")
+                        .HasColumnType("int");
+
+                    b.Property("GovAgePlus")
+                        .HasColumnType("int");
+
+                    b.Property("GovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsLeave")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsProbation")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsTransfer")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsVerified")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("KeycloakId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastNameOld")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล(เดิม)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("LeaveDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("LeaveDateOrder")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("LeaveDetail")
+                        .HasColumnType("longtext");
+
+                    b.Property("LeaveNumberOrder")
+                        .HasColumnType("longtext");
+
+                    b.Property("LeaveReason")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)");
+
+                    b.Property("LimitLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ModifiedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("MotherCareer")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("อาชีพมารดา");
+
+                    b.Property("MotherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อมารดา");
+
+                    b.Property("MotherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลมารดา");
+
+                    b.Property("MotherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้ามารดา");
+
+                    b.Property("Nationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติ");
+
+                    b.Property("Oc")
+                        .HasColumnType("longtext")
+                        .HasComment("สังกัด");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("OrganizationOrganization")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Physical")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานภาพทางกาย");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่ง");
+
+                    b.Property("PosNoEmployee")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่งลูกจ้าง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มงาน");
+
+                    b.Property("PositionEmployeeGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านของตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางการบริหาร");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับ");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับ");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasComment("สายงาน");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สายงาน");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขา");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้าน/สาขา");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ประเภทตำแหน่ง");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("PrefixOldId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า(เดิม)");
+
+                    b.Property("ProfileType")
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("Race")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("เชื้อชาติ");
+
+                    b.Property("ReasonSameDate")
+                        .HasColumnType("longtext");
+
+                    b.Property("RegistrationAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("Id แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationSame")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่");
+
+                    b.Property("RegistrationSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน");
+
+                    b.Property("RelationshipId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สถานะภาพ");
+
+                    b.Property("ReligionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ศาสนา");
+
+                    b.Property("TelephoneNumber")
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasComment("เบอร์โทร");
+
+                    b.Property("TransferDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("VerifiedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("VerifiedUser")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AvatarId");
+
+                    b.HasIndex("LimitLeaveId");
+
+                    b.ToTable("Profiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("Field")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.Property("Remark")
+                        .HasColumnType("longtext")
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAbilitys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("Field")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileAbilityId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.Property("Remark")
+                        .HasColumnType("longtext")
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileAbilityId");
+
+                    b.ToTable("ProfileAbilityHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("CurrentAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ที่อยู่ปัจจุบัน");
+
+                    b.Property("CurrentDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("เขตปัจจุบัน");
+
+                    b.Property("CurrentDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตปัจจุบัน");
+
+                    b.Property("CurrentProvince")
+                        .HasColumnType("longtext")
+                        .HasComment("จังหวัดปัจจุบัน");
+
+                    b.Property("CurrentProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดปัจจุบัน");
+
+                    b.Property("CurrentSubDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("แขวงปัจจุบัน");
+
+                    b.Property("CurrentSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id แขวงปัจจุบัน");
+
+                    b.Property("CurrentZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ปัจจุบัน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistrationAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("เขตตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationProvince")
+                        .HasColumnType("longtext")
+                        .HasComment("จังหวัดตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationSame")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่");
+
+                    b.Property("RegistrationSubDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAddressHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อแบบประเมิน");
+
+                    b.Property("Point1")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่1 (คะแนน)");
+
+                    b.Property("Point1Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่1 (คะแนน)");
+
+                    b.Property("Point2")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่2 (คะแนน)");
+
+                    b.Property("Point2Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่2 (คะแนน)");
+
+                    b.Property("PointSum")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินรวม (คะแนน)");
+
+                    b.Property("PointSumTotal")
+                        .HasColumnType("double")
+                        .HasComment("ผลรวม (คะแนน)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAssessments");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อแบบประเมิน");
+
+                    b.Property("Point1")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่1 (คะแนน)");
+
+                    b.Property("Point1Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่1 (คะแนน)");
+
+                    b.Property("Point2")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่2 (คะแนน)");
+
+                    b.Property("Point2Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่2 (คะแนน)");
+
+                    b.Property("PointSum")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินรวม (คะแนน)");
+
+                    b.Property("PointSumTotal")
+                        .HasColumnType("double")
+                        .HasComment("ผลรวม (คะแนน)");
+
+                    b.Property("ProfileAssessmentId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileAssessmentId");
+
+                    b.ToTable("ProfileAssessmentHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AvatarFileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AvatarFileId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAvatarHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CertificateNo")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขที่ใบอนุญาต");
+
+                    b.Property("CertificateType")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อใบอนุญาต");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExpireDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่หมดอายุ");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกใบอนุญาต");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานผู้ออกใบอนุญาต");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileCertificates");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CertificateNo")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขที่ใบอนุญาต");
+
+                    b.Property("CertificateType")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อใบอนุญาต");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExpireDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่หมดอายุ");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกใบอนุญาต");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานผู้ออกใบอนุญาต");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileCertificateId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileCertificateId");
+
+                    b.ToTable("ProfileCertificateHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("FirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("LastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Prefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้า");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Status")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DocumentId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileChangeNames");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("FirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("LastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Prefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้า");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("ProfileChangeNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Status")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DocumentId");
+
+                    b.HasIndex("ProfileChangeNameId");
+
+                    b.ToTable("ProfileChangeNameHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("ChildrenCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพบุตร");
+
+                    b.Property("ChildrenFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อบุตร");
+
+                    b.Property("ChildrenLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลบุตร");
+
+                    b.Property("ChildrenPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าบุตร");
+
+                    b.Property("ChildrenPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบุตร");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileChildrens");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("ChildrenCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพบุตร");
+
+                    b.Property("ChildrenFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อบุตร");
+
+                    b.Property("ChildrenLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลบุตร");
+
+                    b.Property("ChildrenPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าบุตร");
+
+                    b.Property("ChildrenPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบุตร");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileChildrenId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileFamilyHistoryId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileChildrenId");
+
+                    b.HasIndex("ProfileFamilyHistoryId");
+
+                    b.ToTable("ProfileChildrenHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Career")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("Prefix")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileCoupleHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Address")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ZipCode")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileCurrentAddressHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("text")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับความผิด");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RefCommandDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เอกสารอ้างอิง (ลงวันที่)");
+
+                    b.Property("RefCommandNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileDisciplines");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("text")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับความผิด");
+
+                    b.Property("ProfileDisciplineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RefCommandDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เอกสารอ้างอิง (ลงวันที่)");
+
+                    b.Property("RefCommandNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileDisciplineId");
+
+                    b.ToTable("ProfileDisciplineHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileDutys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileDutyId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileDutyId");
+
+                    b.ToTable("ProfileDutyHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Country")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ประเทศ");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Degree")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("วุฒิการศึกษา");
+
+                    b.Property("Duration")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ระยะเวลา");
+
+                    b.Property("DurationYear")
+                        .HasColumnType("int")
+                        .HasComment("ระยะเวลาหลักสูตร");
+
+                    b.Property("EducationLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับศึกษา");
+
+                    b.Property("EducationLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ระดับศึกษา");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ถึง");
+
+                    b.Property("Field")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สาขาวิชา/ทาง");
+
+                    b.Property("FinishDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สำเร็จการศึกษา");
+
+                    b.Property("FundName")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ทุน");
+
+                    b.Property("Gpa")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เกรดเฉลี่ย");
+
+                    b.Property("Institute")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("สถานศึกษา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Other")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ข้อมูลการติดต่อ");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext")
+                        .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ตั้งแต่");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileEducations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Country")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ประเทศ");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Degree")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("วุฒิการศึกษา");
+
+                    b.Property("Duration")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ระยะเวลา");
+
+                    b.Property("DurationYear")
+                        .HasColumnType("int")
+                        .HasComment("ระยะเวลาหลักสูตร");
+
+                    b.Property("EducationLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับศึกษา");
+
+                    b.Property("EducationLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ระดับศึกษา");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ถึง");
+
+                    b.Property("Field")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สาขาวิชา/ทาง");
+
+                    b.Property("FinishDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สำเร็จการศึกษา");
+
+                    b.Property("FundName")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ทุน");
+
+                    b.Property("Gpa")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เกรดเฉลี่ย");
+
+                    b.Property("Institute")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("สถานศึกษา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Other")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ข้อมูลการติดต่อ");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext")
+                        .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("ProfileEducationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ตั้งแต่");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileEducationId");
+
+                    b.ToTable("ProfileEducationHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Couple")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("คู่สมรส");
+
+                    b.Property("CoupleCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพคู่สมรส");
+
+                    b.Property("CoupleFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อคู่สมรส");
+
+                    b.Property("CoupleLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลคู่สมรส");
+
+                    b.Property("CoupleLastNameOld")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลคู่สมรส(เดิม)");
+
+                    b.Property("CouplePrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าคู่สมรส");
+
+                    b.Property("CouplePrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าคู่สมรส");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("FatherCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพบิดา");
+
+                    b.Property("FatherFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อบิดา");
+
+                    b.Property("FatherLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลบิดา");
+
+                    b.Property("FatherPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าบิดา");
+
+                    b.Property("FatherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบิดา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MotherCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพมารดา");
+
+                    b.Property("MotherFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อมารดา");
+
+                    b.Property("MotherLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลมารดา");
+
+                    b.Property("MotherPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้ามารดา");
+
+                    b.Property("MotherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้ามารดา");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileFamilyHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Career")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("Prefix")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileFatherHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateAppoint")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สั่งบรรจุ");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เริ่มปฎิบัติราชการ");
+
+                    b.Property("GovAge")
+                        .HasColumnType("longtext")
+                        .HasComment("อายุราชการ");
+
+                    b.Property("GovAgeAbsent")
+                        .HasColumnType("int")
+                        .HasComment("ขาดราชการ");
+
+                    b.Property("GovAgePlus")
+                        .HasColumnType("int")
+                        .HasComment("อายุราชการเกื้อกูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Oc")
+                        .HasColumnType("longtext")
+                        .HasComment("สังกัด");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่ง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับตำแหน่ง");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasComment("สายงาน");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReasonSameDate")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผลกรณีไม่ตรงวัน");
+
+                    b.Property("RetireDate")
+                        .HasColumnType("longtext")
+                        .HasComment("วันเกษียณอายุ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileGovernmentHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("BirthDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเกิด");
+
+                    b.Property("BloodGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มเลือด");
+
+                    b.Property("BloodGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มเลือด");
+
+                    b.Property("CitizenId")
+                        .HasMaxLength(13)
+                        .HasColumnType("varchar(13)")
+                        .HasComment("รหัสบัตรประชาชน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("EmployeeClass")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทลูกจ้าง");
+
+                    b.Property("EmployeeType")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทการจ้าง");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("Gender")
+                        .HasColumnType("longtext")
+                        .HasComment("เพศ");
+
+                    b.Property("GenderId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เพศ");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Nationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติ");
+
+                    b.Property("Prefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้า");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Race")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("เชื้อชาติ");
+
+                    b.Property("Relationship")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะภาพ");
+
+                    b.Property("RelationshipId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สถานะภาพ");
+
+                    b.Property("Religion")
+                        .HasColumnType("longtext")
+                        .HasComment("ศาสนา");
+
+                    b.Property("ReligionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ศาสนา");
+
+                    b.Property("TelephoneNumber")
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasComment("เบอร์โทร");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .HasMaxLength(2000)
+                        .HasColumnType("varchar(2000)")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่ออก");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileHonors");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .HasMaxLength(2000)
+                        .HasColumnType("varchar(2000)")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่ออก");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileHonorId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileHonorId");
+
+                    b.ToTable("ProfileHonorHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateAnnounce")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ประกาศในราชกิจจาฯ");
+
+                    b.Property("Insignia")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อเครื่องราชฯ");
+
+                    b.Property("InsigniaId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("InsigniaType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภท");
+
+                    b.Property("Issue")
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasComment("ราชกิจจาฯ ฉบับที่");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("No")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ลำดับที่");
+
+                    b.Property("Page")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("หน้า");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReceiveDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่");
+
+                    b.Property("Section")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("ตอน");
+
+                    b.Property("Volume")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่ม");
+
+                    b.Property("VolumeNo")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่มที่");
+
+                    b.Property("Year")
+                        .HasColumnType("int")
+                        .HasComment("ปีที่ยื่นขอ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileInsignias");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateAnnounce")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ประกาศในราชกิจจาฯ");
+
+                    b.Property("Insignia")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อเครื่องราชฯ");
+
+                    b.Property("InsigniaId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("InsigniaType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภท");
+
+                    b.Property("Issue")
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasComment("ราชกิจจาฯ ฉบับที่");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("No")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ลำดับที่");
+
+                    b.Property("Page")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("หน้า");
+
+                    b.Property("ProfileInsigniaId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReceiveDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่");
+
+                    b.Property("Section")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("ตอน");
+
+                    b.Property("Volume")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่ม");
+
+                    b.Property("VolumeNo")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่มที่");
+
+                    b.Property("Year")
+                        .HasColumnType("int")
+                        .HasComment("ปีที่ยื่นขอ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileInsigniaId");
+
+                    b.ToTable("ProfileInsigniaHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEndLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่สิ้นสุดลา");
+
+                    b.Property("DateStartLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่เริ่มลา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("NumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลาครั้งที่");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผล");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะ");
+
+                    b.Property("SumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลามาแล้ว");
+
+                    b.Property("TotalLeave")
+                        .HasColumnType("double")
+                        .HasComment("รวมเป็น");
+
+                    b.Property("TypeLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.HasIndex("TypeLeaveId");
+
+                    b.ToTable("ProfileLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEndLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่สิ้นสุดลา");
+
+                    b.Property("DateStartLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่เริ่มลา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("NumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลาครั้งที่");
+
+                    b.Property("ProfileLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผล");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะ");
+
+                    b.Property("SumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลามาแล้ว");
+
+                    b.Property("TotalLeave")
+                        .HasColumnType("double")
+                        .HasComment("รวมเป็น");
+
+                    b.Property("TypeLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileLeaveId");
+
+                    b.HasIndex("TypeLeaveId");
+
+                    b.ToTable("ProfileLeaveHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Career")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("Prefix")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileMotherHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileNopaids");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileNopaidId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileNopaidId");
+
+                    b.ToTable("ProfileNopaidHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOrganization", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id หน่วยงานที่สังกัด");
+
+                    b.Property("UserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("User Id KeyCloak");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileOrganizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileOthers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileOtherId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileOtherId");
+
+                    b.ToTable("ProfileOtherHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CategoryName")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("varchar(255)")
+                        .HasComment("ประเภทไฟล์-ไม่ใช้");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("varchar(255)")
+                        .HasComment("ชื่อไฟล์");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DocumentId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfilePapers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Address")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ZipCode")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileRegistrationAddressHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Amount")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี รับตำแหน่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MouthSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินค่าตอบแทนรายเดือน");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ชื่อย่อหน่วยงาน");
+
+                    b.Property("PosNoEmployee")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่งลูกจ้าง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ระดับ");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สายงาน");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้าน/สาขา");
+
+                    b.Property("PositionSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ประเภทตำแหน่ง");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SalaryClass")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง (รายละเอียด)");
+
+                    b.Property("SalaryRef")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileSalaries");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Amount")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี รับตำแหน่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MouthSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินค่าตอบแทนรายเดือน");
+
+                    b.Property("Oc")
+                        .HasColumnType("longtext")
+                        .HasComment("สังกัด");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("OrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่ง");
+
+                    b.Property("PosNoEmployee")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่งลูกจ้าง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มงาน");
+
+                    b.Property("PositionEmployeeGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านของตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางการบริหาร");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับ");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับ");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasComment("สายงาน");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สายงาน");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขา");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้าน/สาขา");
+
+                    b.Property("PositionSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ประเภทตำแหน่ง");
+
+                    b.Property("ProfileSalaryId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SalaryClass")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง (รายละเอียด)");
+
+                    b.Property("SalaryRef")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileSalaryId");
+
+                    b.ToTable("ProfileSalaryHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryOrganization", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryOrganizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionId");
+
+                    b.ToTable("ProfileSalaryPositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryPositionLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionNumber", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryPositionsNumbers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryPositionTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateOrder")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่");
+
+                    b.Property("Department")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน");
+
+                    b.Property("Duration")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม");
+
+                    b.Property("NumberOrder")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ");
+
+                    b.Property("Place")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สถานที่ฝึกอบรม/ดูงาน");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน");
+
+                    b.Property("Topic")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวข้อการฝึกอบรม/ดูงาน");
+
+                    b.Property("Yearly")
+                        .HasMaxLength(200)
+                        .HasColumnType("int")
+                        .HasComment("ปีที่อบรม (พ.ศ.)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileTrainings");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateOrder")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่");
+
+                    b.Property("Department")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน");
+
+                    b.Property("Duration")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม");
+
+                    b.Property("NumberOrder")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ");
+
+                    b.Property("Place")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สถานที่ฝึกอบรม/ดูงาน");
+
+                    b.Property("ProfileTrainingId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน");
+
+                    b.Property("Topic")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวข้อการฝึกอบรม/ดูงาน");
+
+                    b.Property("Yearly")
+                        .HasMaxLength(200)
+                        .HasColumnType("int")
+                        .HasComment("ปีที่อบรม (พ.ศ.)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileTrainingId");
+
+                    b.ToTable("ProfileTrainingHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทการลา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("TypeLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.BloodGroup", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(2)
+                        .HasColumnType("varchar(2)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อหมู่โลหิต");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("BloodGroups");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("varchar(150)")
+                        .HasColumnOrder(1)
+                        .HasComment("เขต/อำเภอ");
+
+                    b.Property("ProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProvinceId");
+
+                    b.ToTable("Districts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.EducationLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ระดับการศึกษา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("EducationLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Gender", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasColumnOrder(1)
+                        .HasComment("เพศ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Genders");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Holiday", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(6)
+                        .HasComment("ประเภทของวันหยุดสำหรับ ทำงาน 5 วัน=`NORMAL`,ทำงาน 6 วัน=`6DAYS`");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("HolidayDate")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(2)
+                        .HasComment("วันหยุด");
+
+                    b.Property("IsSpecial")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(5)
+                        .HasComment("เป็นวันหยุดพิเศษหรือไม่");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("varchar(250)")
+                        .HasColumnOrder(4)
+                        .HasComment("ชื่อวันหยุด");
+
+                    b.Property("OriginalDate")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(3)
+                        .HasComment("วันหยุด(Original)");
+
+                    b.Property("Year")
+                        .HasColumnType("int")
+                        .HasColumnOrder(1)
+                        .HasComment("ประจำปี");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Holidays");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("InsigniaTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("int")
+                        .HasColumnOrder(4)
+                        .HasComment("ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อเครื่องราชย์");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(5)
+                        .HasComment("หมายเหตุ");
+
+                    b.Property("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อย่อเครื่องราชย์");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("InsigniaTypeId");
+
+                    b.ToTable("Insignias");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.InsigniaType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทเครื่องราชย์");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("InsigniaTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationAgency", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงานต้นสังกัด");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationAgencys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationFax", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์โทรสาร");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationFaxs");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationGovernmentAgency", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ส่วนราชการต้นสังกัด");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationGovernmentAgencys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ระดับ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationOrganizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AgencyCode")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("GovernmentCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(2)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(4)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(3)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(5)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationShortNames");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ สถานะ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายนอก");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationTelExternals");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายใน");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationTelInternals");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ประเภท");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PhysicalStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("สถานภาพทางกาย");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PhysicalStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExecutiveName")
+                        .IsRequired()
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasColumnOrder(3)
+                        .HasComment("ชื่อตำแหน่งทางการบริหาร");
+
+                    b.Property("ExecutiveSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(9)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อตำแหน่ง");
+
+                    b.Property("PathSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionCategory")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(8)
+                        .HasComment("ตำแหน่งสำหรับข้าราชการหรือลูกจ้าง officer/employee");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ExecutiveSideId");
+
+                    b.HasIndex("PathSideId");
+
+                    b.HasIndex("PositionLevelId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.HasIndex("PositionTypeId");
+
+                    b.ToTable("Positions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeGroup", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อกลุ่มงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeGroups");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสายงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeLines");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeePositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อด้านของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeePositionSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสถานะของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutive", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อตำแหน่งทางการบริหารของข้อมูลตำแหน่งของข้าราชการ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionExecutives");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อด้านทางการบริหาร");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionExecutiveSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(4)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("int")
+                        .HasColumnOrder(3)
+                        .HasComment("ลำดับชั้นของระดับตำแหน่ง");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อระดับตำแหน่ง");
+
+                    b.Property("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อย่อระดับตำแหน่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLine", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสายงานของข้อมูลตำแหน่งของข้าราชการ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionLines");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPath", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสายงาน");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionPaths");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPathSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อด้าน/สาขา");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionPathSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสถานะของตำแหน่งของข้อมูลตำแหน่งของข้าราชการ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionStatuss");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทตำแหน่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Prefix", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasColumnOrder(2)
+                        .HasComment("รายละเอียดคำนำหน้า");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Prefixes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("varchar(150)")
+                        .HasColumnOrder(1)
+                        .HasComment("จังหวัด");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Provinces");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Relationship", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อความสัมพันธ์");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Relationships");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Religion", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ศาสนา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Religions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Royal", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทข้อมูลเหรียญตรา");
+
+                    b.Property("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อย่อเหรียญตรา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Royals");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalHierarchy", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อลำดับชั้นข้อมูลเครื่องราชฯ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("RoyalHierarchys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทข้อมูลเครื่องราชฯ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("RoyalTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("varchar(150)")
+                        .HasColumnOrder(1)
+                        .HasComment("เขต/อำเภอ");
+
+                    b.Property("ZipCode")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasColumnOrder(2)
+                        .HasComment("รหัสไปรษณีย์");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DistrictId");
+
+                    b.ToTable("SubDistricts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsSend")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ทำการส่งข้อความแล้วหรือยัง?");
+
+                    b.Property("IsSendEmail")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งอีเมลล์หรือไม่?");
+
+                    b.Property("IsSendInbox")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งไปที่กล่องข้อความหรือไม่?");
+
+                    b.Property("IsSendNotification")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งการแจ้งเตือนหรือไม่?");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MessageContent")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียดข้อความ");
+
+                    b.Property("MessagePayLoad")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("สิ่งที่แนบมาด้วย");
+
+                    b.Property("ReceiverEmailAddress")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("varchar(500)")
+                        .HasComment("อีเมล์ของผู้รับ");
+
+                    b.Property("ReceiverUserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสของผู้รับข้อความ");
+
+                    b.Property("SenderSystem")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ส่งจากระบบงาน");
+
+                    b.Property("Subject")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวเรื่อง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("MessageQueues");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Agency")
+                        .HasColumnType("longtext");
+
+                    b.Property("ConditionNote")
+                        .HasColumnType("longtext");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Department")
+                        .HasColumnType("longtext");
+
+                    b.Property("Government")
+                        .HasColumnType("longtext");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsCondition")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationAgencyId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationFaxId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationGovernmentAgencyId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationOrder")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelExternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelInternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationUserNote")
+                        .HasColumnType("longtext");
+
+                    b.Property("Pile")
+                        .HasColumnType("longtext");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionCondition")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionEmployeeLineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeeStatusId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterUserNote")
+                        .HasColumnType("longtext");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Qualification")
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationAgencyId");
+
+                    b.HasIndex("OrganizationFaxId");
+
+                    b.HasIndex("OrganizationGovernmentAgencyId");
+
+                    b.HasIndex("OrganizationLevelId");
+
+                    b.HasIndex("OrganizationOrganizationId");
+
+                    b.HasIndex("OrganizationShortNameId");
+
+                    b.HasIndex("OrganizationTelExternalId");
+
+                    b.HasIndex("OrganizationTelInternalId");
+
+                    b.HasIndex("OrganizationTypeId");
+
+                    b.HasIndex("PositionEmployeeLineId");
+
+                    b.HasIndex("PositionEmployeePositionId");
+
+                    b.HasIndex("PositionEmployeeStatusId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("OrganizationEmployees");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationEmployeeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationEmployeeId");
+
+                    b.HasIndex("PositionEmployeeLevelId");
+
+                    b.ToTable("OrganizationPositionEmployeeLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationEmployeeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationEmployeeId");
+
+                    b.HasIndex("PositionEmployeePositionSideId");
+
+                    b.ToTable("OrganizationPositionEmployeePositionSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionLevelId");
+
+                    b.HasIndex("PositionMasterId");
+
+                    b.ToTable("AvailablePositionLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Agency")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(14)
+                        .HasComment("หน่วยงาน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Department")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(16)
+                        .HasComment("ฝ่าย/ส่วน");
+
+                    b.Property("Government")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(15)
+                        .HasComment("ส่วนราชการ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationFaxId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationOrder")
+                        .HasColumnType("int")
+                        .HasColumnOrder(12)
+                        .HasComment("OrganizationOrder");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationStatusId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelExternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelInternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(13)
+                        .HasComment("OrganizationUserNote");
+
+                    b.Property("ParentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Pile")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(17)
+                        .HasComment("กอง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationFaxId");
+
+                    b.HasIndex("OrganizationLevelId");
+
+                    b.HasIndex("OrganizationOrganizationId");
+
+                    b.HasIndex("OrganizationShortNameId");
+
+                    b.HasIndex("OrganizationStatusId");
+
+                    b.HasIndex("OrganizationTelExternalId");
+
+                    b.HasIndex("OrganizationTelInternalId");
+
+                    b.HasIndex("OrganizationTypeId");
+
+                    b.HasIndex("ParentId");
+
+                    b.ToTable("Organizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("Is Director");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionNumberId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(4)
+                        .HasComment("positionUserNote");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationId");
+
+                    b.HasIndex("PositionMasterId");
+
+                    b.HasIndex("PositionNumberId");
+
+                    b.ToTable("OrganizationPositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPublishHistoryEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(1)
+                        .HasComment("รายละเอียดการแก้ไข");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ObjectValue")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(2)
+                        .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationPublishHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(14)
+                        .HasComment("IsDirector");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("PositionCondition")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(11)
+                        .HasComment("PositionCondition");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionExecutiveSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(2)
+                        .HasComment("PositionId");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(13)
+                        .HasComment("PositionMasterUserNote");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionStatusId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Qualification")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(15)
+                        .HasComment("คุณวุฒิ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionExecutiveId");
+
+                    b.HasIndex("PositionExecutiveSideId");
+
+                    b.HasIndex("PositionLineId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.HasIndex("PositionPathSideId");
+
+                    b.HasIndex("PositionStatusId");
+
+                    b.HasIndex("PositionTypeId");
+
+                    b.ToTable("PositionMasters");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(14)
+                        .HasComment("IsDirector");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(2)
+                        .HasComment("Position");
+
+                    b.Property("PositionCondition")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(11)
+                        .HasComment("PositionCondition");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(5)
+                        .HasComment("PositionExecutive");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(6)
+                        .HasComment("PositionExecutiveSide");
+
+                    b.Property("PositionExecutiveSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(12)
+                        .HasComment("PositionLevel");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(8)
+                        .HasComment("PositionLine");
+
+                    b.Property("PositionMasterEntityId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(13)
+                        .HasComment("PositionMasterUserNote");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("PositionPath");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(7)
+                        .HasComment("PositionPathSide");
+
+                    b.Property("PositionPathSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionStatus")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(10)
+                        .HasComment("PositionStatus");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(4)
+                        .HasComment("PositionType");
+
+                    b.Property("Qualification")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(15)
+                        .HasComment("คุณวุฒิ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionMasterEntityId");
+
+                    b.ToTable("PositionMasterHistoryEntity");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อ");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationShortNameId");
+
+                    b.ToTable("PositionNumbers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationPositionId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfilePositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("GovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("GovernmentCodeOld")
+                        .HasColumnType("longtext");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationOrganization")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ชื่อหน่วยงาน");
+
+                    b.Property("OrganizationOrganizationOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อหน่วยงานเดิม");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสส่วนราชการ");
+
+                    b.Property("OrganizationShortNameOld")
+                        .HasColumnType("longtext")
+                        .HasComment("รหัสส่วนราชการเดิม");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหารเดิม");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้านทางบริหาร");
+
+                    b.Property("PositionExecutiveSideOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางบริหารเดิม");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ระดับตำแหน่ง");
+
+                    b.Property("PositionLevelOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับตำแหน่งเดิม");
+
+                    b.Property("PositionNum")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionNumId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งเลขที่");
+
+                    b.Property("PositionNumOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งเลขที่เดิม");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งในสายงาน");
+
+                    b.Property("PositionPathOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งในสายงานเดิม");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้าน/สาขา");
+
+                    b.Property("PositionPathSideOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขาเดิม");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("PositionTypeOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่งเดิม");
+
+                    b.Property("ProfilePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("สังกัดที่ถือครอง");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะการเปลี่ยนแปลง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Report2s");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Report2DetailHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Education")
+                        .HasColumnType("longtext")
+                        .HasComment("คุณวุฒิ");
+
+                    b.Property("FullName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อ-สกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("NewGovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewOrganizationOrganization")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewOrganizationOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ชื่อหน่วยงาน กำหนดใหม่");
+
+                    b.Property("NewOrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewOrganizationShortNameId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสส่วนราชการ กำหนดใหม่");
+
+                    b.Property("NewPositionExecutive")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งทางการบริหาร กำหนดใหม่");
+
+                    b.Property("NewPositionExecutiveSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้านทางบริหาร กำหนดใหม่");
+
+                    b.Property("NewPositionLevel")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ระดับตำแหน่ง กำหนดใหม่");
+
+                    b.Property("NewPositionNum")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionNumId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งเลขที่ กำหนดใหม่");
+
+                    b.Property("NewPositionPath")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งในสายงาน กำหนดใหม่");
+
+                    b.Property("NewPositionPathSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้าน/สาขา กำหนดใหม่");
+
+                    b.Property("NewPositionType")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ประเภทตำแหน่ง กำหนดใหม่");
+
+                    b.Property("OldGovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("OldOrganizationOrganization")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อหน่วยงาน กำหนดเดิม");
+
+                    b.Property("OldOrganizationShortName")
+                        .HasColumnType("longtext")
+                        .HasComment("รหัสส่วนราชการ กำหนดเดิม");
+
+                    b.Property("OldPositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร กำหนดเดิม");
+
+                    b.Property("OldPositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางบริหาร กำหนดเดิม");
+
+                    b.Property("OldPositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับตำแหน่ง กำหนดเดิม");
+
+                    b.Property("OldPositionNum")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งเลขที่ กำหนดเดิม");
+
+                    b.Property("OldPositionPath")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งในสายงาน กำหนดเดิม");
+
+                    b.Property("OldPositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขา กำหนดเดิม");
+
+                    b.Property("OldPositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง กำหนดเดิม");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfilePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("สังกัดที่ถือครอง");
+
+                    b.Property("Report2DetailHistoryId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Salary")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("SalaryMonth")
+                        .HasColumnType("double")
+                        .HasComment("เงินตอบแทนรายเดือน");
+
+                    b.Property("SalaryPosition")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะการเปลี่ยนแปลง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("Report2DetailHistoryId");
+
+                    b.ToTable("Report2Histories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สิ้นสุดบัญชี");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("รอบการสอบ");
+
+                    b.Property("Number")
+                        .HasMaxLength(10)
+                        .HasColumnType("int")
+                        .HasComment("จำนวนผู้สอบได้");
+
+                    b.Property("PlacementTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Round")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ครั้งที่");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่เริ่มบัญชีบัญชี");
+
+                    b.Property("Year")
+                        .HasMaxLength(5)
+                        .HasColumnType("int")
+                        .HasComment("ปีงบประมาณ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PlacementTypeId");
+
+                    b.ToTable("Placements");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CertificateNo")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขที่ใบอนุญาต");
+
+                    b.Property("CertificateType")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อใบอนุญาต");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExpireDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่หมดอายุ");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกใบอนุญาต");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานผู้ออกใบอนุญาต");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("PlacementProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PlacementProfileId");
+
+                    b.ToTable("PlacementCertificates");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Country")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ประเทศ");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Degree")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("วุฒิการศึกษา");
+
+                    b.Property("Duration")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ระยะเวลา");
+
+                    b.Property("DurationYear")
+                        .HasColumnType("int")
+                        .HasComment("ระยะเวลาหลักสูตร");
+
+                    b.Property("EducationLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ถึง");
+
+                    b.Property("Field")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สาขาวิชา/ทาง");
+
+                    b.Property("FinishDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สำเร็จการศึกษา");
+
+                    b.Property("FundName")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ทุน");
+
+                    b.Property("Gpa")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เกรดเฉลี่ย");
+
+                    b.Property("Institute")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("สถานศึกษา");
+
+                    b.Property("IsDate")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ประเภทช่วงเวลาการศึกษา");
+
+                    b.Property("IsEducation")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("เป็นวุฒิศึกษาในตำแหน่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Other")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ข้อมูลการติดต่อ");
+
+                    b.Property("PlacementProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ตั้งแต่");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("EducationLevelId");
+
+                    b.HasIndex("PlacementProfileId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.ToTable("PlacementEducations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementIsProperty", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อคุณสมบัติ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PlacementIsProperties");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Amount")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("BloodGroupId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CitizenDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกบัตร");
+
+                    b.Property("CitizenDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CitizenId")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขประจำตัวประชาชน");
+
+                    b.Property("CitizenProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("CurrentAddress")
+                        .HasColumnType("longtext")
+                        .HasComment("ที่อยู่ปัจจุบัน");
+
+                    b.Property("CurrentDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CurrentProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CurrentSubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CurrentZipCode")
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน");
+
+                    b.Property("DateOfBirth")
+                        .HasMaxLength(40)
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเกิด");
+
+                    b.Property("Email")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อีเมล");
+
+                    b.Property("ExamNumber")
+                        .HasColumnType("int")
+                        .HasComment("ลำดับที่สอบได้");
+
+                    b.Property("ExamRound")
+                        .HasColumnType("int")
+                        .HasComment("จำนวนครั้งที่สมัครสอบ");
+
+                    b.Property("FatherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อจริงบิดา");
+
+                    b.Property("FatherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลบิดา");
+
+                    b.Property("FatherNationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติบิดา");
+
+                    b.Property("FatherOccupation")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อาชีพบิดา");
+
+                    b.Property("FatherPrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Firstname")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อ");
+
+                    b.Property("GenderId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsOfficer")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ข้าราชการฯ กทม.");
+
+                    b.Property("IsProperty")
+                        .HasColumnType("longtext")
+                        .HasComment("การคัดกรองคุณสมบัติ");
+
+                    b.Property("IsRelief")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ผ่อนผัน");
+
+                    b.Property("Knowledge")
+                        .HasColumnType("longtext")
+                        .HasComment("ความสามารถพิเศษ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Lastname")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุล");
+
+                    b.Property("Marry")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("คู่สมรส");
+
+                    b.Property("MarryFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อจริงคู่สมรส");
+
+                    b.Property("MarryLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลคู่สมรส");
+
+                    b.Property("MarryNationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติคู่สมรส");
+
+                    b.Property("MarryOccupation")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อาชีพคู่สมรส");
+
+                    b.Property("MarryPrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("MobilePhone")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("โทรศัพท์มือถือ");
+
+                    b.Property("MotherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อจริงมารดา");
+
+                    b.Property("MotherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลมารดา");
+
+                    b.Property("MotherNationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติมารดา");
+
+                    b.Property("MotherOccupation")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อาชีพมารดา");
+
+                    b.Property("MotherPrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("MouthSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินค่าตอบแทนรายเดือน");
+
+                    b.Property("Nationality")
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasComment("สัญชาติ");
+
+                    b.Property("Number")
+                        .HasColumnType("int")
+                        .HasComment("ลำดับที่สอบได้");
+
+                    b.Property("OccupationCompany")
+                        .HasColumnType("longtext")
+                        .HasComment("สำนัก/บริษัท บริษัท");
+
+                    b.Property("OccupationDepartment")
+                        .HasColumnType("longtext")
+                        .HasComment("กอง/ฝ่าย บริษัท");
+
+                    b.Property("OccupationEmail")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อีเมล บริษัท");
+
+                    b.Property("OccupationPosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งอาชีพ");
+
+                    b.Property("OccupationTelephone")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("โทรศัพท์ บริษัท");
+
+                    b.Property("OccupationType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทอาชีพที่ทำงานมาก่อน");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Pass")
+                        .HasColumnType("longtext")
+                        .HasComment("ผลสมัครสอบ");
+
+                    b.Property("PlacementId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PlacementStatus")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะการบรรจุ");
+
+                    b.Property("PointA")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนภาค ก");
+
+                    b.Property("PointB")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนภาค ข");
+
+                    b.Property("PointC")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนภาค ค");
+
+                    b.Property("PointTotalA")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนเต็มภาค ก");
+
+                    b.Property("PointTotalB")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนเต็มภาค ข");
+
+                    b.Property("PointTotalC")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนเต็มภาค ค");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionNumberId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Race")
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasComment("เชื้อชาติ");
+
+                    b.Property("RecruitDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่บรรจุ");
+
+                    b.Property("RegistAddress")
+                        .HasColumnType("longtext")
+                        .HasComment("ที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RegistDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistSame")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RegistSubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistZipCode")
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RejectReason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผลสละสิทธิ์");
+
+                    b.Property("RelationshipId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReliefDocId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReliefReason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผลผ่อนผัน");
+
+                    b.Property("ReligionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReportingDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่รายงานตัว");
+
+                    b.Property("SalaryClass")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง (รายละเอียด)");
+
+                    b.Property("SalaryRef")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.Property("Telephone")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("โทรศัพท์");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("BloodGroupId");
+
+                    b.HasIndex("CitizenDistrictId");
+
+                    b.HasIndex("CitizenProvinceId");
+
+                    b.HasIndex("CurrentDistrictId");
+
+                    b.HasIndex("CurrentProvinceId");
+
+                    b.HasIndex("CurrentSubDistrictId");
+
+                    b.HasIndex("FatherPrefixId");
+
+                    b.HasIndex("GenderId");
+
+                    b.HasIndex("MarryPrefixId");
+
+                    b.HasIndex("MotherPrefixId");
+
+                    b.HasIndex("OrganizationPositionId");
+
+                    b.HasIndex("PlacementId");
+
+                    b.HasIndex("PositionLevelId");
+
+                    b.HasIndex("PositionLineId");
+
+                    b.HasIndex("PositionNumberId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.HasIndex("PositionPathSideId");
+
+                    b.HasIndex("PositionTypeId");
+
+                    b.HasIndex("PrefixId");
+
+                    b.HasIndex("RegistDistrictId");
+
+                    b.HasIndex("RegistProvinceId");
+
+                    b.HasIndex("RegistSubDistrictId");
+
+                    b.HasIndex("RelationshipId");
+
+                    b.HasIndex("ReliefDocId");
+
+                    b.HasIndex("ReligionId");
+
+                    b.ToTable("PlacementProfiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อประเภทบรรจุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PlacementTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b =>
+                {
+                    b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.BaseCommand");
+
+                    b.Property("ConclusionRegisterDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
+
+                    b.Property("ConclusionRegisterNo")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
+
+                    b.Property("ConclusionResultDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+                    b.Property("ConclusionResultNo")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+                    b.Property("ExamRoundId")
+                        .HasColumnType("char(36)")
+                        .HasComment("อ้างอิงรอบการสอบ");
+
+                    b.Property("PositionName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งที่บรรจุ");
+
+                    b.HasDiscriminator().HasValue("PlacementCommand");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.BaseCommand", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus")
+                        .WithMany()
+                        .HasForeignKey("CommandStatusId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandType", "CommandType")
+                        .WithMany()
+                        .HasForeignKey("CommandTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("CommandStatus");
+
+                    b.Navigation("CommandType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.BaseCommandDocument", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.BaseCommand", "Command")
+                        .WithMany("Documents")
+                        .HasForeignKey("CommandId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Command");
+
+                    b.Navigation("Document");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
+                        .WithMany("LimitTypeLeaves")
+                        .HasForeignKey("LimitLeaveId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
+                        .WithMany("LimitTypeLeaves")
+                        .HasForeignKey("TypeLeaveId");
+
+                    b.Navigation("LimitLeave");
+
+                    b.Navigation("TypeLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Avatar")
+                        .WithMany()
+                        .HasForeignKey("AvatarId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
+                        .WithMany("Profiles")
+                        .HasForeignKey("LimitLeaveId");
+
+                    b.Navigation("Avatar");
+
+                    b.Navigation("LimitLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Abilitys")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAbility", "ProfileAbility")
+                        .WithMany("ProfileAbilityHistorys")
+                        .HasForeignKey("ProfileAbilityId");
+
+                    b.Navigation("ProfileAbility");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("AddressHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Assessments")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAssessment", "ProfileAssessment")
+                        .WithMany("ProfileAssessmentHistorys")
+                        .HasForeignKey("ProfileAssessmentId");
+
+                    b.Navigation("ProfileAssessment");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "AvatarFile")
+                        .WithMany()
+                        .HasForeignKey("AvatarFileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("AvatarHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AvatarFile");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Certificates")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileCertificate", "ProfileCertificate")
+                        .WithMany("ProfileCertificateHistorys")
+                        .HasForeignKey("ProfileCertificateId");
+
+                    b.Navigation("ProfileCertificate");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("ChangeNames")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Document");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChangeName", "ProfileChangeName")
+                        .WithMany("ProfileChangeNameHistorys")
+                        .HasForeignKey("ProfileChangeNameId");
+
+                    b.Navigation("Document");
+
+                    b.Navigation("ProfileChangeName");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Childrens")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChildren", null)
+                        .WithMany("ProfileChildrenHistorys")
+                        .HasForeignKey("ProfileChildrenId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", null)
+                        .WithMany("Childrens")
+                        .HasForeignKey("ProfileFamilyHistoryId");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("CoupleHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("CurrentAddressHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Disciplines")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDiscipline", "ProfileDiscipline")
+                        .WithMany("ProfileDisciplineHistorys")
+                        .HasForeignKey("ProfileDisciplineId");
+
+                    b.Navigation("ProfileDiscipline");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Dutys")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDuty", "ProfileDuty")
+                        .WithMany("ProfileDutyHistorys")
+                        .HasForeignKey("ProfileDutyId");
+
+                    b.Navigation("ProfileDuty");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Educations")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileEducation", "ProfileEducation")
+                        .WithMany("ProfileEducationHistorys")
+                        .HasForeignKey("ProfileEducationId");
+
+                    b.Navigation("ProfileEducation");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("FamilyHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("FatherHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("GovernmentHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("ProfileHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Honors")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileHonor", "ProfileHonor")
+                        .WithMany("ProfileHonorHistorys")
+                        .HasForeignKey("ProfileHonorId");
+
+                    b.Navigation("ProfileHonor");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Insignias")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileInsignia", "ProfileInsignia")
+                        .WithMany("ProfileInsigniaHistorys")
+                        .HasForeignKey("ProfileInsigniaId");
+
+                    b.Navigation("ProfileInsignia");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Leaves")
+                        .HasForeignKey("ProfileId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
+                        .WithMany()
+                        .HasForeignKey("TypeLeaveId");
+
+                    b.Navigation("Profile");
+
+                    b.Navigation("TypeLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileLeave", "ProfileLeave")
+                        .WithMany("ProfileLeaveHistorys")
+                        .HasForeignKey("ProfileLeaveId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
+                        .WithMany()
+                        .HasForeignKey("TypeLeaveId");
+
+                    b.Navigation("ProfileLeave");
+
+                    b.Navigation("TypeLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("MotherHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Nopaids")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileNopaid", "ProfileNopaid")
+                        .WithMany("ProfileNopaidHistorys")
+                        .HasForeignKey("ProfileNopaidId");
+
+                    b.Navigation("ProfileNopaid");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Others")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileOther", "ProfileOther")
+                        .WithMany("ProfileOtherHistorys")
+                        .HasForeignKey("ProfileOtherId");
+
+                    b.Navigation("ProfileOther");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Papers")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Document");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("RegistrationAddressHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Salaries")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileSalary", "ProfileSalary")
+                        .WithMany("ProfileSalaryHistorys")
+                        .HasForeignKey("ProfileSalaryId");
+
+                    b.Navigation("ProfileSalary");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Position", "Position")
+                        .WithMany()
+                        .HasForeignKey("PositionId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Position");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Trainings")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileTraining", "ProfileTraining")
+                        .WithMany("ProfileTrainingHistorys")
+                        .HasForeignKey("ProfileTrainingId");
+
+                    b.Navigation("ProfileTraining");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "Province")
+                        .WithMany("Districts")
+                        .HasForeignKey("ProvinceId");
+
+                    b.Navigation("Province");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.InsigniaType", "InsigniaType")
+                        .WithMany()
+                        .HasForeignKey("InsigniaTypeId");
+
+                    b.Navigation("InsigniaType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "ExecutiveSide")
+                        .WithMany()
+                        .HasForeignKey("ExecutiveSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PathSide")
+                        .WithMany()
+                        .HasForeignKey("PathSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
+                        .WithMany()
+                        .HasForeignKey("PositionTypeId");
+
+                    b.Navigation("ExecutiveSide");
+
+                    b.Navigation("PathSide");
+
+                    b.Navigation("PositionLevel");
+
+                    b.Navigation("PositionPath");
+
+                    b.Navigation("PositionType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "District")
+                        .WithMany("SubDistricts")
+                        .HasForeignKey("DistrictId");
+
+                    b.Navigation("District");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationAgency")
+                        .WithMany()
+                        .HasForeignKey("OrganizationAgencyId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax")
+                        .WithMany()
+                        .HasForeignKey("OrganizationFaxId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationGovernmentAgency")
+                        .WithMany()
+                        .HasForeignKey("OrganizationGovernmentAgencyId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
+                        .WithMany()
+                        .HasForeignKey("OrganizationLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
+                        .WithMany()
+                        .HasForeignKey("OrganizationOrganizationId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
+                        .WithMany()
+                        .HasForeignKey("OrganizationShortNameId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelExternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelInternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTypeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", "PositionEmployeeLine")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeeLineId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", "PositionEmployeePosition")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeePositionId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", "PositionEmployeeStatus")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeeStatusId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany()
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("OrganizationAgency");
+
+                    b.Navigation("OrganizationFax");
+
+                    b.Navigation("OrganizationGovernmentAgency");
+
+                    b.Navigation("OrganizationLevel");
+
+                    b.Navigation("OrganizationOrganization");
+
+                    b.Navigation("OrganizationShortName");
+
+                    b.Navigation("OrganizationTelExternal");
+
+                    b.Navigation("OrganizationTelInternal");
+
+                    b.Navigation("OrganizationType");
+
+                    b.Navigation("PositionEmployeeLine");
+
+                    b.Navigation("PositionEmployeePosition");
+
+                    b.Navigation("PositionEmployeeStatus");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
+                        .WithMany("OrganizationPositionEmployeeLevels")
+                        .HasForeignKey("OrganizationEmployeeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", "PositionEmployeeLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeeLevelId");
+
+                    b.Navigation("OrganizationEmployee");
+
+                    b.Navigation("PositionEmployeeLevel");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
+                        .WithMany("OrganizationPositionEmployeePositionSides")
+                        .HasForeignKey("OrganizationEmployeeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", "PositionEmployeePositionSide")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeePositionSideId");
+
+                    b.Navigation("OrganizationEmployee");
+
+                    b.Navigation("PositionEmployeePositionSide");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster")
+                        .WithMany()
+                        .HasForeignKey("PositionMasterId");
+
+                    b.Navigation("PositionLevel");
+
+                    b.Navigation("PositionMaster");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax")
+                        .WithMany()
+                        .HasForeignKey("OrganizationFaxId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
+                        .WithMany()
+                        .HasForeignKey("OrganizationLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
+                        .WithMany()
+                        .HasForeignKey("OrganizationOrganizationId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
+                        .WithMany()
+                        .HasForeignKey("OrganizationShortNameId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", "OrganizationStatus")
+                        .WithMany()
+                        .HasForeignKey("OrganizationStatusId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelExternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelInternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTypeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Parent")
+                        .WithMany("Organizations")
+                        .HasForeignKey("ParentId");
+
+                    b.Navigation("OrganizationFax");
+
+                    b.Navigation("OrganizationLevel");
+
+                    b.Navigation("OrganizationOrganization");
+
+                    b.Navigation("OrganizationShortName");
+
+                    b.Navigation("OrganizationStatus");
+
+                    b.Navigation("OrganizationTelExternal");
+
+                    b.Navigation("OrganizationTelInternal");
+
+                    b.Navigation("OrganizationType");
+
+                    b.Navigation("Parent");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization")
+                        .WithMany()
+                        .HasForeignKey("OrganizationId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster")
+                        .WithMany()
+                        .HasForeignKey("PositionMasterId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
+                        .WithMany()
+                        .HasForeignKey("PositionNumberId");
+
+                    b.Navigation("Organization");
+
+                    b.Navigation("PositionMaster");
+
+                    b.Navigation("PositionNumber");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutive", "PositionExecutive")
+                        .WithMany()
+                        .HasForeignKey("PositionExecutiveId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "PositionExecutiveSide")
+                        .WithMany()
+                        .HasForeignKey("PositionExecutiveSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
+                        .WithMany()
+                        .HasForeignKey("PositionLineId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
+                        .WithMany()
+                        .HasForeignKey("PositionPathSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionStatus", "PositionStatus")
+                        .WithMany()
+                        .HasForeignKey("PositionStatusId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
+                        .WithMany()
+                        .HasForeignKey("PositionTypeId");
+
+                    b.Navigation("PositionExecutive");
+
+                    b.Navigation("PositionExecutiveSide");
+
+                    b.Navigation("PositionLine");
+
+                    b.Navigation("PositionPath");
+
+                    b.Navigation("PositionPathSide");
+
+                    b.Navigation("PositionStatus");
+
+                    b.Navigation("PositionType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMasterEntity")
+                        .WithMany("PositionMasterHistorys")
+                        .HasForeignKey("PositionMasterEntityId");
+
+                    b.Navigation("PositionMasterEntity");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
+                        .WithMany()
+                        .HasForeignKey("OrganizationShortNameId");
+
+                    b.Navigation("OrganizationShortName");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
+                        .WithMany()
+                        .HasForeignKey("OrganizationPositionId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany()
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("OrganizationPosition");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", "Report2DetailHistory")
+                        .WithMany()
+                        .HasForeignKey("Report2DetailHistoryId");
+
+                    b.Navigation("Report2DetailHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementType", "PlacementType")
+                        .WithMany()
+                        .HasForeignKey("PlacementTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("PlacementType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
+                        .WithMany("PlacementCertificates")
+                        .HasForeignKey("PlacementProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("PlacementProfile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.EducationLevel", "EducationLevel")
+                        .WithMany()
+                        .HasForeignKey("EducationLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
+                        .WithMany("PlacementEducations")
+                        .HasForeignKey("PlacementProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.Navigation("EducationLevel");
+
+                    b.Navigation("PlacementProfile");
+
+                    b.Navigation("PositionPath");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup")
+                        .WithMany()
+                        .HasForeignKey("BloodGroupId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CitizenDistrict")
+                        .WithMany()
+                        .HasForeignKey("CitizenDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CitizenProvince")
+                        .WithMany()
+                        .HasForeignKey("CitizenProvinceId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CurrentDistrict")
+                        .WithMany()
+                        .HasForeignKey("CurrentDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CurrentProvince")
+                        .WithMany()
+                        .HasForeignKey("CurrentProvinceId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "CurrentSubDistrict")
+                        .WithMany()
+                        .HasForeignKey("CurrentSubDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "FatherPrefix")
+                        .WithMany()
+                        .HasForeignKey("FatherPrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender")
+                        .WithMany()
+                        .HasForeignKey("GenderId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MarryPrefix")
+                        .WithMany()
+                        .HasForeignKey("MarryPrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MotherPrefix")
+                        .WithMany()
+                        .HasForeignKey("MotherPrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
+                        .WithMany()
+                        .HasForeignKey("OrganizationPositionId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
+                        .WithMany("PlacementProfiles")
+                        .HasForeignKey("PlacementId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
+                        .WithMany()
+                        .HasForeignKey("PositionLineId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
+                        .WithMany()
+                        .HasForeignKey("PositionNumberId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
+                        .WithMany()
+                        .HasForeignKey("PositionPathSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
+                        .WithMany()
+                        .HasForeignKey("PositionTypeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "Prefix")
+                        .WithMany()
+                        .HasForeignKey("PrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict")
+                        .WithMany()
+                        .HasForeignKey("RegistDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "RegistProvince")
+                        .WithMany()
+                        .HasForeignKey("RegistProvinceId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "RegistSubDistrict")
+                        .WithMany()
+                        .HasForeignKey("RegistSubDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
+                        .WithMany()
+                        .HasForeignKey("RelationshipId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ReliefDoc")
+                        .WithMany()
+                        .HasForeignKey("ReliefDocId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion")
+                        .WithMany()
+                        .HasForeignKey("ReligionId");
+
+                    b.Navigation("BloodGroup");
+
+                    b.Navigation("CitizenDistrict");
+
+                    b.Navigation("CitizenProvince");
+
+                    b.Navigation("CurrentDistrict");
+
+                    b.Navigation("CurrentProvince");
+
+                    b.Navigation("CurrentSubDistrict");
+
+                    b.Navigation("FatherPrefix");
+
+                    b.Navigation("Gender");
+
+                    b.Navigation("MarryPrefix");
+
+                    b.Navigation("MotherPrefix");
+
+                    b.Navigation("OrganizationPosition");
+
+                    b.Navigation("Placement");
+
+                    b.Navigation("PositionLevel");
+
+                    b.Navigation("PositionLine");
+
+                    b.Navigation("PositionNumber");
+
+                    b.Navigation("PositionPath");
+
+                    b.Navigation("PositionPathSide");
+
+                    b.Navigation("PositionType");
+
+                    b.Navigation("Prefix");
+
+                    b.Navigation("RegistDistrict");
+
+                    b.Navigation("RegistProvince");
+
+                    b.Navigation("RegistSubDistrict");
+
+                    b.Navigation("Relationship");
+
+                    b.Navigation("ReliefDoc");
+
+                    b.Navigation("Religion");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.BaseCommand", b =>
+                {
+                    b.Navigation("Documents");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
+                {
+                    b.Navigation("LimitTypeLeaves");
+
+                    b.Navigation("Profiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+                {
+                    b.Navigation("Abilitys");
+
+                    b.Navigation("AddressHistory");
+
+                    b.Navigation("Assessments");
+
+                    b.Navigation("AvatarHistory");
+
+                    b.Navigation("Certificates");
+
+                    b.Navigation("ChangeNames");
+
+                    b.Navigation("Childrens");
+
+                    b.Navigation("CoupleHistory");
+
+                    b.Navigation("CurrentAddressHistory");
+
+                    b.Navigation("Disciplines");
+
+                    b.Navigation("Dutys");
+
+                    b.Navigation("Educations");
+
+                    b.Navigation("FamilyHistory");
+
+                    b.Navigation("FatherHistory");
+
+                    b.Navigation("GovernmentHistory");
+
+                    b.Navigation("Honors");
+
+                    b.Navigation("Insignias");
+
+                    b.Navigation("Leaves");
+
+                    b.Navigation("MotherHistory");
+
+                    b.Navigation("Nopaids");
+
+                    b.Navigation("Others");
+
+                    b.Navigation("Papers");
+
+                    b.Navigation("ProfileHistory");
+
+                    b.Navigation("RegistrationAddressHistory");
+
+                    b.Navigation("Salaries");
+
+                    b.Navigation("Trainings");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
+                {
+                    b.Navigation("ProfileAbilityHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b =>
+                {
+                    b.Navigation("ProfileAssessmentHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b =>
+                {
+                    b.Navigation("ProfileCertificateHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b =>
+                {
+                    b.Navigation("ProfileChangeNameHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b =>
+                {
+                    b.Navigation("ProfileChildrenHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b =>
+                {
+                    b.Navigation("ProfileDisciplineHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b =>
+                {
+                    b.Navigation("ProfileDutyHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b =>
+                {
+                    b.Navigation("ProfileEducationHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b =>
+                {
+                    b.Navigation("Childrens");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b =>
+                {
+                    b.Navigation("ProfileHonorHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
+                {
+                    b.Navigation("ProfileInsigniaHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
+                {
+                    b.Navigation("ProfileLeaveHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b =>
+                {
+                    b.Navigation("ProfileNopaidHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b =>
+                {
+                    b.Navigation("ProfileOtherHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
+                {
+                    b.Navigation("ProfileSalaryHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b =>
+                {
+                    b.Navigation("ProfileTrainingHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b =>
+                {
+                    b.Navigation("LimitTypeLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b =>
+                {
+                    b.Navigation("SubDistricts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b =>
+                {
+                    b.Navigation("Districts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
+                {
+                    b.Navigation("OrganizationPositionEmployeeLevels");
+
+                    b.Navigation("OrganizationPositionEmployeePositionSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
+                {
+                    b.Navigation("Organizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
+                {
+                    b.Navigation("PositionMasterHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
+                {
+                    b.Navigation("PlacementProfiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
+                {
+                    b.Navigation("PlacementCertificates");
+
+                    b.Navigation("PlacementEducations");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}
diff --git a/BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.cs b/BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.cs
new file mode 100644
index 00000000..591ed2ee
--- /dev/null
+++ b/BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.cs	
@@ -0,0 +1,198 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace BMA.EHR.Infrastructure.Migrations
+{
+    /// 
+    public partial class AddPlacementCommandTableandCommandCoreTable : Migration
+    {
+        /// 
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "CommandStatuses",
+                columns: table => new
+                {
+                    Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
+                    CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
+                    CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
+                    LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    Name = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, comment: "สถานะของคำสั่ง")
+                        .Annotation("MySql:CharSet", "utf8mb4")
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_CommandStatuses", x => x.Id);
+                })
+                .Annotation("MySql:CharSet", "utf8mb4");
+
+            migrationBuilder.CreateTable(
+                name: "CommandTypes",
+                columns: table => new
+                {
+                    Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
+                    CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
+                    CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
+                    LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อคำสั่ง")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    Category = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ประเภทคำสั่ง")
+                        .Annotation("MySql:CharSet", "utf8mb4")
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_CommandTypes", x => x.Id);
+                })
+                .Annotation("MySql:CharSet", "utf8mb4");
+
+           
+
+            migrationBuilder.CreateTable(
+                name: "BaseCommand",
+                columns: table => new
+                {
+                    Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
+                    CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
+                    CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
+                    LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CommandNo = table.Column(type: "varchar(10)", maxLength: 10, nullable: false, comment: "เลขที่คำสั่ง")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CommandYear = table.Column(type: "varchar(4)", maxLength: 4, nullable: false, comment: "ปีที่ออกคำสั่ง")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CommandTypeId = table.Column(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงประเภทคำสั่ง", collation: "ascii_general_ci"),
+                    IssuerOrganizationId = table.Column(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง", collation: "ascii_general_ci"),
+                    IssuerOrganizationName = table.Column(type: "longtext", nullable: false, comment: "หน่วยงานที่ออกคำสั่ง")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CommandStatusId = table.Column(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงสถานะคำสั่ง", collation: "ascii_general_ci"),
+                    AuthorizedUserId = table.Column(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงผู้มีอำนาจลงนาม", collation: "ascii_general_ci"),
+                    AuthorizedUserFullName = table.Column(type: "longtext", nullable: false, comment: "ชื่อผู้มีอำนาจลงนาม")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    Discriminator = table.Column(type: "longtext", nullable: false)
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    ExamRoundId = table.Column(type: "char(36)", nullable: true, comment: "อ้างอิงรอบการสอบ", collation: "ascii_general_ci"),
+                    PositionName = table.Column(type: "longtext", nullable: true, comment: "ตำแหน่งที่บรรจุ")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    ConclusionRegisterNo = table.Column(type: "longtext", nullable: true, comment: "มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    ConclusionRegisterDate = table.Column(type: "datetime(6)", nullable: true, comment: "ลงวันที่ (เรื่อง รับสมัครสอบฯ)"),
+                    ConclusionResultNo = table.Column(type: "longtext", nullable: true, comment: "มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    ConclusionResultDate = table.Column(type: "datetime(6)", nullable: true, comment: "ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)")
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_BaseCommand", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_BaseCommand_CommandStatuses_CommandStatusId",
+                        column: x => x.CommandStatusId,
+                        principalTable: "CommandStatuses",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                    table.ForeignKey(
+                        name: "FK_BaseCommand_CommandTypes_CommandTypeId",
+                        column: x => x.CommandTypeId,
+                        principalTable: "CommandTypes",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                })
+                .Annotation("MySql:CharSet", "utf8mb4");
+
+            migrationBuilder.CreateTable(
+                name: "CommandDocuments",
+                columns: table => new
+                {
+                    Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
+                    CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
+                    CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
+                    LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    Category = table.Column(type: "longtext", nullable: false, comment: "ประเภทเอกสาร")
+                        .Annotation("MySql:CharSet", "utf8mb4"),
+                    DocumentId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
+                    CommandId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_CommandDocuments", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_CommandDocuments_BaseCommand_CommandId",
+                        column: x => x.CommandId,
+                        principalTable: "BaseCommand",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                    table.ForeignKey(
+                        name: "FK_CommandDocuments_Documents_DocumentId",
+                        column: x => x.DocumentId,
+                        principalTable: "Documents",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                })
+                .Annotation("MySql:CharSet", "utf8mb4");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_BaseCommand_CommandStatusId",
+                table: "BaseCommand",
+                column: "CommandStatusId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_BaseCommand_CommandTypeId",
+                table: "BaseCommand",
+                column: "CommandTypeId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_CommandDocuments_CommandId",
+                table: "CommandDocuments",
+                column: "CommandId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_CommandDocuments_DocumentId",
+                table: "CommandDocuments",
+                column: "DocumentId");
+        }
+
+        /// 
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "CommandDocuments");
+
+            migrationBuilder.DropTable(
+                name: "BaseCommand");
+
+            migrationBuilder.DropTable(
+                name: "CommandStatuses");
+
+            migrationBuilder.DropTable(
+                name: "CommandTypes");
+        }
+    }
+}
diff --git a/BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.Designer.cs
new file mode 100644
index 00000000..ac34b18f
--- /dev/null
+++ b/BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.Designer.cs	
@@ -0,0 +1,11258 @@
+// 
+using System;
+using BMA.EHR.Infrastructure.Persistence;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace BMA.EHR.Infrastructure.Migrations
+{
+    [DbContext(typeof(ApplicationDBContext))]
+    [Migration("20230713075919_Change Base Command Table Name")]
+    partial class ChangeBaseCommandTableName
+    {
+        /// 
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "7.0.9")
+                .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AuthorizedUserFullName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อผู้มีอำนาจลงนาม");
+
+                    b.Property("AuthorizedUserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
+
+                    b.Property("CommandNo")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("เลขที่คำสั่ง");
+
+                    b.Property("CommandStatusId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงสถานะคำสั่ง");
+
+                    b.Property("CommandTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงประเภทคำสั่ง");
+
+                    b.Property("CommandYear")
+                        .IsRequired()
+                        .HasMaxLength(4)
+                        .HasColumnType("varchar(4)")
+                        .HasComment("ปีที่ออกคำสั่ง");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Discriminator")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property("IssuerOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง");
+
+                    b.Property("IssuerOrganizationName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("หน่วยงานที่ออกคำสั่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CommandStatusId");
+
+                    b.HasIndex("CommandTypeId");
+
+                    b.ToTable("Command");
+
+                    b.HasDiscriminator("Discriminator").HasValue("Command");
+
+                    b.UseTphMappingStrategy();
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทเอกสาร");
+
+                    b.Property("CommandId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CommandId");
+
+                    b.HasIndex("DocumentId");
+
+                    b.ToTable("CommandDocuments");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะของคำสั่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CommandStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ประเภทคำสั่ง");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อคำสั่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CommandTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsSendEmail")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsSendInbox")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("DeploymentChannels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("Detail")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property("FileName")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("varchar(255)");
+
+                    b.Property("FileSize")
+                        .HasColumnType("int");
+
+                    b.Property("FileType")
+                        .IsRequired()
+                        .HasMaxLength(128)
+                        .HasColumnType("varchar(128)");
+
+                    b.Property("ObjectRefId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Documents");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ยังไม่ชัวใช้อะไรเป็นkey");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LimitLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("LimitLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("NumLeave")
+                        .HasColumnType("double")
+                        .HasComment("จำนวนที่ลาได้");
+
+                    b.Property("TypeLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("LimitLeaveId");
+
+                    b.HasIndex("TypeLeaveId");
+
+                    b.ToTable("LimitTypeLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)");
+
+                    b.Property("Ability")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("AvatarId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("AvatarRef")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("BirthDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเกิด");
+
+                    b.Property("BloodGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มเลือด");
+
+                    b.Property("CitizenId")
+                        .HasMaxLength(13)
+                        .HasColumnType("varchar(13)")
+                        .HasComment("รหัสบัตรประชาชน");
+
+                    b.Property("Couple")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("คู่สมรส");
+
+                    b.Property("CoupleCareer")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("อาชีพคู่สมรส");
+
+                    b.Property("CoupleFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อคู่สมรส");
+
+                    b.Property("CoupleLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลคู่สมรส");
+
+                    b.Property("CoupleLastNameOld")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลคู่สมรส(เดิม)");
+
+                    b.Property("CouplePrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าคู่สมรส");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUser")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("varchar(250)");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("CurrentAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ที่อยู่ปัจจุบัน");
+
+                    b.Property("CurrentDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตปัจจุบัน");
+
+                    b.Property("CurrentProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดปัจจุบัน");
+
+                    b.Property("CurrentSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id แขวงปัจจุบัน");
+
+                    b.Property("CurrentZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ปัจจุบัน");
+
+                    b.Property("DateAppoint")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DateRetire")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("EmployeeClass")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทลูกจ้าง");
+
+                    b.Property("EmployeeType")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทการจ้าง");
+
+                    b.Property("EntryStatus")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)");
+
+                    b.Property("FatherCareer")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("อาชีพบิดา");
+
+                    b.Property("FatherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อบิดา");
+
+                    b.Property("FatherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลบิดา");
+
+                    b.Property("FatherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบิดา");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("FirstNameOld")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ(เดิม)");
+
+                    b.Property("GenderId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เพศ");
+
+                    b.Property("GovAgeAbsent")
+                        .HasColumnType("int");
+
+                    b.Property("GovAgePlus")
+                        .HasColumnType("int");
+
+                    b.Property("GovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsLeave")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsProbation")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsTransfer")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsVerified")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("KeycloakId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastNameOld")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล(เดิม)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("LeaveDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("LeaveDateOrder")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("LeaveDetail")
+                        .HasColumnType("longtext");
+
+                    b.Property("LeaveNumberOrder")
+                        .HasColumnType("longtext");
+
+                    b.Property("LeaveReason")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)");
+
+                    b.Property("LimitLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ModifiedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("MotherCareer")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("อาชีพมารดา");
+
+                    b.Property("MotherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อมารดา");
+
+                    b.Property("MotherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลมารดา");
+
+                    b.Property("MotherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้ามารดา");
+
+                    b.Property("Nationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติ");
+
+                    b.Property("Oc")
+                        .HasColumnType("longtext")
+                        .HasComment("สังกัด");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("OrganizationOrganization")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Physical")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานภาพทางกาย");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่ง");
+
+                    b.Property("PosNoEmployee")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่งลูกจ้าง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มงาน");
+
+                    b.Property("PositionEmployeeGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านของตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางการบริหาร");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับ");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับ");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasComment("สายงาน");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สายงาน");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขา");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้าน/สาขา");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ประเภทตำแหน่ง");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("PrefixOldId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า(เดิม)");
+
+                    b.Property("ProfileType")
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("Race")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("เชื้อชาติ");
+
+                    b.Property("ReasonSameDate")
+                        .HasColumnType("longtext");
+
+                    b.Property("RegistrationAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("Id แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationSame")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่");
+
+                    b.Property("RegistrationSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน");
+
+                    b.Property("RelationshipId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สถานะภาพ");
+
+                    b.Property("ReligionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ศาสนา");
+
+                    b.Property("TelephoneNumber")
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasComment("เบอร์โทร");
+
+                    b.Property("TransferDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("VerifiedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("VerifiedUser")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AvatarId");
+
+                    b.HasIndex("LimitLeaveId");
+
+                    b.ToTable("Profiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("Field")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.Property("Remark")
+                        .HasColumnType("longtext")
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAbilitys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("Field")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileAbilityId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.Property("Remark")
+                        .HasColumnType("longtext")
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileAbilityId");
+
+                    b.ToTable("ProfileAbilityHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("CurrentAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ที่อยู่ปัจจุบัน");
+
+                    b.Property("CurrentDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("เขตปัจจุบัน");
+
+                    b.Property("CurrentDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตปัจจุบัน");
+
+                    b.Property("CurrentProvince")
+                        .HasColumnType("longtext")
+                        .HasComment("จังหวัดปัจจุบัน");
+
+                    b.Property("CurrentProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดปัจจุบัน");
+
+                    b.Property("CurrentSubDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("แขวงปัจจุบัน");
+
+                    b.Property("CurrentSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id แขวงปัจจุบัน");
+
+                    b.Property("CurrentZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ปัจจุบัน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistrationAddress")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("เขตตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เขตตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationProvince")
+                        .HasColumnType("longtext")
+                        .HasComment("จังหวัดตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationProvinceId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id จังหวัดตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationSame")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่");
+
+                    b.Property("RegistrationSubDistrict")
+                        .HasColumnType("longtext")
+                        .HasComment("แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationSubDistrictId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id แขวงตามทะเบียนบ้าน");
+
+                    b.Property("RegistrationZipCode")
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)")
+                        .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAddressHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อแบบประเมิน");
+
+                    b.Property("Point1")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่1 (คะแนน)");
+
+                    b.Property("Point1Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่1 (คะแนน)");
+
+                    b.Property("Point2")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่2 (คะแนน)");
+
+                    b.Property("Point2Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่2 (คะแนน)");
+
+                    b.Property("PointSum")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินรวม (คะแนน)");
+
+                    b.Property("PointSumTotal")
+                        .HasColumnType("double")
+                        .HasComment("ผลรวม (คะแนน)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAssessments");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อแบบประเมิน");
+
+                    b.Property("Point1")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่1 (คะแนน)");
+
+                    b.Property("Point1Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่1 (คะแนน)");
+
+                    b.Property("Point2")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินส่วนที่2 (คะแนน)");
+
+                    b.Property("Point2Total")
+                        .HasColumnType("double")
+                        .HasComment("ส่วนที่2 (คะแนน)");
+
+                    b.Property("PointSum")
+                        .HasColumnType("double")
+                        .HasComment("ผลประเมินรวม (คะแนน)");
+
+                    b.Property("PointSumTotal")
+                        .HasColumnType("double")
+                        .HasComment("ผลรวม (คะแนน)");
+
+                    b.Property("ProfileAssessmentId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileAssessmentId");
+
+                    b.ToTable("ProfileAssessmentHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AvatarFileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AvatarFileId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileAvatarHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CertificateNo")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขที่ใบอนุญาต");
+
+                    b.Property("CertificateType")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อใบอนุญาต");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExpireDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่หมดอายุ");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกใบอนุญาต");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานผู้ออกใบอนุญาต");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileCertificates");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CertificateNo")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขที่ใบอนุญาต");
+
+                    b.Property("CertificateType")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อใบอนุญาต");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExpireDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่หมดอายุ");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกใบอนุญาต");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานผู้ออกใบอนุญาต");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileCertificateId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileCertificateId");
+
+                    b.ToTable("ProfileCertificateHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("FirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("LastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Prefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้า");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Status")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DocumentId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileChangeNames");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("FirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("LastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Prefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้า");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("ProfileChangeNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Status")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DocumentId");
+
+                    b.HasIndex("ProfileChangeNameId");
+
+                    b.ToTable("ProfileChangeNameHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("ChildrenCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพบุตร");
+
+                    b.Property("ChildrenFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อบุตร");
+
+                    b.Property("ChildrenLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลบุตร");
+
+                    b.Property("ChildrenPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าบุตร");
+
+                    b.Property("ChildrenPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบุตร");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileChildrens");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("ChildrenCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพบุตร");
+
+                    b.Property("ChildrenFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อบุตร");
+
+                    b.Property("ChildrenLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลบุตร");
+
+                    b.Property("ChildrenPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าบุตร");
+
+                    b.Property("ChildrenPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบุตร");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileChildrenId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileFamilyHistoryId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileChildrenId");
+
+                    b.HasIndex("ProfileFamilyHistoryId");
+
+                    b.ToTable("ProfileChildrenHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Career")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("Prefix")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileCoupleHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Address")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ZipCode")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileCurrentAddressHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("text")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับความผิด");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RefCommandDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เอกสารอ้างอิง (ลงวันที่)");
+
+                    b.Property("RefCommandNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileDisciplines");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("text")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับความผิด");
+
+                    b.Property("ProfileDisciplineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RefCommandDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เอกสารอ้างอิง (ลงวันที่)");
+
+                    b.Property("RefCommandNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileDisciplineId");
+
+                    b.ToTable("ProfileDisciplineHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileDutys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEnd")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("สิ้นสุด");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เริ่มต้น");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileDutyId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileDutyId");
+
+                    b.ToTable("ProfileDutyHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Country")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ประเทศ");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Degree")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("วุฒิการศึกษา");
+
+                    b.Property("Duration")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ระยะเวลา");
+
+                    b.Property("DurationYear")
+                        .HasColumnType("int")
+                        .HasComment("ระยะเวลาหลักสูตร");
+
+                    b.Property("EducationLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับศึกษา");
+
+                    b.Property("EducationLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ระดับศึกษา");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ถึง");
+
+                    b.Property("Field")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สาขาวิชา/ทาง");
+
+                    b.Property("FinishDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สำเร็จการศึกษา");
+
+                    b.Property("FundName")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ทุน");
+
+                    b.Property("Gpa")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เกรดเฉลี่ย");
+
+                    b.Property("Institute")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("สถานศึกษา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Other")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ข้อมูลการติดต่อ");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext")
+                        .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ตั้งแต่");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileEducations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Country")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ประเทศ");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Degree")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("วุฒิการศึกษา");
+
+                    b.Property("Duration")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ระยะเวลา");
+
+                    b.Property("DurationYear")
+                        .HasColumnType("int")
+                        .HasComment("ระยะเวลาหลักสูตร");
+
+                    b.Property("EducationLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับศึกษา");
+
+                    b.Property("EducationLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ระดับศึกษา");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ถึง");
+
+                    b.Property("Field")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สาขาวิชา/ทาง");
+
+                    b.Property("FinishDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สำเร็จการศึกษา");
+
+                    b.Property("FundName")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ทุน");
+
+                    b.Property("Gpa")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เกรดเฉลี่ย");
+
+                    b.Property("Institute")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("สถานศึกษา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Other")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ข้อมูลการติดต่อ");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext")
+                        .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง");
+
+                    b.Property("ProfileEducationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ตั้งแต่");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileEducationId");
+
+                    b.ToTable("ProfileEducationHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Couple")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("คู่สมรส");
+
+                    b.Property("CoupleCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพคู่สมรส");
+
+                    b.Property("CoupleFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อคู่สมรส");
+
+                    b.Property("CoupleLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลคู่สมรส");
+
+                    b.Property("CoupleLastNameOld")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลคู่สมรส(เดิม)");
+
+                    b.Property("CouplePrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าคู่สมรส");
+
+                    b.Property("CouplePrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าคู่สมรส");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("FatherCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพบิดา");
+
+                    b.Property("FatherFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อบิดา");
+
+                    b.Property("FatherLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลบิดา");
+
+                    b.Property("FatherPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้าบิดา");
+
+                    b.Property("FatherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้าบิดา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MotherCareer")
+                        .HasColumnType("longtext")
+                        .HasComment("อาชีพมารดา");
+
+                    b.Property("MotherFirstName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อมารดา");
+
+                    b.Property("MotherLastName")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุลมารดา");
+
+                    b.Property("MotherPrefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้ามารดา");
+
+                    b.Property("MotherPrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้ามารดา");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileFamilyHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Career")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("Prefix")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileFatherHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateAppoint")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สั่งบรรจุ");
+
+                    b.Property("DateStart")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("เริ่มปฎิบัติราชการ");
+
+                    b.Property("GovAge")
+                        .HasColumnType("longtext")
+                        .HasComment("อายุราชการ");
+
+                    b.Property("GovAgeAbsent")
+                        .HasColumnType("int")
+                        .HasComment("ขาดราชการ");
+
+                    b.Property("GovAgePlus")
+                        .HasColumnType("int")
+                        .HasComment("อายุราชการเกื้อกูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Oc")
+                        .HasColumnType("longtext")
+                        .HasComment("สังกัด");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่ง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับตำแหน่ง");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasComment("สายงาน");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReasonSameDate")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผลกรณีไม่ตรงวัน");
+
+                    b.Property("RetireDate")
+                        .HasColumnType("longtext")
+                        .HasComment("วันเกษียณอายุ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileGovernmentHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("BirthDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเกิด");
+
+                    b.Property("BloodGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มเลือด");
+
+                    b.Property("BloodGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มเลือด");
+
+                    b.Property("CitizenId")
+                        .HasMaxLength(13)
+                        .HasColumnType("varchar(13)")
+                        .HasComment("รหัสบัตรประชาชน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("EmployeeClass")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทลูกจ้าง");
+
+                    b.Property("EmployeeType")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ประเภทการจ้าง");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อ");
+
+                    b.Property("Gender")
+                        .HasColumnType("longtext")
+                        .HasComment("เพศ");
+
+                    b.Property("GenderId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เพศ");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Nationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติ");
+
+                    b.Property("Prefix")
+                        .HasColumnType("longtext")
+                        .HasComment("คำนำหน้า");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id คำนำหน้า");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Race")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("เชื้อชาติ");
+
+                    b.Property("Relationship")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะภาพ");
+
+                    b.Property("RelationshipId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สถานะภาพ");
+
+                    b.Property("Religion")
+                        .HasColumnType("longtext")
+                        .HasComment("ศาสนา");
+
+                    b.Property("ReligionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ศาสนา");
+
+                    b.Property("TelephoneNumber")
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasComment("เบอร์โทร");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .HasMaxLength(2000)
+                        .HasColumnType("varchar(2000)")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่ออก");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileHonors");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .HasMaxLength(2000)
+                        .HasColumnType("varchar(2000)")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ได้รับ");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่ออก");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileHonorId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileHonorId");
+
+                    b.ToTable("ProfileHonorHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateAnnounce")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ประกาศในราชกิจจาฯ");
+
+                    b.Property("Insignia")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อเครื่องราชฯ");
+
+                    b.Property("InsigniaId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("InsigniaType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภท");
+
+                    b.Property("Issue")
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasComment("ราชกิจจาฯ ฉบับที่");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("No")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ลำดับที่");
+
+                    b.Property("Page")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("หน้า");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReceiveDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่");
+
+                    b.Property("Section")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("ตอน");
+
+                    b.Property("Volume")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่ม");
+
+                    b.Property("VolumeNo")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่มที่");
+
+                    b.Property("Year")
+                        .HasColumnType("int")
+                        .HasComment("ปีที่ยื่นขอ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileInsignias");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateAnnounce")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ประกาศในราชกิจจาฯ");
+
+                    b.Property("Insignia")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อเครื่องราชฯ");
+
+                    b.Property("InsigniaId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("InsigniaType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภท");
+
+                    b.Property("Issue")
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasComment("ราชกิจจาฯ ฉบับที่");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("No")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("ลำดับที่");
+
+                    b.Property("Page")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("หน้า");
+
+                    b.Property("ProfileInsigniaId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReceiveDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่");
+
+                    b.Property("Section")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("ตอน");
+
+                    b.Property("Volume")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่ม");
+
+                    b.Property("VolumeNo")
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasComment("เล่มที่");
+
+                    b.Property("Year")
+                        .HasColumnType("int")
+                        .HasComment("ปีที่ยื่นขอ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileInsigniaId");
+
+                    b.ToTable("ProfileInsigniaHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEndLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่สิ้นสุดลา");
+
+                    b.Property("DateStartLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่เริ่มลา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("NumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลาครั้งที่");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผล");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะ");
+
+                    b.Property("SumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลามาแล้ว");
+
+                    b.Property("TotalLeave")
+                        .HasColumnType("double")
+                        .HasComment("รวมเป็น");
+
+                    b.Property("TypeLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.HasIndex("TypeLeaveId");
+
+                    b.ToTable("ProfileLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateEndLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่สิ้นสุดลา");
+
+                    b.Property("DateStartLeave")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี ที่เริ่มลา");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("NumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลาครั้งที่");
+
+                    b.Property("ProfileLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผล");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะ");
+
+                    b.Property("SumLeave")
+                        .HasColumnType("double")
+                        .HasComment("ลามาแล้ว");
+
+                    b.Property("TotalLeave")
+                        .HasColumnType("double")
+                        .HasComment("รวมเป็น");
+
+                    b.Property("TypeLeaveId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileLeaveId");
+
+                    b.HasIndex("TypeLeaveId");
+
+                    b.ToTable("ProfileLeaveHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Career")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("FirstName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("LastName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)");
+
+                    b.Property("Prefix")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileMotherHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileNopaids");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileNopaidId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Reference")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileNopaidId");
+
+                    b.ToTable("ProfileNopaidHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOrganization", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id หน่วยงานที่สังกัด");
+
+                    b.Property("UserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("User Id KeyCloak");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileOrganizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileOthers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียด");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileOtherId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileOtherId");
+
+                    b.ToTable("ProfileOtherHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CategoryName")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("varchar(255)")
+                        .HasComment("ประเภทไฟล์-ไม่ใช้");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("varchar(255)")
+                        .HasComment("ชื่อไฟล์");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DocumentId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfilePapers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Address")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.Property("CreatedDate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property("DistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ZipCode")
+                        .IsRequired()
+                        .HasMaxLength(5)
+                        .HasColumnType("varchar(5)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileRegistrationAddressHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Amount")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี รับตำแหน่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MouthSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินค่าตอบแทนรายเดือน");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ชื่อย่อหน่วยงาน");
+
+                    b.Property("PosNoEmployee")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่งลูกจ้าง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ระดับ");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สายงาน");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้าน/สาขา");
+
+                    b.Property("PositionSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ประเภทตำแหน่ง");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SalaryClass")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง (รายละเอียด)");
+
+                    b.Property("SalaryRef")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileSalaries");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Amount")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Date")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วัน เดือน ปี รับตำแหน่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MouthSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินค่าตอบแทนรายเดือน");
+
+                    b.Property("Oc")
+                        .HasColumnType("longtext")
+                        .HasComment("สังกัด");
+
+                    b.Property("OcId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สังกัด");
+
+                    b.Property("OrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่ง");
+
+                    b.Property("PosNoEmployee")
+                        .HasColumnType("longtext")
+                        .HasComment("เลขที่ตำแหน่งลูกจ้าง");
+
+                    b.Property("PosNoId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id เลขที่ตำแหน่ง");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeeGroup")
+                        .HasColumnType("longtext")
+                        .HasComment("กลุ่มงาน");
+
+                    b.Property("PositionEmployeeGroupId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id กลุ่มงาน");
+
+                    b.Property("PositionEmployeeLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับชั้นงาน");
+
+                    b.Property("PositionEmployeePosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านของตำแหน่ง");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านของตำแหน่ง");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางการบริหาร");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้านทางการบริหาร");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ตำแหน่ง");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับ");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment(" Id ระดับ");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasComment("สายงาน");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id สายงาน");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขา");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ด้าน/สาขา");
+
+                    b.Property("PositionSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("Id ประเภทตำแหน่ง");
+
+                    b.Property("ProfileSalaryId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("SalaryClass")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง (รายละเอียด)");
+
+                    b.Property("SalaryRef")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileSalaryId");
+
+                    b.ToTable("ProfileSalaryHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryOrganization", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryOrganizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionId");
+
+                    b.ToTable("ProfileSalaryPositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryPositionLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionNumber", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryPositionsNumbers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasComment("ไม่ใช้");
+
+                    b.Property("Comment")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ProfileSalaryPositionTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateOrder")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่");
+
+                    b.Property("Department")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน");
+
+                    b.Property("Duration")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม");
+
+                    b.Property("NumberOrder")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ");
+
+                    b.Property("Place")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สถานที่ฝึกอบรม/ดูงาน");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน");
+
+                    b.Property("Topic")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวข้อการฝึกอบรม/ดูงาน");
+
+                    b.Property("Yearly")
+                        .HasMaxLength(200)
+                        .HasColumnType("int")
+                        .HasComment("ปีที่อบรม (พ.ศ.)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfileTrainings");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DateOrder")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่");
+
+                    b.Property("Department")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน");
+
+                    b.Property("Duration")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม");
+
+                    b.Property("NumberOrder")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ");
+
+                    b.Property("Place")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สถานที่ฝึกอบรม/ดูงาน");
+
+                    b.Property("ProfileTrainingId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน");
+
+                    b.Property("Topic")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวข้อการฝึกอบรม/ดูงาน");
+
+                    b.Property("Yearly")
+                        .HasMaxLength(200)
+                        .HasColumnType("int")
+                        .HasComment("ปีที่อบรม (พ.ศ.)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProfileTrainingId");
+
+                    b.ToTable("ProfileTrainingHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทการลา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("TypeLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.BloodGroup", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(2)
+                        .HasColumnType("varchar(2)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อหมู่โลหิต");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("BloodGroups");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("varchar(150)")
+                        .HasColumnOrder(1)
+                        .HasComment("เขต/อำเภอ");
+
+                    b.Property("ProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ProvinceId");
+
+                    b.ToTable("Districts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.EducationLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ระดับการศึกษา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("EducationLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Gender", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasColumnOrder(1)
+                        .HasComment("เพศ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Genders");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Holiday", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(6)
+                        .HasComment("ประเภทของวันหยุดสำหรับ ทำงาน 5 วัน=`NORMAL`,ทำงาน 6 วัน=`6DAYS`");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("HolidayDate")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(2)
+                        .HasComment("วันหยุด");
+
+                    b.Property("IsSpecial")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(5)
+                        .HasComment("เป็นวันหยุดพิเศษหรือไม่");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("varchar(250)")
+                        .HasColumnOrder(4)
+                        .HasComment("ชื่อวันหยุด");
+
+                    b.Property("OriginalDate")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(3)
+                        .HasComment("วันหยุด(Original)");
+
+                    b.Property("Year")
+                        .HasColumnType("int")
+                        .HasColumnOrder(1)
+                        .HasComment("ประจำปี");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Holidays");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("InsigniaTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("int")
+                        .HasColumnOrder(4)
+                        .HasComment("ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อเครื่องราชย์");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(5)
+                        .HasComment("หมายเหตุ");
+
+                    b.Property("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(30)
+                        .HasColumnType("varchar(30)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อย่อเครื่องราชย์");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("InsigniaTypeId");
+
+                    b.ToTable("Insignias");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.InsigniaType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทเครื่องราชย์");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("InsigniaTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationAgency", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงานต้นสังกัด");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationAgencys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationFax", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์โทรสาร");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationFaxs");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationGovernmentAgency", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ส่วนราชการต้นสังกัด");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationGovernmentAgencys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ระดับ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationOrganizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AgencyCode")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("GovernmentCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(2)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(4)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(3)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(5)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationShortNames");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ สถานะ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายนอก");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationTelExternals");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายใน");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationTelInternals");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ประเภท");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PhysicalStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("สถานภาพทางกาย");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PhysicalStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExecutiveName")
+                        .IsRequired()
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasColumnOrder(3)
+                        .HasComment("ชื่อตำแหน่งทางการบริหาร");
+
+                    b.Property("ExecutiveSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(9)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อตำแหน่ง");
+
+                    b.Property("PathSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionCategory")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(8)
+                        .HasComment("ตำแหน่งสำหรับข้าราชการหรือลูกจ้าง officer/employee");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ExecutiveSideId");
+
+                    b.HasIndex("PathSideId");
+
+                    b.HasIndex("PositionLevelId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.HasIndex("PositionTypeId");
+
+                    b.ToTable("Positions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeGroup", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อกลุ่มงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeGroups");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสายงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeLines");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeePositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อด้านของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeePositionSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสถานะของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionEmployeeStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutive", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อตำแหน่งทางการบริหารของข้อมูลตำแหน่งของข้าราชการ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionExecutives");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อด้านทางการบริหาร");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionExecutiveSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(4)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Level")
+                        .HasColumnType("int")
+                        .HasColumnOrder(3)
+                        .HasComment("ลำดับชั้นของระดับตำแหน่ง");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อระดับตำแหน่ง");
+
+                    b.Property("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อย่อระดับตำแหน่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLine", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสายงานของข้อมูลตำแหน่งของข้าราชการ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionLines");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPath", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสายงาน");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionPaths");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPathSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อด้าน/สาขา");
+
+                    b.Property("Note")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("หมายเหตุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionPathSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อสถานะของตำแหน่งของข้อมูลตำแหน่งของข้าราชการ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionStatuss");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทตำแหน่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PositionTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Prefix", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasColumnOrder(2)
+                        .HasComment("รายละเอียดคำนำหน้า");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Prefixes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("varchar(150)")
+                        .HasColumnOrder(1)
+                        .HasComment("จังหวัด");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Provinces");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Relationship", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("varchar(50)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อความสัมพันธ์");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Relationships");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Religion", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ศาสนา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Religions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Royal", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทข้อมูลเหรียญตรา");
+
+                    b.Property("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อย่อเหรียญตรา");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Royals");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalHierarchy", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อลำดับชั้นข้อมูลเครื่องราชฯ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("RoyalHierarchys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(2)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasColumnOrder(1)
+                        .HasComment("ชื่อประเภทข้อมูลเครื่องราชฯ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("RoyalTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("varchar(150)")
+                        .HasColumnOrder(1)
+                        .HasComment("เขต/อำเภอ");
+
+                    b.Property("ZipCode")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasColumnOrder(2)
+                        .HasComment("รหัสไปรษณีย์");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("DistrictId");
+
+                    b.ToTable("SubDistricts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsSend")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ทำการส่งข้อความแล้วหรือยัง?");
+
+                    b.Property("IsSendEmail")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งอีเมลล์หรือไม่?");
+
+                    b.Property("IsSendInbox")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งไปที่กล่องข้อความหรือไม่?");
+
+                    b.Property("IsSendNotification")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งการแจ้งเตือนหรือไม่?");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MessageContent")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียดข้อความ");
+
+                    b.Property("MessagePayLoad")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("สิ่งที่แนบมาด้วย");
+
+                    b.Property("ReceiverEmailAddress")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("varchar(500)")
+                        .HasComment("อีเมล์ของผู้รับ");
+
+                    b.Property("ReceiverUserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสของผู้รับข้อความ");
+
+                    b.Property("SenderSystem")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ส่งจากระบบงาน");
+
+                    b.Property("Subject")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวเรื่อง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("MessageQueues");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Agency")
+                        .HasColumnType("longtext");
+
+                    b.Property("ConditionNote")
+                        .HasColumnType("longtext");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Department")
+                        .HasColumnType("longtext");
+
+                    b.Property("Government")
+                        .HasColumnType("longtext");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsCondition")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationAgencyId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationFaxId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationGovernmentAgencyId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationOrder")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelExternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelInternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationUserNote")
+                        .HasColumnType("longtext");
+
+                    b.Property("Pile")
+                        .HasColumnType("longtext");
+
+                    b.Property("PosNo")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionCondition")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionEmployeeLineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeePositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeeStatusId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterUserNote")
+                        .HasColumnType("longtext");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Qualification")
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationAgencyId");
+
+                    b.HasIndex("OrganizationFaxId");
+
+                    b.HasIndex("OrganizationGovernmentAgencyId");
+
+                    b.HasIndex("OrganizationLevelId");
+
+                    b.HasIndex("OrganizationOrganizationId");
+
+                    b.HasIndex("OrganizationShortNameId");
+
+                    b.HasIndex("OrganizationTelExternalId");
+
+                    b.HasIndex("OrganizationTelInternalId");
+
+                    b.HasIndex("OrganizationTypeId");
+
+                    b.HasIndex("PositionEmployeeLineId");
+
+                    b.HasIndex("PositionEmployeePositionId");
+
+                    b.HasIndex("PositionEmployeeStatusId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("OrganizationEmployees");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationEmployeeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationEmployeeId");
+
+                    b.HasIndex("PositionEmployeeLevelId");
+
+                    b.ToTable("OrganizationPositionEmployeeLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationEmployeeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionEmployeePositionSideId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationEmployeeId");
+
+                    b.HasIndex("PositionEmployeePositionSideId");
+
+                    b.ToTable("OrganizationPositionEmployeePositionSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionLevelId");
+
+                    b.HasIndex("PositionMasterId");
+
+                    b.ToTable("AvailablePositionLevels");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Agency")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(14)
+                        .HasComment("หน่วยงาน");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Department")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(16)
+                        .HasComment("ฝ่าย/ส่วน");
+
+                    b.Property("Government")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(15)
+                        .HasComment("ส่วนราชการ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationFaxId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationOrder")
+                        .HasColumnType("int")
+                        .HasColumnOrder(12)
+                        .HasComment("OrganizationOrder");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationStatusId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelExternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTelInternalId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(13)
+                        .HasComment("OrganizationUserNote");
+
+                    b.Property("ParentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Pile")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(17)
+                        .HasComment("กอง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationFaxId");
+
+                    b.HasIndex("OrganizationLevelId");
+
+                    b.HasIndex("OrganizationOrganizationId");
+
+                    b.HasIndex("OrganizationShortNameId");
+
+                    b.HasIndex("OrganizationStatusId");
+
+                    b.HasIndex("OrganizationTelExternalId");
+
+                    b.HasIndex("OrganizationTelInternalId");
+
+                    b.HasIndex("OrganizationTypeId");
+
+                    b.HasIndex("ParentId");
+
+                    b.ToTable("Organizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(3)
+                        .HasComment("Is Director");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionNumberId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(4)
+                        .HasComment("positionUserNote");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationId");
+
+                    b.HasIndex("PositionMasterId");
+
+                    b.HasIndex("PositionNumberId");
+
+                    b.ToTable("OrganizationPositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPublishHistoryEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(1)
+                        .HasComment("รายละเอียดการแก้ไข");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("ObjectValue")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(2)
+                        .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("OrganizationPublishHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(14)
+                        .HasComment("IsDirector");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("PositionCondition")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(11)
+                        .HasComment("PositionCondition");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionExecutiveSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionId")
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(2)
+                        .HasComment("PositionId");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(13)
+                        .HasComment("PositionMasterUserNote");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionStatusId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Qualification")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(15)
+                        .HasComment("คุณวุฒิ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionExecutiveId");
+
+                    b.HasIndex("PositionExecutiveSideId");
+
+                    b.HasIndex("PositionLineId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.HasIndex("PositionPathSideId");
+
+                    b.HasIndex("PositionStatusId");
+
+                    b.HasIndex("PositionTypeId");
+
+                    b.ToTable("PositionMasters");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsDirector")
+                        .HasColumnType("tinyint(1)")
+                        .HasColumnOrder(14)
+                        .HasComment("IsDirector");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Position")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(2)
+                        .HasComment("Position");
+
+                    b.Property("PositionCondition")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(11)
+                        .HasComment("PositionCondition");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(5)
+                        .HasComment("PositionExecutive");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(6)
+                        .HasComment("PositionExecutiveSide");
+
+                    b.Property("PositionExecutiveSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(12)
+                        .HasComment("PositionLevel");
+
+                    b.Property("PositionLine")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(8)
+                        .HasComment("PositionLine");
+
+                    b.Property("PositionMasterEntityId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionMasterUserNote")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(13)
+                        .HasComment("PositionMasterUserNote");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(3)
+                        .HasComment("PositionPath");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(7)
+                        .HasComment("PositionPathSide");
+
+                    b.Property("PositionPathSideObject")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionStatus")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(10)
+                        .HasComment("PositionStatus");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(4)
+                        .HasComment("PositionType");
+
+                    b.Property("Qualification")
+                        .HasColumnType("longtext")
+                        .HasColumnOrder(15)
+                        .HasComment("คุณวุฒิ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PositionMasterEntityId");
+
+                    b.ToTable("PositionMasterHistoryEntity");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .HasMaxLength(300)
+                        .HasColumnType("varchar(300)")
+                        .HasColumnOrder(2)
+                        .HasComment("ชื่อ");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationShortNameId");
+
+                    b.ToTable("PositionNumbers");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OrganizationPositionId");
+
+                    b.HasIndex("ProfileId");
+
+                    b.ToTable("ProfilePositions");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("GovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("GovernmentCodeOld")
+                        .HasColumnType("longtext");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("OrganizationOrganization")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ชื่อหน่วยงาน");
+
+                    b.Property("OrganizationOrganizationOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อหน่วยงานเดิม");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("OrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("OrganizationShortNameId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสส่วนราชการ");
+
+                    b.Property("OrganizationShortNameOld")
+                        .HasColumnType("longtext")
+                        .HasComment("รหัสส่วนราชการเดิม");
+
+                    b.Property("PositionExecutive")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งทางการบริหาร");
+
+                    b.Property("PositionExecutiveOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหารเดิม");
+
+                    b.Property("PositionExecutiveSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้านทางบริหาร");
+
+                    b.Property("PositionExecutiveSideOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางบริหารเดิม");
+
+                    b.Property("PositionLevel")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ระดับตำแหน่ง");
+
+                    b.Property("PositionLevelOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับตำแหน่งเดิม");
+
+                    b.Property("PositionNum")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionNumId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งเลขที่");
+
+                    b.Property("PositionNumOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งเลขที่เดิม");
+
+                    b.Property("PositionPath")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งในสายงาน");
+
+                    b.Property("PositionPathOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งในสายงานเดิม");
+
+                    b.Property("PositionPathSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้าน/สาขา");
+
+                    b.Property("PositionPathSideOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขาเดิม");
+
+                    b.Property("PositionType")
+                        .HasColumnType("longtext");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ประเภทตำแหน่ง");
+
+                    b.Property("PositionTypeOld")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่งเดิม");
+
+                    b.Property("ProfilePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("สังกัดที่ถือครอง");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะการเปลี่ยนแปลง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Report2s");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Detail")
+                        .HasColumnType("longtext");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Report2DetailHistories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Education")
+                        .HasColumnType("longtext")
+                        .HasComment("คุณวุฒิ");
+
+                    b.Property("FullName")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อ-สกุล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("NewGovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewOrganizationOrganization")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewOrganizationOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ชื่อหน่วยงาน กำหนดใหม่");
+
+                    b.Property("NewOrganizationShortName")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewOrganizationShortNameId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสส่วนราชการ กำหนดใหม่");
+
+                    b.Property("NewPositionExecutive")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionExecutiveId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งทางการบริหาร กำหนดใหม่");
+
+                    b.Property("NewPositionExecutiveSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionExecutiveSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้านทางบริหาร กำหนดใหม่");
+
+                    b.Property("NewPositionLevel")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionLevelId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ระดับตำแหน่ง กำหนดใหม่");
+
+                    b.Property("NewPositionNum")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionNumId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งเลขที่ กำหนดใหม่");
+
+                    b.Property("NewPositionPath")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionPathId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ตำแหน่งในสายงาน กำหนดใหม่");
+
+                    b.Property("NewPositionPathSide")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionPathSideId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ด้าน/สาขา กำหนดใหม่");
+
+                    b.Property("NewPositionType")
+                        .HasColumnType("longtext");
+
+                    b.Property("NewPositionTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("ประเภทตำแหน่ง กำหนดใหม่");
+
+                    b.Property("OldGovernmentCode")
+                        .HasColumnType("longtext");
+
+                    b.Property("OldOrganizationOrganization")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อหน่วยงาน กำหนดเดิม");
+
+                    b.Property("OldOrganizationShortName")
+                        .HasColumnType("longtext")
+                        .HasComment("รหัสส่วนราชการ กำหนดเดิม");
+
+                    b.Property("OldPositionExecutive")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งทางการบริหาร กำหนดเดิม");
+
+                    b.Property("OldPositionExecutiveSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้านทางบริหาร กำหนดเดิม");
+
+                    b.Property("OldPositionLevel")
+                        .HasColumnType("longtext")
+                        .HasComment("ระดับตำแหน่ง กำหนดเดิม");
+
+                    b.Property("OldPositionNum")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งเลขที่ กำหนดเดิม");
+
+                    b.Property("OldPositionPath")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งในสายงาน กำหนดเดิม");
+
+                    b.Property("OldPositionPathSide")
+                        .HasColumnType("longtext")
+                        .HasComment("ด้าน/สาขา กำหนดเดิม");
+
+                    b.Property("OldPositionType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทตำแหน่ง กำหนดเดิม");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ProfilePositionId")
+                        .HasColumnType("char(36)")
+                        .HasComment("สังกัดที่ถือครอง");
+
+                    b.Property("Report2DetailHistoryId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Salary")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("SalaryMonth")
+                        .HasColumnType("double")
+                        .HasComment("เงินตอบแทนรายเดือน");
+
+                    b.Property("SalaryPosition")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("Status")
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะการเปลี่ยนแปลง");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("Report2DetailHistoryId");
+
+                    b.ToTable("Report2Histories");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สิ้นสุดบัญชี");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("รอบการสอบ");
+
+                    b.Property("Number")
+                        .HasMaxLength(10)
+                        .HasColumnType("int")
+                        .HasComment("จำนวนผู้สอบได้");
+
+                    b.Property("PlacementTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Round")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ครั้งที่");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่เริ่มบัญชีบัญชี");
+
+                    b.Property("Year")
+                        .HasMaxLength(5)
+                        .HasColumnType("int")
+                        .HasComment("ปีงบประมาณ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PlacementTypeId");
+
+                    b.ToTable("Placements");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CertificateNo")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขที่ใบอนุญาต");
+
+                    b.Property("CertificateType")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อใบอนุญาต");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("ExpireDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่หมดอายุ");
+
+                    b.Property("IssueDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกใบอนุญาต");
+
+                    b.Property("Issuer")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หน่วยงานผู้ออกใบอนุญาต");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("PlacementProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PlacementProfileId");
+
+                    b.ToTable("PlacementCertificates");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Country")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ประเทศ");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Degree")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("วุฒิการศึกษา");
+
+                    b.Property("Duration")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ระยะเวลา");
+
+                    b.Property("DurationYear")
+                        .HasColumnType("int")
+                        .HasComment("ระยะเวลาหลักสูตร");
+
+                    b.Property("EducationLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("EndDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ถึง");
+
+                    b.Property("Field")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("สาขาวิชา/ทาง");
+
+                    b.Property("FinishDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่สำเร็จการศึกษา");
+
+                    b.Property("FundName")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ทุน");
+
+                    b.Property("Gpa")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เกรดเฉลี่ย");
+
+                    b.Property("Institute")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("สถานศึกษา");
+
+                    b.Property("IsDate")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ประเภทช่วงเวลาการศึกษา");
+
+                    b.Property("IsEducation")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("เป็นวุฒิศึกษาในตำแหน่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Other")
+                        .HasMaxLength(1000)
+                        .HasColumnType("varchar(1000)")
+                        .HasComment("ข้อมูลการติดต่อ");
+
+                    b.Property("PlacementProfileId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("StartDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ตั้งแต่");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("EducationLevelId");
+
+                    b.HasIndex("PlacementProfileId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.ToTable("PlacementEducations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementIsProperty", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อคุณสมบัติ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PlacementIsProperties");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Amount")
+                        .HasColumnType("double")
+                        .HasComment("เงินเดือน");
+
+                    b.Property("BloodGroupId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CitizenDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่ออกบัตร");
+
+                    b.Property("CitizenDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CitizenId")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("เลขประจำตัวประชาชน");
+
+                    b.Property("CitizenProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("CurrentAddress")
+                        .HasColumnType("longtext")
+                        .HasComment("ที่อยู่ปัจจุบัน");
+
+                    b.Property("CurrentDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CurrentProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CurrentSubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CurrentZipCode")
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน");
+
+                    b.Property("DateOfBirth")
+                        .HasMaxLength(40)
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันเกิด");
+
+                    b.Property("Email")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อีเมล");
+
+                    b.Property("ExamNumber")
+                        .HasColumnType("int")
+                        .HasComment("ลำดับที่สอบได้");
+
+                    b.Property("ExamRound")
+                        .HasColumnType("int")
+                        .HasComment("จำนวนครั้งที่สมัครสอบ");
+
+                    b.Property("FatherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อจริงบิดา");
+
+                    b.Property("FatherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลบิดา");
+
+                    b.Property("FatherNationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติบิดา");
+
+                    b.Property("FatherOccupation")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อาชีพบิดา");
+
+                    b.Property("FatherPrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Firstname")
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อ");
+
+                    b.Property("GenderId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("IsOfficer")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ข้าราชการฯ กทม.");
+
+                    b.Property("IsProperty")
+                        .HasColumnType("longtext")
+                        .HasComment("การคัดกรองคุณสมบัติ");
+
+                    b.Property("IsRelief")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ผ่อนผัน");
+
+                    b.Property("Knowledge")
+                        .HasColumnType("longtext")
+                        .HasComment("ความสามารถพิเศษ");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Lastname")
+                        .HasColumnType("longtext")
+                        .HasComment("นามสกุล");
+
+                    b.Property("Marry")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("คู่สมรส");
+
+                    b.Property("MarryFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อจริงคู่สมรส");
+
+                    b.Property("MarryLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลคู่สมรส");
+
+                    b.Property("MarryNationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติคู่สมรส");
+
+                    b.Property("MarryOccupation")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อาชีพคู่สมรส");
+
+                    b.Property("MarryPrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("MobilePhone")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("โทรศัพท์มือถือ");
+
+                    b.Property("MotherFirstName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ชื่อจริงมารดา");
+
+                    b.Property("MotherLastName")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("นามสกุลมารดา");
+
+                    b.Property("MotherNationality")
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สัญชาติมารดา");
+
+                    b.Property("MotherOccupation")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อาชีพมารดา");
+
+                    b.Property("MotherPrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("MouthSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินค่าตอบแทนรายเดือน");
+
+                    b.Property("Nationality")
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasComment("สัญชาติ");
+
+                    b.Property("Number")
+                        .HasColumnType("int")
+                        .HasComment("ลำดับที่สอบได้");
+
+                    b.Property("OccupationCompany")
+                        .HasColumnType("longtext")
+                        .HasComment("สำนัก/บริษัท บริษัท");
+
+                    b.Property("OccupationDepartment")
+                        .HasColumnType("longtext")
+                        .HasComment("กอง/ฝ่าย บริษัท");
+
+                    b.Property("OccupationEmail")
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("อีเมล บริษัท");
+
+                    b.Property("OccupationPosition")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งอาชีพ");
+
+                    b.Property("OccupationTelephone")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("โทรศัพท์ บริษัท");
+
+                    b.Property("OccupationType")
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทอาชีพที่ทำงานมาก่อน");
+
+                    b.Property("OrganizationPositionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Pass")
+                        .HasColumnType("longtext")
+                        .HasComment("ผลสมัครสอบ");
+
+                    b.Property("PlacementId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PlacementStatus")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("สถานะการบรรจุ");
+
+                    b.Property("PointA")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนภาค ก");
+
+                    b.Property("PointB")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนภาค ข");
+
+                    b.Property("PointC")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนภาค ค");
+
+                    b.Property("PointTotalA")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนเต็มภาค ก");
+
+                    b.Property("PointTotalB")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนเต็มภาค ข");
+
+                    b.Property("PointTotalC")
+                        .HasColumnType("double")
+                        .HasComment("คะแนนเต็มภาค ค");
+
+                    b.Property("PositionLevelId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionLineId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionNumberId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionPathSideId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PositionSalaryAmount")
+                        .HasColumnType("double")
+                        .HasComment("เงินประจำตำแหน่ง");
+
+                    b.Property("PositionTypeId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("PrefixId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("Race")
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasComment("เชื้อชาติ");
+
+                    b.Property("RecruitDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่บรรจุ");
+
+                    b.Property("RegistAddress")
+                        .HasColumnType("longtext")
+                        .HasComment("ที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RegistDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistProvinceId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistSame")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RegistSubDistrictId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("RegistZipCode")
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน");
+
+                    b.Property("RejectReason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผลสละสิทธิ์");
+
+                    b.Property("RelationshipId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReliefDocId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReliefReason")
+                        .HasColumnType("longtext")
+                        .HasComment("เหตุผลผ่อนผัน");
+
+                    b.Property("ReligionId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("ReportingDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("วันที่รายงานตัว");
+
+                    b.Property("SalaryClass")
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่ง (รายละเอียด)");
+
+                    b.Property("SalaryRef")
+                        .HasColumnType("longtext")
+                        .HasComment("เอกสารอ้างอิง");
+
+                    b.Property("Telephone")
+                        .HasMaxLength(20)
+                        .HasColumnType("varchar(20)")
+                        .HasComment("โทรศัพท์");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("BloodGroupId");
+
+                    b.HasIndex("CitizenDistrictId");
+
+                    b.HasIndex("CitizenProvinceId");
+
+                    b.HasIndex("CurrentDistrictId");
+
+                    b.HasIndex("CurrentProvinceId");
+
+                    b.HasIndex("CurrentSubDistrictId");
+
+                    b.HasIndex("FatherPrefixId");
+
+                    b.HasIndex("GenderId");
+
+                    b.HasIndex("MarryPrefixId");
+
+                    b.HasIndex("MotherPrefixId");
+
+                    b.HasIndex("OrganizationPositionId");
+
+                    b.HasIndex("PlacementId");
+
+                    b.HasIndex("PositionLevelId");
+
+                    b.HasIndex("PositionLineId");
+
+                    b.HasIndex("PositionNumberId");
+
+                    b.HasIndex("PositionPathId");
+
+                    b.HasIndex("PositionPathSideId");
+
+                    b.HasIndex("PositionTypeId");
+
+                    b.HasIndex("PrefixId");
+
+                    b.HasIndex("RegistDistrictId");
+
+                    b.HasIndex("RegistProvinceId");
+
+                    b.HasIndex("RegistSubDistrictId");
+
+                    b.HasIndex("RelationshipId");
+
+                    b.HasIndex("ReliefDocId");
+
+                    b.HasIndex("ReligionId");
+
+                    b.ToTable("PlacementProfiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsActive")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("สถานะการใช้งาน");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อประเภทบรรจุ");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("PlacementTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b =>
+                {
+                    b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.Command");
+
+                    b.Property("ConclusionRegisterDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
+
+                    b.Property("ConclusionRegisterNo")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
+
+                    b.Property("ConclusionResultDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+                    b.Property("ConclusionResultNo")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+                    b.Property("ExamRoundId")
+                        .HasColumnType("char(36)")
+                        .HasComment("อ้างอิงรอบการสอบ");
+
+                    b.Property("PositionName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งที่บรรจุ");
+
+                    b.HasDiscriminator().HasValue("PlacementCommand");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus")
+                        .WithMany()
+                        .HasForeignKey("CommandStatusId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandType", "CommandType")
+                        .WithMany()
+                        .HasForeignKey("CommandTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("CommandStatus");
+
+                    b.Navigation("CommandType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command")
+                        .WithMany("Documents")
+                        .HasForeignKey("CommandId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Command");
+
+                    b.Navigation("Document");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
+                        .WithMany("LimitTypeLeaves")
+                        .HasForeignKey("LimitLeaveId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
+                        .WithMany("LimitTypeLeaves")
+                        .HasForeignKey("TypeLeaveId");
+
+                    b.Navigation("LimitLeave");
+
+                    b.Navigation("TypeLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Avatar")
+                        .WithMany()
+                        .HasForeignKey("AvatarId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
+                        .WithMany("Profiles")
+                        .HasForeignKey("LimitLeaveId");
+
+                    b.Navigation("Avatar");
+
+                    b.Navigation("LimitLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Abilitys")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAbility", "ProfileAbility")
+                        .WithMany("ProfileAbilityHistorys")
+                        .HasForeignKey("ProfileAbilityId");
+
+                    b.Navigation("ProfileAbility");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("AddressHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Assessments")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAssessment", "ProfileAssessment")
+                        .WithMany("ProfileAssessmentHistorys")
+                        .HasForeignKey("ProfileAssessmentId");
+
+                    b.Navigation("ProfileAssessment");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "AvatarFile")
+                        .WithMany()
+                        .HasForeignKey("AvatarFileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("AvatarHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AvatarFile");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Certificates")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileCertificate", "ProfileCertificate")
+                        .WithMany("ProfileCertificateHistorys")
+                        .HasForeignKey("ProfileCertificateId");
+
+                    b.Navigation("ProfileCertificate");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("ChangeNames")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Document");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChangeName", "ProfileChangeName")
+                        .WithMany("ProfileChangeNameHistorys")
+                        .HasForeignKey("ProfileChangeNameId");
+
+                    b.Navigation("Document");
+
+                    b.Navigation("ProfileChangeName");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Childrens")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChildren", null)
+                        .WithMany("ProfileChildrenHistorys")
+                        .HasForeignKey("ProfileChildrenId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", null)
+                        .WithMany("Childrens")
+                        .HasForeignKey("ProfileFamilyHistoryId");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("CoupleHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("CurrentAddressHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Disciplines")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDiscipline", "ProfileDiscipline")
+                        .WithMany("ProfileDisciplineHistorys")
+                        .HasForeignKey("ProfileDisciplineId");
+
+                    b.Navigation("ProfileDiscipline");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Dutys")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDuty", "ProfileDuty")
+                        .WithMany("ProfileDutyHistorys")
+                        .HasForeignKey("ProfileDutyId");
+
+                    b.Navigation("ProfileDuty");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Educations")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileEducation", "ProfileEducation")
+                        .WithMany("ProfileEducationHistorys")
+                        .HasForeignKey("ProfileEducationId");
+
+                    b.Navigation("ProfileEducation");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("FamilyHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("FatherHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("GovernmentHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("ProfileHistory")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Honors")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileHonor", "ProfileHonor")
+                        .WithMany("ProfileHonorHistorys")
+                        .HasForeignKey("ProfileHonorId");
+
+                    b.Navigation("ProfileHonor");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Insignias")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileInsignia", "ProfileInsignia")
+                        .WithMany("ProfileInsigniaHistorys")
+                        .HasForeignKey("ProfileInsigniaId");
+
+                    b.Navigation("ProfileInsignia");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Leaves")
+                        .HasForeignKey("ProfileId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
+                        .WithMany()
+                        .HasForeignKey("TypeLeaveId");
+
+                    b.Navigation("Profile");
+
+                    b.Navigation("TypeLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileLeave", "ProfileLeave")
+                        .WithMany("ProfileLeaveHistorys")
+                        .HasForeignKey("ProfileLeaveId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
+                        .WithMany()
+                        .HasForeignKey("TypeLeaveId");
+
+                    b.Navigation("ProfileLeave");
+
+                    b.Navigation("TypeLeave");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("MotherHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Nopaids")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileNopaid", "ProfileNopaid")
+                        .WithMany("ProfileNopaidHistorys")
+                        .HasForeignKey("ProfileNopaidId");
+
+                    b.Navigation("ProfileNopaid");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Others")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileOther", "ProfileOther")
+                        .WithMany("ProfileOtherHistorys")
+                        .HasForeignKey("ProfileOtherId");
+
+                    b.Navigation("ProfileOther");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Papers")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Document");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("RegistrationAddressHistory")
+                        .HasForeignKey("ProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Salaries")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileSalary", "ProfileSalary")
+                        .WithMany("ProfileSalaryHistorys")
+                        .HasForeignKey("ProfileSalaryId");
+
+                    b.Navigation("ProfileSalary");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Position", "Position")
+                        .WithMany()
+                        .HasForeignKey("PositionId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Position");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany("Trainings")
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.HR.ProfileTraining", "ProfileTraining")
+                        .WithMany("ProfileTrainingHistorys")
+                        .HasForeignKey("ProfileTrainingId");
+
+                    b.Navigation("ProfileTraining");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "Province")
+                        .WithMany("Districts")
+                        .HasForeignKey("ProvinceId");
+
+                    b.Navigation("Province");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.InsigniaType", "InsigniaType")
+                        .WithMany()
+                        .HasForeignKey("InsigniaTypeId");
+
+                    b.Navigation("InsigniaType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "ExecutiveSide")
+                        .WithMany()
+                        .HasForeignKey("ExecutiveSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PathSide")
+                        .WithMany()
+                        .HasForeignKey("PathSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
+                        .WithMany()
+                        .HasForeignKey("PositionTypeId");
+
+                    b.Navigation("ExecutiveSide");
+
+                    b.Navigation("PathSide");
+
+                    b.Navigation("PositionLevel");
+
+                    b.Navigation("PositionPath");
+
+                    b.Navigation("PositionType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "District")
+                        .WithMany("SubDistricts")
+                        .HasForeignKey("DistrictId");
+
+                    b.Navigation("District");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationAgency")
+                        .WithMany()
+                        .HasForeignKey("OrganizationAgencyId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax")
+                        .WithMany()
+                        .HasForeignKey("OrganizationFaxId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationGovernmentAgency")
+                        .WithMany()
+                        .HasForeignKey("OrganizationGovernmentAgencyId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
+                        .WithMany()
+                        .HasForeignKey("OrganizationLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
+                        .WithMany()
+                        .HasForeignKey("OrganizationOrganizationId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
+                        .WithMany()
+                        .HasForeignKey("OrganizationShortNameId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelExternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelInternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTypeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", "PositionEmployeeLine")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeeLineId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", "PositionEmployeePosition")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeePositionId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", "PositionEmployeeStatus")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeeStatusId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany()
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("OrganizationAgency");
+
+                    b.Navigation("OrganizationFax");
+
+                    b.Navigation("OrganizationGovernmentAgency");
+
+                    b.Navigation("OrganizationLevel");
+
+                    b.Navigation("OrganizationOrganization");
+
+                    b.Navigation("OrganizationShortName");
+
+                    b.Navigation("OrganizationTelExternal");
+
+                    b.Navigation("OrganizationTelInternal");
+
+                    b.Navigation("OrganizationType");
+
+                    b.Navigation("PositionEmployeeLine");
+
+                    b.Navigation("PositionEmployeePosition");
+
+                    b.Navigation("PositionEmployeeStatus");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
+                        .WithMany("OrganizationPositionEmployeeLevels")
+                        .HasForeignKey("OrganizationEmployeeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", "PositionEmployeeLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeeLevelId");
+
+                    b.Navigation("OrganizationEmployee");
+
+                    b.Navigation("PositionEmployeeLevel");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
+                        .WithMany("OrganizationPositionEmployeePositionSides")
+                        .HasForeignKey("OrganizationEmployeeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", "PositionEmployeePositionSide")
+                        .WithMany()
+                        .HasForeignKey("PositionEmployeePositionSideId");
+
+                    b.Navigation("OrganizationEmployee");
+
+                    b.Navigation("PositionEmployeePositionSide");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster")
+                        .WithMany()
+                        .HasForeignKey("PositionMasterId");
+
+                    b.Navigation("PositionLevel");
+
+                    b.Navigation("PositionMaster");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax")
+                        .WithMany()
+                        .HasForeignKey("OrganizationFaxId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
+                        .WithMany()
+                        .HasForeignKey("OrganizationLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
+                        .WithMany()
+                        .HasForeignKey("OrganizationOrganizationId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
+                        .WithMany()
+                        .HasForeignKey("OrganizationShortNameId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", "OrganizationStatus")
+                        .WithMany()
+                        .HasForeignKey("OrganizationStatusId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelExternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTelInternalId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType")
+                        .WithMany()
+                        .HasForeignKey("OrganizationTypeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Parent")
+                        .WithMany("Organizations")
+                        .HasForeignKey("ParentId");
+
+                    b.Navigation("OrganizationFax");
+
+                    b.Navigation("OrganizationLevel");
+
+                    b.Navigation("OrganizationOrganization");
+
+                    b.Navigation("OrganizationShortName");
+
+                    b.Navigation("OrganizationStatus");
+
+                    b.Navigation("OrganizationTelExternal");
+
+                    b.Navigation("OrganizationTelInternal");
+
+                    b.Navigation("OrganizationType");
+
+                    b.Navigation("Parent");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization")
+                        .WithMany()
+                        .HasForeignKey("OrganizationId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster")
+                        .WithMany()
+                        .HasForeignKey("PositionMasterId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
+                        .WithMany()
+                        .HasForeignKey("PositionNumberId");
+
+                    b.Navigation("Organization");
+
+                    b.Navigation("PositionMaster");
+
+                    b.Navigation("PositionNumber");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutive", "PositionExecutive")
+                        .WithMany()
+                        .HasForeignKey("PositionExecutiveId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "PositionExecutiveSide")
+                        .WithMany()
+                        .HasForeignKey("PositionExecutiveSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
+                        .WithMany()
+                        .HasForeignKey("PositionLineId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
+                        .WithMany()
+                        .HasForeignKey("PositionPathSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionStatus", "PositionStatus")
+                        .WithMany()
+                        .HasForeignKey("PositionStatusId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
+                        .WithMany()
+                        .HasForeignKey("PositionTypeId");
+
+                    b.Navigation("PositionExecutive");
+
+                    b.Navigation("PositionExecutiveSide");
+
+                    b.Navigation("PositionLine");
+
+                    b.Navigation("PositionPath");
+
+                    b.Navigation("PositionPathSide");
+
+                    b.Navigation("PositionStatus");
+
+                    b.Navigation("PositionType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMasterEntity")
+                        .WithMany("PositionMasterHistorys")
+                        .HasForeignKey("PositionMasterEntityId");
+
+                    b.Navigation("PositionMasterEntity");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
+                        .WithMany()
+                        .HasForeignKey("OrganizationShortNameId");
+
+                    b.Navigation("OrganizationShortName");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
+                        .WithMany()
+                        .HasForeignKey("OrganizationPositionId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
+                        .WithMany()
+                        .HasForeignKey("ProfileId");
+
+                    b.Navigation("OrganizationPosition");
+
+                    b.Navigation("Profile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", "Report2DetailHistory")
+                        .WithMany()
+                        .HasForeignKey("Report2DetailHistoryId");
+
+                    b.Navigation("Report2DetailHistory");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementType", "PlacementType")
+                        .WithMany()
+                        .HasForeignKey("PlacementTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("PlacementType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
+                        .WithMany("PlacementCertificates")
+                        .HasForeignKey("PlacementProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("PlacementProfile");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.EducationLevel", "EducationLevel")
+                        .WithMany()
+                        .HasForeignKey("EducationLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
+                        .WithMany("PlacementEducations")
+                        .HasForeignKey("PlacementProfileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.Navigation("EducationLevel");
+
+                    b.Navigation("PlacementProfile");
+
+                    b.Navigation("PositionPath");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup")
+                        .WithMany()
+                        .HasForeignKey("BloodGroupId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CitizenDistrict")
+                        .WithMany()
+                        .HasForeignKey("CitizenDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CitizenProvince")
+                        .WithMany()
+                        .HasForeignKey("CitizenProvinceId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CurrentDistrict")
+                        .WithMany()
+                        .HasForeignKey("CurrentDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CurrentProvince")
+                        .WithMany()
+                        .HasForeignKey("CurrentProvinceId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "CurrentSubDistrict")
+                        .WithMany()
+                        .HasForeignKey("CurrentSubDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "FatherPrefix")
+                        .WithMany()
+                        .HasForeignKey("FatherPrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender")
+                        .WithMany()
+                        .HasForeignKey("GenderId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MarryPrefix")
+                        .WithMany()
+                        .HasForeignKey("MarryPrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MotherPrefix")
+                        .WithMany()
+                        .HasForeignKey("MotherPrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
+                        .WithMany()
+                        .HasForeignKey("OrganizationPositionId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
+                        .WithMany("PlacementProfiles")
+                        .HasForeignKey("PlacementId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
+                        .WithMany()
+                        .HasForeignKey("PositionLevelId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
+                        .WithMany()
+                        .HasForeignKey("PositionLineId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
+                        .WithMany()
+                        .HasForeignKey("PositionNumberId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
+                        .WithMany()
+                        .HasForeignKey("PositionPathId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
+                        .WithMany()
+                        .HasForeignKey("PositionPathSideId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
+                        .WithMany()
+                        .HasForeignKey("PositionTypeId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "Prefix")
+                        .WithMany()
+                        .HasForeignKey("PrefixId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict")
+                        .WithMany()
+                        .HasForeignKey("RegistDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "RegistProvince")
+                        .WithMany()
+                        .HasForeignKey("RegistProvinceId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "RegistSubDistrict")
+                        .WithMany()
+                        .HasForeignKey("RegistSubDistrictId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
+                        .WithMany()
+                        .HasForeignKey("RelationshipId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ReliefDoc")
+                        .WithMany()
+                        .HasForeignKey("ReliefDocId");
+
+                    b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion")
+                        .WithMany()
+                        .HasForeignKey("ReligionId");
+
+                    b.Navigation("BloodGroup");
+
+                    b.Navigation("CitizenDistrict");
+
+                    b.Navigation("CitizenProvince");
+
+                    b.Navigation("CurrentDistrict");
+
+                    b.Navigation("CurrentProvince");
+
+                    b.Navigation("CurrentSubDistrict");
+
+                    b.Navigation("FatherPrefix");
+
+                    b.Navigation("Gender");
+
+                    b.Navigation("MarryPrefix");
+
+                    b.Navigation("MotherPrefix");
+
+                    b.Navigation("OrganizationPosition");
+
+                    b.Navigation("Placement");
+
+                    b.Navigation("PositionLevel");
+
+                    b.Navigation("PositionLine");
+
+                    b.Navigation("PositionNumber");
+
+                    b.Navigation("PositionPath");
+
+                    b.Navigation("PositionPathSide");
+
+                    b.Navigation("PositionType");
+
+                    b.Navigation("Prefix");
+
+                    b.Navigation("RegistDistrict");
+
+                    b.Navigation("RegistProvince");
+
+                    b.Navigation("RegistSubDistrict");
+
+                    b.Navigation("Relationship");
+
+                    b.Navigation("ReliefDoc");
+
+                    b.Navigation("Religion");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+                {
+                    b.Navigation("Documents");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
+                {
+                    b.Navigation("LimitTypeLeaves");
+
+                    b.Navigation("Profiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+                {
+                    b.Navigation("Abilitys");
+
+                    b.Navigation("AddressHistory");
+
+                    b.Navigation("Assessments");
+
+                    b.Navigation("AvatarHistory");
+
+                    b.Navigation("Certificates");
+
+                    b.Navigation("ChangeNames");
+
+                    b.Navigation("Childrens");
+
+                    b.Navigation("CoupleHistory");
+
+                    b.Navigation("CurrentAddressHistory");
+
+                    b.Navigation("Disciplines");
+
+                    b.Navigation("Dutys");
+
+                    b.Navigation("Educations");
+
+                    b.Navigation("FamilyHistory");
+
+                    b.Navigation("FatherHistory");
+
+                    b.Navigation("GovernmentHistory");
+
+                    b.Navigation("Honors");
+
+                    b.Navigation("Insignias");
+
+                    b.Navigation("Leaves");
+
+                    b.Navigation("MotherHistory");
+
+                    b.Navigation("Nopaids");
+
+                    b.Navigation("Others");
+
+                    b.Navigation("Papers");
+
+                    b.Navigation("ProfileHistory");
+
+                    b.Navigation("RegistrationAddressHistory");
+
+                    b.Navigation("Salaries");
+
+                    b.Navigation("Trainings");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
+                {
+                    b.Navigation("ProfileAbilityHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b =>
+                {
+                    b.Navigation("ProfileAssessmentHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b =>
+                {
+                    b.Navigation("ProfileCertificateHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b =>
+                {
+                    b.Navigation("ProfileChangeNameHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b =>
+                {
+                    b.Navigation("ProfileChildrenHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b =>
+                {
+                    b.Navigation("ProfileDisciplineHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b =>
+                {
+                    b.Navigation("ProfileDutyHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b =>
+                {
+                    b.Navigation("ProfileEducationHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b =>
+                {
+                    b.Navigation("Childrens");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b =>
+                {
+                    b.Navigation("ProfileHonorHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
+                {
+                    b.Navigation("ProfileInsigniaHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
+                {
+                    b.Navigation("ProfileLeaveHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b =>
+                {
+                    b.Navigation("ProfileNopaidHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b =>
+                {
+                    b.Navigation("ProfileOtherHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
+                {
+                    b.Navigation("ProfileSalaryHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b =>
+                {
+                    b.Navigation("ProfileTrainingHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b =>
+                {
+                    b.Navigation("LimitTypeLeaves");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b =>
+                {
+                    b.Navigation("SubDistricts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b =>
+                {
+                    b.Navigation("Districts");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
+                {
+                    b.Navigation("OrganizationPositionEmployeeLevels");
+
+                    b.Navigation("OrganizationPositionEmployeePositionSides");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
+                {
+                    b.Navigation("Organizations");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
+                {
+                    b.Navigation("PositionMasterHistorys");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
+                {
+                    b.Navigation("PlacementProfiles");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
+                {
+                    b.Navigation("PlacementCertificates");
+
+                    b.Navigation("PlacementEducations");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}
diff --git a/BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.cs b/BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.cs
new file mode 100644
index 00000000..4772baf4
--- /dev/null
+++ b/BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.cs	
@@ -0,0 +1,136 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace BMA.EHR.Infrastructure.Migrations
+{
+    /// 
+    public partial class ChangeBaseCommandTableName : Migration
+    {
+        /// 
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropForeignKey(
+                name: "FK_BaseCommand_CommandStatuses_CommandStatusId",
+                table: "BaseCommand");
+
+            migrationBuilder.DropForeignKey(
+                name: "FK_BaseCommand_CommandTypes_CommandTypeId",
+                table: "BaseCommand");
+
+            migrationBuilder.DropForeignKey(
+                name: "FK_CommandDocuments_BaseCommand_CommandId",
+                table: "CommandDocuments");
+
+            migrationBuilder.DropPrimaryKey(
+                name: "PK_BaseCommand",
+                table: "BaseCommand");
+
+            migrationBuilder.RenameTable(
+                name: "BaseCommand",
+                newName: "Command");
+
+            migrationBuilder.RenameIndex(
+                name: "IX_BaseCommand_CommandTypeId",
+                table: "Command",
+                newName: "IX_Command_CommandTypeId");
+
+            migrationBuilder.RenameIndex(
+                name: "IX_BaseCommand_CommandStatusId",
+                table: "Command",
+                newName: "IX_Command_CommandStatusId");
+
+            migrationBuilder.AddPrimaryKey(
+                name: "PK_Command",
+                table: "Command",
+                column: "Id");
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_Command_CommandStatuses_CommandStatusId",
+                table: "Command",
+                column: "CommandStatusId",
+                principalTable: "CommandStatuses",
+                principalColumn: "Id",
+                onDelete: ReferentialAction.Cascade);
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_Command_CommandTypes_CommandTypeId",
+                table: "Command",
+                column: "CommandTypeId",
+                principalTable: "CommandTypes",
+                principalColumn: "Id",
+                onDelete: ReferentialAction.Cascade);
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_CommandDocuments_Command_CommandId",
+                table: "CommandDocuments",
+                column: "CommandId",
+                principalTable: "Command",
+                principalColumn: "Id",
+                onDelete: ReferentialAction.Cascade);
+        }
+
+        /// 
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropForeignKey(
+                name: "FK_Command_CommandStatuses_CommandStatusId",
+                table: "Command");
+
+            migrationBuilder.DropForeignKey(
+                name: "FK_Command_CommandTypes_CommandTypeId",
+                table: "Command");
+
+            migrationBuilder.DropForeignKey(
+                name: "FK_CommandDocuments_Command_CommandId",
+                table: "CommandDocuments");
+
+            migrationBuilder.DropPrimaryKey(
+                name: "PK_Command",
+                table: "Command");
+
+            migrationBuilder.RenameTable(
+                name: "Command",
+                newName: "BaseCommand");
+
+            migrationBuilder.RenameIndex(
+                name: "IX_Command_CommandTypeId",
+                table: "BaseCommand",
+                newName: "IX_BaseCommand_CommandTypeId");
+
+            migrationBuilder.RenameIndex(
+                name: "IX_Command_CommandStatusId",
+                table: "BaseCommand",
+                newName: "IX_BaseCommand_CommandStatusId");
+
+            migrationBuilder.AddPrimaryKey(
+                name: "PK_BaseCommand",
+                table: "BaseCommand",
+                column: "Id");
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_BaseCommand_CommandStatuses_CommandStatusId",
+                table: "BaseCommand",
+                column: "CommandStatusId",
+                principalTable: "CommandStatuses",
+                principalColumn: "Id",
+                onDelete: ReferentialAction.Cascade);
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_BaseCommand_CommandTypes_CommandTypeId",
+                table: "BaseCommand",
+                column: "CommandTypeId",
+                principalTable: "CommandTypes",
+                principalColumn: "Id",
+                onDelete: ReferentialAction.Cascade);
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_CommandDocuments_BaseCommand_CommandId",
+                table: "CommandDocuments",
+                column: "CommandId",
+                principalTable: "BaseCommand",
+                principalColumn: "Id",
+                onDelete: ReferentialAction.Cascade);
+        }
+    }
+}
diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs
index 6f2c9454..28df20e8 100644
--- a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs
+++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs
@@ -16,10 +16,301 @@ namespace BMA.EHR.Infrastructure.Migrations
         {
 #pragma warning disable 612, 618
             modelBuilder
-                .HasAnnotation("ProductVersion", "7.0.8")
+                .HasAnnotation("ProductVersion", "7.0.9")
                 .HasAnnotation("Relational:MaxIdentifierLength", 64);
 
-            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.DeploymentChannel", b =>
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("AuthorizedUserFullName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ชื่อผู้มีอำนาจลงนาม");
+
+                    b.Property("AuthorizedUserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
+
+                    b.Property("CommandNo")
+                        .IsRequired()
+                        .HasMaxLength(10)
+                        .HasColumnType("varchar(10)")
+                        .HasComment("เลขที่คำสั่ง");
+
+                    b.Property("CommandStatusId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงสถานะคำสั่ง");
+
+                    b.Property("CommandTypeId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงประเภทคำสั่ง");
+
+                    b.Property("CommandYear")
+                        .IsRequired()
+                        .HasMaxLength(4)
+                        .HasColumnType("varchar(4)")
+                        .HasComment("ปีที่ออกคำสั่ง");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("Discriminator")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property("IssuerOrganizationId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง");
+
+                    b.Property("IssuerOrganizationName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("หน่วยงานที่ออกคำสั่ง");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CommandStatusId");
+
+                    b.HasIndex("CommandTypeId");
+
+                    b.ToTable("Command");
+
+                    b.HasDiscriminator("Discriminator").HasValue("Command");
+
+                    b.UseTphMappingStrategy();
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ประเภทเอกสาร");
+
+                    b.Property("CommandId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("DocumentId")
+                        .HasColumnType("char(36)");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CommandId");
+
+                    b.HasIndex("DocumentId");
+
+                    b.ToTable("CommandDocuments");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("สถานะของคำสั่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CommandStatuses");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("Category")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("varchar(100)")
+                        .HasComment("ประเภทคำสั่ง");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("Name")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ชื่อคำสั่ง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("CommandTypes");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b =>
                 {
                     b.Property("Id")
                         .ValueGeneratedOnAdd()
@@ -7326,6 +7617,106 @@ namespace BMA.EHR.Infrastructure.Migrations
                     b.ToTable("SubDistricts");
                 });
 
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
+                {
+                    b.Property("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("char(36)")
+                        .HasColumnOrder(0)
+                        .HasComment("PrimaryKey")
+                        .HasAnnotation("Relational:JsonPropertyName", "id");
+
+                    b.Property("CreatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(100)
+                        .HasComment("สร้างข้อมูลเมื่อ");
+
+                    b.Property("CreatedFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(104)
+                        .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+                    b.Property("CreatedUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(101)
+                        .HasComment("User Id ที่สร้างข้อมูล");
+
+                    b.Property("IsSend")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ทำการส่งข้อความแล้วหรือยัง?");
+
+                    b.Property("IsSendEmail")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งอีเมลล์หรือไม่?");
+
+                    b.Property("IsSendInbox")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งไปที่กล่องข้อความหรือไม่?");
+
+                    b.Property("IsSendNotification")
+                        .HasColumnType("tinyint(1)")
+                        .HasComment("ส่งการแจ้งเตือนหรือไม่?");
+
+                    b.Property("LastUpdateFullName")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasColumnOrder(105)
+                        .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdateUserId")
+                        .IsRequired()
+                        .HasMaxLength(40)
+                        .HasColumnType("varchar(40)")
+                        .HasColumnOrder(103)
+                        .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+                    b.Property("LastUpdatedAt")
+                        .HasColumnType("datetime(6)")
+                        .HasColumnOrder(102)
+                        .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+                    b.Property("MessageContent")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("รายละเอียดข้อความ");
+
+                    b.Property("MessagePayLoad")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("สิ่งที่แนบมาด้วย");
+
+                    b.Property("ReceiverEmailAddress")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("varchar(500)")
+                        .HasComment("อีเมล์ของผู้รับ");
+
+                    b.Property("ReceiverUserId")
+                        .HasColumnType("char(36)")
+                        .HasComment("รหัสของผู้รับข้อความ");
+
+                    b.Property("SenderSystem")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("ส่งจากระบบงาน");
+
+                    b.Property("Subject")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("varchar(200)")
+                        .HasComment("หัวเรื่อง");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("MessageQueues");
+                });
+
             modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
                 {
                     b.Property("Id")
@@ -7485,7 +7876,7 @@ namespace BMA.EHR.Infrastructure.Migrations
                     b.ToTable("OrganizationEmployees");
                 });
 
-            modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
+            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
                 {
                     b.Property("Id")
                         .ValueGeneratedOnAdd()
@@ -7532,85 +7923,21 @@ namespace BMA.EHR.Infrastructure.Migrations
                         .HasColumnOrder(102)
                         .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
 
-                    b.Property("IsSend")
-                        .HasColumnType("tinyint(1)")
-                        .HasComment("ทำการส่งข้อความแล้วหรือยัง?");
+                    b.Property("OrganizationEmployeeId")
+                        .HasColumnType("char(36)");
 
-                    b.Property("IsSendEmail")
-                        .HasColumnType("tinyint(1)")
-                        .HasComment("ส่งอีเมลล์หรือไม่?");
+                    b.Property("PositionEmployeeLevelId")
+                        .HasColumnType("char(36)");
 
-                    b.Property("IsSendInbox")
-                        .HasColumnType("tinyint(1)")
-                        .HasComment("ส่งไปที่กล่องข้อความหรือไม่?");
+                    b.HasKey("Id");
 
-                    b.Property("IsSendNotification")
-                        .HasColumnType("tinyint(1)")
-                        .HasComment("ส่งการแจ้งเตือนหรือไม่?");
+                    b.HasIndex("OrganizationEmployeeId");
+
+                    b.HasIndex("PositionEmployeeLevelId");
+
+                    b.ToTable("OrganizationPositionEmployeeLevels");
                 });
 
-            modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
-            {
-                b.Property("Id")
-                    .ValueGeneratedOnAdd()
-                    .HasColumnType("char(36)")
-                    .HasColumnOrder(0)
-                    .HasComment("PrimaryKey")
-                    .HasAnnotation("Relational:JsonPropertyName", "id");
-
-                b.Property("CreatedAt")
-                    .HasColumnType("datetime(6)")
-                    .HasColumnOrder(100)
-                    .HasComment("สร้างข้อมูลเมื่อ");
-
-                b.Property("CreatedFullName")
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasColumnType("varchar(200)")
-                    .HasColumnOrder(104)
-                    .HasComment("ชื่อ User ที่สร้างข้อมูล");
-
-                b.Property("CreatedUserId")
-                    .IsRequired()
-                    .HasMaxLength(40)
-                    .HasColumnType("varchar(40)")
-                    .HasColumnOrder(101)
-                    .HasComment("User Id ที่สร้างข้อมูล");
-
-                b.Property("LastUpdateFullName")
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasColumnType("varchar(200)")
-                    .HasColumnOrder(105)
-                    .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
-
-                b.Property("LastUpdateUserId")
-                    .IsRequired()
-                    .HasMaxLength(40)
-                    .HasColumnType("varchar(40)")
-                    .HasColumnOrder(103)
-                    .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
-
-                b.Property("LastUpdatedAt")
-                    .HasColumnType("datetime(6)")
-                    .HasColumnOrder(102)
-                    .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
-
-                b.Property("OrganizationEmployeeId")
-            .HasColumnType("char(36)");
-
-                b.Property("PositionEmployeeLevelId")
-            .HasColumnType("char(36)");
-
-                b.HasKey("Id");
-
-                b.HasIndex("OrganizationEmployeeId");
-
-                b.HasIndex("PositionEmployeeLevelId");
-
-                b.ToTable("OrganizationPositionEmployeeLevels");
-            });
-
             modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
                 {
                     b.Property("Id")
@@ -7671,41 +7998,6 @@ namespace BMA.EHR.Infrastructure.Migrations
                     b.HasIndex("PositionEmployeePositionSideId");
 
                     b.ToTable("OrganizationPositionEmployeePositionSides");
-                    b.Property("MessageContent")
-                        .IsRequired()
-                        .HasColumnType("longtext")
-                        .HasComment("รายละเอียดข้อความ");
-
-                    b.Property("MessagePayLoad")
-                        .IsRequired()
-                        .HasColumnType("longtext")
-                        .HasComment("สิ่งที่แนบมาด้วย");
-
-                    b.Property("ReceiverEmailAddress")
-                        .IsRequired()
-                        .HasMaxLength(500)
-                        .HasColumnType("varchar(500)")
-                        .HasComment("อีเมล์ของผู้รับ");
-
-                    b.Property("ReceiverUserId")
-                        .HasColumnType("char(36)")
-                        .HasComment("รหัสของผู้รับข้อความ");
-
-                    b.Property("SenderSystem")
-                        .IsRequired()
-                        .HasMaxLength(200)
-                        .HasColumnType("varchar(200)")
-                        .HasComment("ส่งจากระบบงาน");
-
-                    b.Property("Subject")
-                        .IsRequired()
-                        .HasMaxLength(200)
-                        .HasColumnType("varchar(200)")
-                        .HasComment("หัวเรื่อง");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("MessageQueues");
                 });
 
             modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
@@ -9680,6 +9972,78 @@ namespace BMA.EHR.Infrastructure.Migrations
                     b.ToTable("PlacementTypes");
                 });
 
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b =>
+                {
+                    b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.Command");
+
+                    b.Property("ConclusionRegisterDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
+
+                    b.Property("ConclusionRegisterNo")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
+
+                    b.Property("ConclusionResultDate")
+                        .HasColumnType("datetime(6)")
+                        .HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+                    b.Property("ConclusionResultNo")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+                    b.Property("ExamRoundId")
+                        .HasColumnType("char(36)")
+                        .HasComment("อ้างอิงรอบการสอบ");
+
+                    b.Property("PositionName")
+                        .IsRequired()
+                        .HasColumnType("longtext")
+                        .HasComment("ตำแหน่งที่บรรจุ");
+
+                    b.HasDiscriminator().HasValue("PlacementCommand");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus")
+                        .WithMany()
+                        .HasForeignKey("CommandStatusId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandType", "CommandType")
+                        .WithMany()
+                        .HasForeignKey("CommandTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("CommandStatus");
+
+                    b.Navigation("CommandType");
+                });
+
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
+                {
+                    b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command")
+                        .WithMany("Documents")
+                        .HasForeignKey("CommandId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
+                        .WithMany()
+                        .HasForeignKey("DocumentId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Command");
+
+                    b.Navigation("Document");
+                });
+
             modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
                 {
                     b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
@@ -10695,6 +11059,11 @@ namespace BMA.EHR.Infrastructure.Migrations
                     b.Navigation("Religion");
                 });
 
+            modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+                {
+                    b.Navigation("Documents");
+                });
+
             modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
                 {
                     b.Navigation("LimitTypeLeaves");
diff --git a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs
index bfafa411..146abe6a 100644
--- a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs
+++ b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs
@@ -1,5 +1,4 @@
 using BMA.EHR.Application.Common.Interfaces;
-using BMA.EHR.Domain.Models.Commands;
 using BMA.EHR.Domain.Models.Documents;
 using BMA.EHR.Domain.Models.HR;
 using BMA.EHR.Domain.Models.MetaData;
@@ -9,6 +8,8 @@ using BMA.EHR.Domain.Models.Organizations;
 using BMA.EHR.Domain.Models.Organizations.Report2;
 using BMA.EHR.Domain.Models.Placement;
 using Microsoft.EntityFrameworkCore;
+using BMA.EHR.Domain.Models.Commands.Core;
+using BMA.EHR.Domain.Models.Commands;
 
 namespace BMA.EHR.Infrastructure.Persistence
 {
@@ -261,8 +262,17 @@ namespace BMA.EHR.Infrastructure.Persistence
 
         #region " Command "
 
+        public DbSet CommandStatuses { get; set; }
+
+        public DbSet CommandTypes { get; set; }
+
+        public DbSet CommandDocuments { get; set; }
+
         public DbSet DeploymentChannels { get; set; }
 
+
+        public DbSet PlacementCommands { get; set; }
+
         #endregion
 
         #region " Message Queue "
diff --git a/BMA.EHR.MetaData.Service/BMA - Backup.EHR.MetaData.Service.csproj b/BMA.EHR.MetaData.Service/BMA - Backup.EHR.MetaData.Service.csproj
new file mode 100644
index 00000000..87e2fdaf
--- /dev/null
+++ b/BMA.EHR.MetaData.Service/BMA - Backup.EHR.MetaData.Service.csproj	
@@ -0,0 +1,43 @@
+
+
+	
+		net7.0
+		enable
+		enable
+		aba35659-832c-421f-a7c1-80acb6ab6f0c
+		Linux
+		True
+		.
+		BMA.EHR.MetaData.Service
+	
+
+	
+		
+		
+		
+		
+		
+		
+		
+			all
+			runtime; build; native; contentfiles; analyzers; buildtransitive
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+
+	
+		
+	
+
+
diff --git a/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj
index 445bcc43..87e2fdaf 100644
--- a/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj
+++ b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj
@@ -37,7 +37,6 @@
 	
 
 	
-		
 		
 	
 
diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs
index d074187f..682558f1 100644
--- a/BMA.EHR.MetaData.Service/Program.cs
+++ b/BMA.EHR.MetaData.Service/Program.cs
@@ -1,4 +1,3 @@
-using BMA.EHR.API.Command;
 using BMA.EHR.Application;
 using BMA.EHR.Domain.Middlewares;
 using BMA.EHR.Infrastructure;
@@ -112,7 +111,7 @@ var app = builder.Build();
 
 	app.MapHealthChecks("/health");
 
-    app.UseMiddleware();
+   
     app.UseHttpsRedirection();
 	app.UseCors();
 	app.UseAuthentication();
@@ -120,9 +119,10 @@ var app = builder.Build();
 	app.UseDefaultFiles();
 	app.UseStaticFiles();
 	app.MapControllers();
+    app.UseMiddleware();
 
-	// apply migrations
-	await using var scope = app.Services.CreateAsyncScope();
+    // apply migrations
+    await using var scope = app.Services.CreateAsyncScope();
 	await using var db = scope.ServiceProvider.GetRequiredService();
 	await db.Database.MigrateAsync();
 
diff --git a/BMA.EHR.MetaData.Service/appsettings.json b/BMA.EHR.MetaData.Service/appsettings.json
index 81d5df2d..a06ebbd5 100644
--- a/BMA.EHR.MetaData.Service/appsettings.json
+++ b/BMA.EHR.MetaData.Service/appsettings.json
@@ -1,36 +1,35 @@
 {
     "Serilog": {
-      "MinimumLevel": {
-        "Default": "Information",
-        "Override": {
-          "Microsoft": "Information",
-          "System": "Warning"
+        "MinimumLevel": {
+            "Default": "Information",
+            "Override": {
+                "Microsoft": "Information",
+                "System": "Warning"
+            }
         }
-      }
     },
     "ElasticConfiguration": {
-      "Uri": "http://localhost:9200"
+        "Uri": "http://localhost:9200"
     },
     "AllowedHosts": "*",
     "ConnectionStrings": {
-      //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
-      "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
+        //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
+        "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
     },
     "Jwt": {
-      "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
-      "Issuer": "https://identity.frappet.com/realms/bma-ehr"
+        "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
+        "Issuer": "https://identity.frappet.com/realms/bma-ehr"
     },
     "EPPlus": {
-      "ExcelPackage": {
-        "LicenseContext": "NonCommercial"
-      }
+        "ExcelPackage": {
+            "LicenseContext": "NonCommercial"
+        }
     },
     "MinIO": {
-      "Endpoint": "https://s3.frappet.com/",
-      "AccessKey": "frappet",
-      "SecretKey": "P@ssw0rd",
-      "BucketName": "bma-recruit"
+        "Endpoint": "https://s3.frappet.com/",
+        "AccessKey": "frappet",
+        "SecretKey": "P@ssw0rd",
+        "BucketName": "bma-recruit"
     },
     "Protocol": "HTTPS"
-  }
-  
\ No newline at end of file
+}
diff --git a/BMA.EHR.OrganizationEmployee.Service/BMA - Backup.EHR.OrganizationEmployee.Service.csproj b/BMA.EHR.OrganizationEmployee.Service/BMA - Backup.EHR.OrganizationEmployee.Service.csproj
new file mode 100644
index 00000000..10fafc6a
--- /dev/null
+++ b/BMA.EHR.OrganizationEmployee.Service/BMA - Backup.EHR.OrganizationEmployee.Service.csproj	
@@ -0,0 +1,42 @@
+
+
+  
+    net7.0
+    enable
+    enable
+    3d68209a-41b1-4d00-914e-b895d74467c0
+    Linux
+    True
+    .
+    BMA.EHR.OrganizationEmployee.Service
+  
+
+  
+		
+		
+		
+		
+		
+		
+			all
+			runtime; build; native; contentfiles; analyzers; buildtransitive
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+  
+
+  
+    
+  
+
+
diff --git a/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj b/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj
index df94ee06..10fafc6a 100644
--- a/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj
+++ b/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj
@@ -36,7 +36,6 @@
   
 
   
-    
     
   
 
diff --git a/BMA.EHR.OrganizationEmployee.Service/Dockerfile b/BMA.EHR.OrganizationEmployee.Service/Dockerfile
index 8311400e..ccc19513 100644
--- a/BMA.EHR.OrganizationEmployee.Service/Dockerfile
+++ b/BMA.EHR.OrganizationEmployee.Service/Dockerfile
@@ -7,7 +7,12 @@ EXPOSE 443
 
 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
 WORKDIR /src
+
+COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"]
+COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
+COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
 COPY ["BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj", "BMA.EHR.OrganizationEmployee.Service/"]
+
 RUN dotnet restore "BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj"
 COPY . .
 WORKDIR "/src/BMA.EHR.OrganizationEmployee.Service"
diff --git a/BMA.EHR.OrganizationEmployee.Service/ErrorHandlerMiddleware.cs b/BMA.EHR.OrganizationEmployee.Service/ErrorHandlerMiddleware.cs
deleted file mode 100644
index c1888d18..00000000
--- a/BMA.EHR.OrganizationEmployee.Service/ErrorHandlerMiddleware.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using BMA.EHR.Domain.Common;
-using BMA.EHR.Domain.Shared;
-using System.Net;
-
-namespace BMA.EHR.OrganizationEmployee.Service
-{
-    public class ErrorHandlerMiddleware
-    {
-        #region " Fields "
-
-        private readonly RequestDelegate _next;
-
-        #endregion
-
-        #region " Constructor and Destructor "
-
-        public ErrorHandlerMiddleware(RequestDelegate next)
-        {
-            _next = next;
-        }
-
-        #endregion
-
-        #region " Methods "
-
-        public async Task Invoke(HttpContext context)
-        {
-            try
-            {
-                await _next(context);
-
-                var response = context.Response;
-                response.ContentType = "application/json";
-
-                var responseModel = new ResponseObject();
-                responseModel.Status = response.StatusCode;
-
-                if (responseModel.Status == (int)HttpStatusCode.Unauthorized)
-                {
-                    responseModel.Message = GlobalMessages.NotAuthorized;
-                    await response.WriteAsJsonAsync(responseModel);
-                }
-                if (responseModel.Status == (int)HttpStatusCode.Forbidden)
-                {
-                    responseModel.Message = GlobalMessages.ForbiddenAccess;
-                    await response.WriteAsJsonAsync(responseModel);
-                }
-            }
-            catch (Exception error)
-            {
-                var response = context.Response;
-                response.ContentType = "application/json";
-
-                var responseModel = new ResponseObject();
-                responseModel.Status = response.StatusCode;
-                var msg = error.Message;
-                var inner = error.InnerException;
-                while (inner != null)
-                {
-                    msg += $" {inner.Message}\r\n";
-                    inner = inner.InnerException;
-                }
-                responseModel.Result = msg;
-
-                switch (response.StatusCode)
-                {
-                    case (int)HttpStatusCode.Unauthorized:
-                        responseModel.Message = GlobalMessages.NotAuthorized;
-                        break;
-                    case (int)HttpStatusCode.Forbidden:
-                        responseModel.Message = GlobalMessages.ForbiddenAccess;
-                        break;
-                    default:
-                        responseModel.Status = (int)HttpStatusCode.InternalServerError;
-                        responseModel.Message = GlobalMessages.ExceptionOccured;
-                        break;
-                }
-                await response.WriteAsJsonAsync(responseModel);
-            }
-        }
-
-        #endregion
-    }
-}
diff --git a/BMA.EHR.OrganizationEmployee.Service/Program.cs b/BMA.EHR.OrganizationEmployee.Service/Program.cs
index 815dd1b0..3a430cb6 100644
--- a/BMA.EHR.OrganizationEmployee.Service/Program.cs
+++ b/BMA.EHR.OrganizationEmployee.Service/Program.cs
@@ -1,4 +1,5 @@
 using BMA.EHR.Application;
+using BMA.EHR.Domain.Middlewares;
 using BMA.EHR.Infrastructure;
 using BMA.EHR.Infrastructure.Persistence;
 using BMA.EHR.OrganizationEmployee.Service;
@@ -110,14 +111,16 @@ var app = builder.Build();
 
     app.MapHealthChecks("/health");
 
-    //app.UseMiddleware();
+    
     app.UseHttpsRedirection();
+    app.UseMiddleware();
     app.UseCors();
     app.UseAuthentication();
     app.UseAuthorization();
     app.UseDefaultFiles();
     app.UseStaticFiles();
     app.MapControllers();
+ 
 
     // apply migrations
     await using var scope = app.Services.CreateAsyncScope();
diff --git a/BMA.EHR.OrganizationEmployee.Service/appsettings.json b/BMA.EHR.OrganizationEmployee.Service/appsettings.json
index 81d5df2d..af28d59b 100644
--- a/BMA.EHR.OrganizationEmployee.Service/appsettings.json
+++ b/BMA.EHR.OrganizationEmployee.Service/appsettings.json
@@ -14,7 +14,7 @@
     "AllowedHosts": "*",
     "ConnectionStrings": {
       //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
-      "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
+      "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
     },
     "Jwt": {
       "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
diff --git a/BMA.EHR.Placement.Service/BMA - Backup.EHR.Placement.Service.csproj b/BMA.EHR.Placement.Service/BMA - Backup.EHR.Placement.Service.csproj
new file mode 100644
index 00000000..85035e7d
--- /dev/null
+++ b/BMA.EHR.Placement.Service/BMA - Backup.EHR.Placement.Service.csproj	
@@ -0,0 +1,42 @@
+
+
+  
+    net7.0
+    enable
+    enable
+    9d934a68-d1dd-449d-bde0-3078a774ad0f
+    Linux
+    True
+    .
+    BMA.EHR.Placement.Service
+  
+
+  
+		
+		
+		
+		
+		
+		
+			all
+			runtime; build; native; contentfiles; analyzers; buildtransitive
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+  
+
+  
+    
+  
+
+
diff --git a/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj b/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj
index 8cb1cb48..85035e7d 100644
--- a/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj
+++ b/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj
@@ -36,7 +36,6 @@
   
 
   
-    
     
   
 
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
index f7982e54..17d536ed 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
@@ -16,10 +16,10 @@ using System.Security.Cryptography;
 namespace BMA.EHR.Placement.Service.Controllers
 {
     [Route("api/v{version:apiVersion}/placement")]
-	[ApiVersion("1.0")]
-	[ApiController]
-	[Produces("application/json")]
-	[Authorize]
+    [ApiVersion("1.0")]
+    [ApiController]
+    [Produces("application/json")]
+    [Authorize]
     [SwaggerTag("ระบบบรรจุ")]
     public class PlacementController : BaseController
     {
@@ -316,9 +316,82 @@ namespace BMA.EHR.Placement.Service.Controllers
                 ExamRound = x.ExamRound,
                 Pass = x.Pass,
                 IsProperty = x.IsProperty == null ? null : Newtonsoft.Json.JsonConvert.DeserializeObject>(x.IsProperty),
+                BmaOfficer = "",
             }).FirstOrDefaultAsync(x => x.PersonalId == personalId);
 
-            return Success(data);
+            var _data = new
+            {
+                data.PersonalId,
+                data.IdCard,
+                data.Prefix,
+                data.PrefixId,
+                data.FullName,
+                data.Firstname,
+                data.Lastname,
+                data.Nationality,
+                data.Race,
+                data.DateOfBirth,
+                data.Age,
+                data.Telephone,
+                data.Gender,
+                data.GenderId,
+                data.Relationship,
+                data.RelationshipId,
+                data.BloodGroup,
+                data.BloodGroupId,
+                data.Religion,
+                data.ReligionId,
+                data.Address,
+                data.Education,
+                data.RegistAddress,
+                data.RegistSubDistrict,
+                data.RegistSubDistrictId,
+                data.RegistZipCode,
+                data.RegistDistrict,
+                data.RegistDistrictId,
+                data.RegistProvince,
+                data.RegistProvinceId,
+                data.CurrentAddress,
+                data.CurrentSubDistrict,
+                data.CurrentSubDistrictId,
+                data.CurrentZipCode,
+                data.CurrentDistrict,
+                data.CurrentDistrictId,
+                data.CurrentProvince,
+                data.CurrentProvinceId,
+                data.RegistSame,
+                data.MarryPrefix,
+                data.MarryPrefixId,
+                data.Couple,
+                data.MarryFirstName,
+                data.MarryLastName,
+                data.MarryOccupation,
+                data.FatherPrefix,
+                data.FatherPrefixId,
+                data.FatherFirstName,
+                data.FatherLastName,
+                data.FatherOccupation,
+                data.MotherPrefix,
+                data.MotherPrefixId,
+                data.MotherFirstName,
+                data.MotherLastName,
+                data.MotherOccupation,
+                data.Certificates,
+                data.PointA,
+                data.PointB,
+                data.PointC,
+                data.PointTotalA,
+                data.PointTotalB,
+                data.PointTotalC,
+                data.Point,
+                data.PointTotal,
+                data.ExamNumber,
+                data.ExamRound,
+                data.Pass,
+                data.IsProperty,
+                BmaOfficer = await _documentService.CheckBmaOfficer(data.IdCard),
+            };
+            return Success(_data);
         }
 
         [HttpPut("property/{personalId:length(36)}")]
@@ -647,7 +720,8 @@ namespace BMA.EHR.Placement.Service.Controllers
                     return Error(GlobalMessages.ProvinceNotFound, 404);
                 person.CurrentProvince = save;
             }
-
+            person.CurrentAddress = req.CurrentAddress;
+            person.RegistAddress = req.RegistrationAddress;
             person.RegistSame = req.RegistrationSame;
             person.LastUpdateFullName = FullName ?? "System Administrator";
             person.LastUpdateUserId = UserId ?? "";
@@ -719,6 +793,36 @@ namespace BMA.EHR.Placement.Service.Controllers
             return Success();
         }
 
+        [HttpPost("certificate/{personalId:length(36)}")]
+        public async Task> CreateCertificate([FromBody] PersonCertificateRequest req, Guid personalId)
+        {
+            var person = await _context.PlacementProfiles
+                                .Include(x => x.PlacementCertificates)
+                                .FirstOrDefaultAsync(x => x.Id == personalId);
+            if (person == null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            var data = new PlacementCertificate
+            {
+                PlacementProfile = person,
+                CertificateNo = req.CertificateNo,
+                Issuer = req.Issuer,
+                IssueDate = req.IssueDate,
+                ExpireDate = req.ExpireDate,
+                CertificateType = req.CertificateType,
+                CreatedUserId = FullName ?? "",
+                CreatedFullName = UserId ?? "System Administrator",
+                CreatedAt = DateTime.Now,
+                LastUpdateFullName = FullName ?? "System Administrator",
+                LastUpdateUserId = UserId ?? "",
+                LastUpdatedAt = DateTime.Now,
+            };
+            await _context.PlacementCertificates.AddAsync(data);
+            _context.SaveChanges();
+
+            return Success();
+        }
+
         [HttpPut("certificate/{personalId:length(36)}")]
         public async Task> UpdateCertificate([FromBody] PersonCertificateRequest req, Guid personalId)
         {
@@ -728,39 +832,17 @@ namespace BMA.EHR.Placement.Service.Controllers
             if (person == null)
                 return Error(GlobalMessages.DataNotFound, 404);
 
-            if (req.Id == null)
-            {
-                var data = new PlacementCertificate
-                {
-                    PlacementProfile = person,
-                    CertificateNo = req.CertificateNo,
-                    Issuer = req.Issuer,
-                    IssueDate = req.IssueDate,
-                    ExpireDate = req.ExpireDate,
-                    CertificateType = req.CertificateType,
-                    CreatedUserId = FullName ?? "",
-                    CreatedFullName = UserId ?? "System Administrator",
-                    CreatedAt = DateTime.Now,
-                    LastUpdateFullName = FullName ?? "System Administrator",
-                    LastUpdateUserId = UserId ?? "",
-                    LastUpdatedAt = DateTime.Now,
-                };
-                await _context.PlacementCertificates.AddAsync(data);
-            }
-            else
-            {
-                var certificate = person.PlacementCertificates.FirstOrDefault(x => x.Id == req.Id);
-                if (certificate == null)
-                    return Error(GlobalMessages.CertificateNotFound, 404);
-                certificate.CertificateNo = req.CertificateNo;
-                certificate.Issuer = req.Issuer;
-                certificate.IssueDate = req.IssueDate;
-                certificate.ExpireDate = req.ExpireDate;
-                certificate.CertificateType = req.CertificateType;
-                certificate.LastUpdateFullName = FullName ?? "System Administrator";
-                certificate.LastUpdateUserId = UserId ?? "";
-                certificate.LastUpdatedAt = DateTime.Now;
-            }
+            var certificate = person.PlacementCertificates.FirstOrDefault(x => x.Id == req.Id);
+            if (certificate == null)
+                return Error(GlobalMessages.CertificateNotFound, 404);
+            certificate.CertificateNo = req.CertificateNo;
+            certificate.Issuer = req.Issuer;
+            certificate.IssueDate = req.IssueDate;
+            certificate.ExpireDate = req.ExpireDate;
+            certificate.CertificateType = req.CertificateType;
+            certificate.LastUpdateFullName = FullName ?? "System Administrator";
+            certificate.LastUpdateUserId = UserId ?? "";
+            certificate.LastUpdatedAt = DateTime.Now;
             _context.SaveChanges();
 
             return Success();
@@ -783,12 +865,9 @@ namespace BMA.EHR.Placement.Service.Controllers
             return Success();
         }
 
-        [HttpPut("education/{personalId:length(36)}")]
-        public async Task> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
+        [HttpPost("education/{personalId:length(36)}")]
+        public async Task> CreateEducation([FromBody] PersonEducationRequest req, Guid personalId)
         {
-            // var education = await _context.PlacementEducations
-            //                         .Include(x => x.PlacementProfile)
-            //                         .FirstOrDefaultAsync(x => x.Id == personalId);
             var profile = await _context.PlacementProfiles.FirstOrDefaultAsync(x => x.Id == personalId);
             if (profile == null)
                 return Error(GlobalMessages.DataNotFound, 404);
@@ -801,58 +880,71 @@ namespace BMA.EHR.Placement.Service.Controllers
             if (positionPath == null && req.PositionPathId != null)
                 return Error(GlobalMessages.DataNotFound, 404);
 
-            if (req.Id == null)
+            var data = new PlacementEducation
             {
-                var data = new PlacementEducation
-                {
-                    PlacementProfile = profile,
-                    EducationLevel = educationLevel,
-                    PositionPath = positionPath,
-                    Institute = req.Institute,
-                    Degree = req.Degree,
-                    Field = req.Field,
-                    Gpa = req.Gpa,
-                    Country = req.Country,
-                    Duration = req.Duration,
-                    DurationYear = req.DurationYear,
-                    Other = req.Other,
-                    FundName = req.FundName,
-                    FinishDate = req.FinishDate,
-                    StartDate = req.StartDate,
-                    EndDate = req.EndDate,
-                    CreatedUserId = FullName ?? "",
-                    CreatedFullName = UserId ?? "System Administrator",
-                    CreatedAt = DateTime.Now,
-                    LastUpdateFullName = FullName ?? "System Administrator",
-                    LastUpdateUserId = UserId ?? "",
-                    LastUpdatedAt = DateTime.Now,
-                };
-                await _context.PlacementEducations.AddAsync(data);
-            }
-            else
-            {
-                var education = await _context.PlacementEducations.FirstOrDefaultAsync(x => x.Id == req.Id);
-                if (education == null)
-                    return Error(GlobalMessages.EducationNotFound, 404);
+                PlacementProfile = profile,
+                EducationLevel = educationLevel,
+                PositionPath = positionPath,
+                Institute = req.Institute,
+                Degree = req.Degree,
+                Field = req.Field,
+                Gpa = req.Gpa,
+                Country = req.Country,
+                Duration = req.Duration,
+                DurationYear = req.DurationYear,
+                Other = req.Other,
+                FundName = req.FundName,
+                FinishDate = req.FinishDate,
+                StartDate = req.StartDate,
+                EndDate = req.EndDate,
+                CreatedUserId = FullName ?? "",
+                CreatedFullName = UserId ?? "System Administrator",
+                CreatedAt = DateTime.Now,
+                LastUpdateFullName = FullName ?? "System Administrator",
+                LastUpdateUserId = UserId ?? "",
+                LastUpdatedAt = DateTime.Now,
+            };
+            await _context.PlacementEducations.AddAsync(data);
+            await _context.SaveChangesAsync();
+            return Success();
+        }
 
-                education.EducationLevel = educationLevel;
-                education.PositionPath = positionPath;
-                education.Institute = req.Institute;
-                education.Degree = req.Degree;
-                education.Field = req.Field;
-                education.Gpa = req.Gpa;
-                education.Country = req.Country;
-                education.Duration = req.Duration;
-                education.DurationYear = req.DurationYear;
-                education.Other = req.Other;
-                education.FundName = req.FundName;
-                education.FinishDate = req.FinishDate;
-                education.StartDate = req.StartDate;
-                education.EndDate = req.EndDate;
-                education.LastUpdateFullName = FullName ?? "System Administrator";
-                education.LastUpdateUserId = UserId ?? "";
-                education.LastUpdatedAt = DateTime.Now;
-            }
+        [HttpPut("education/{personalId:length(36)}")]
+        public async Task> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
+        {
+            var profile = await _context.PlacementProfiles.FirstOrDefaultAsync(x => x.Id == personalId);
+            if (profile == null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
+            if (educationLevel == null && req.EducationLevelId != null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
+            if (positionPath == null && req.PositionPathId != null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            var education = await _context.PlacementEducations.FirstOrDefaultAsync(x => x.Id == req.Id);
+            if (education == null)
+                return Error(GlobalMessages.EducationNotFound, 404);
+
+            education.EducationLevel = educationLevel;
+            education.PositionPath = positionPath;
+            education.Institute = req.Institute;
+            education.Degree = req.Degree;
+            education.Field = req.Field;
+            education.Gpa = req.Gpa;
+            education.Country = req.Country;
+            education.Duration = req.Duration;
+            education.DurationYear = req.DurationYear;
+            education.Other = req.Other;
+            education.FundName = req.FundName;
+            education.FinishDate = req.FinishDate;
+            education.StartDate = req.StartDate;
+            education.EndDate = req.EndDate;
+            education.LastUpdateFullName = FullName ?? "System Administrator";
+            education.LastUpdateUserId = UserId ?? "";
+            education.LastUpdatedAt = DateTime.Now;
             await _context.SaveChangesAsync();
             return Success();
         }
@@ -869,5 +961,16 @@ namespace BMA.EHR.Placement.Service.Controllers
             return Success();
         }
 
+        [HttpGet("position/use")]
+        public async Task> GetPositionUse()
+        {
+            var position = await _context.PlacementProfiles
+                .Where(x => x.PositionNumber != null)
+                .Select(x => x.PositionNumber.Id)
+                .ToListAsync();
+
+            return Success(position);
+        }
+
     }
 }
diff --git a/BMA.EHR.Placement.Service/Dockerfile b/BMA.EHR.Placement.Service/Dockerfile
index f74d9dcf..29eb158f 100644
--- a/BMA.EHR.Placement.Service/Dockerfile
+++ b/BMA.EHR.Placement.Service/Dockerfile
@@ -8,12 +8,12 @@ EXPOSE 443
 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
 WORKDIR /src
 
-COPY ["BMA.EHR.Application.csproj", "./BMA.EHR.Application"]
-COPY ["BMA.EHR.Domain.csproj", "./BMA.EHR.Domain"]
-COPY ["BMA.EHR.Infrastructure.csproj", "./BMA.EHR.Infrastructure"]
+COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"]
+COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
+COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
+COPY ["BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj", "BMA.EHR.Placement.Service/"]
 
-COPY ["BMA.EHR.Placement.Service.csproj", "./BMA.EHR.Placement.Service"]
-RUN dotnet restore "./BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj"
+RUN dotnet restore "BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj"
 COPY . .
 WORKDIR "/src/BMA.EHR.Placement.Service"
 RUN dotnet build "BMA.EHR.Placement.Service.csproj" -c Release -o /app/build
diff --git a/BMA.EHR.Placement.Service/Program.cs b/BMA.EHR.Placement.Service/Program.cs
index 51d19f67..1d0769c6 100644
--- a/BMA.EHR.Placement.Service/Program.cs
+++ b/BMA.EHR.Placement.Service/Program.cs
@@ -111,7 +111,7 @@ var app = builder.Build();
 
     app.MapHealthChecks("/health");
 
-    app.UseMiddleware();
+    
     app.UseHttpsRedirection();
     app.UseCors();
     app.UseAuthentication();
@@ -119,6 +119,7 @@ var app = builder.Build();
     app.UseDefaultFiles();
     app.UseStaticFiles();
     app.MapControllers();
+    app.UseMiddleware();
 
     // apply migrations
     await using var scope = app.Services.CreateAsyncScope();
diff --git a/BMA.EHR.Report.Service/BMA - Backup.EHR.Report.Service.csproj b/BMA.EHR.Report.Service/BMA - Backup.EHR.Report.Service.csproj
new file mode 100644
index 00000000..a2b76238
--- /dev/null
+++ b/BMA.EHR.Report.Service/BMA - Backup.EHR.Report.Service.csproj	
@@ -0,0 +1,52 @@
+
+
+	
+		net7.0
+		enable
+		enable
+		1fb39f37-45f3-4d47-9c86-c0458563770e
+		Linux
+		True
+		.
+		BMA.EHR.Report.Service
+	
+
+	
+		
+		
+		
+		
+		
+		
+			all
+			runtime; build; native; contentfiles; analyzers; buildtransitive
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+
+	
+		
+	
+
+	
+		
+	
+
+	
+		
+		
+	
+
+
diff --git a/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj b/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj
index be6d86cd..f405e447 100644
--- a/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj
+++ b/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj
@@ -37,7 +37,6 @@
 	
 
 	
-		
 		
 	
 
diff --git a/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs b/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs
index b6339ba3..c9e25402 100644
--- a/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs
+++ b/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs
@@ -69,7 +69,7 @@ namespace BMA.EHR.Report.Service
         {
             var info = new OpenApiInfo()
             {
-                Title = "BMA EHR Placement Service Document",
+                Title = "BMA EHR Report Service Document",
                 Version = desc.ApiVersion.ToString()
             };
 
diff --git a/BMA.EHR.Report.Service/Program.cs b/BMA.EHR.Report.Service/Program.cs
index a1160218..9a83ce24 100644
--- a/BMA.EHR.Report.Service/Program.cs
+++ b/BMA.EHR.Report.Service/Program.cs
@@ -111,7 +111,7 @@ var app = builder.Build();
 
     app.MapHealthChecks("/health");
 
-    app.UseMiddleware();
+    
     app.UseHttpsRedirection();
     app.UseCors();
     app.UseAuthentication();
@@ -119,6 +119,7 @@ var app = builder.Build();
     app.UseDefaultFiles();
     app.UseStaticFiles();
     app.MapControllers();
+    app.UseMiddleware();
 
     // apply migrations
     await using var scope = app.Services.CreateAsyncScope();
diff --git a/BMA.EHR.Report.Service/appsettings.json b/BMA.EHR.Report.Service/appsettings.json
index 10f68b8c..4c80fbc7 100644
--- a/BMA.EHR.Report.Service/appsettings.json
+++ b/BMA.EHR.Report.Service/appsettings.json
@@ -1,9 +1,35 @@
 {
-  "Logging": {
-    "LogLevel": {
-      "Default": "Information",
-      "Microsoft.AspNetCore": "Warning"
-    }
-  },
-  "AllowedHosts": "*"
-}
+    "Serilog": {
+        "MinimumLevel": {
+            "Default": "Information",
+            "Override": {
+                "Microsoft": "Information",
+                "System": "Warning"
+            }
+        }
+    },
+    "ElasticConfiguration": {
+        "Uri": "http://localhost:9200"
+    },
+    "AllowedHosts": "*",
+    "ConnectionStrings": {
+        //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
+        "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
+    },
+    "Jwt": {
+        "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
+        "Issuer": "https://identity.frappet.com/realms/bma-ehr"
+    },
+    "EPPlus": {
+        "ExcelPackage": {
+            "LicenseContext": "NonCommercial"
+        }
+    },
+    "MinIO": {
+        "Endpoint": "https://s3.frappet.com/",
+        "AccessKey": "frappet",
+        "SecretKey": "P@ssw0rd",
+        "BucketName": "bma-recruit"
+    },
+    "Protocol": "HTTPS"
+}
\ No newline at end of file
diff --git a/BMA.EHR.Report.Service/wwwroot/index.html b/BMA.EHR.Report.Service/wwwroot/index.html
new file mode 100644
index 00000000..ece944ac
--- /dev/null
+++ b/BMA.EHR.Report.Service/wwwroot/index.html
@@ -0,0 +1,184 @@
+
+
+
+
+    
+
+
+
+    
+ + + + + + + + + + + + + + + + + + + + +
+ +

Result

+

+
+    

Events

+

+
+
+    
+
+
\ No newline at end of file
diff --git a/BMA.EHR.Report.Service/wwwroot/keycloak.js b/BMA.EHR.Report.Service/wwwroot/keycloak.js
new file mode 100644
index 00000000..936a3c3c
--- /dev/null
+++ b/BMA.EHR.Report.Service/wwwroot/keycloak.js
@@ -0,0 +1,1766 @@
+/*
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function(root, factory) {
+    if ( typeof exports === 'object' ) {
+        if ( typeof module === 'object' ) {
+            module.exports = factory( require("js-sha256"), require("base64-js") );
+        } else {
+            exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
+        }
+    } else {
+        /**
+        * [js-sha256]{@link https://github.com/emn178/js-sha256}
+        *
+        * @version 0.9.0
+        * @author Chen, Yi-Cyuan [emn178@gmail.com]
+        * @copyright Chen, Yi-Cyuan 2014-2017
+        * @license MIT
+        */
+        !function () { "use strict"; function t(t, i) { i ? (d[0] = d[16] = d[1] = d[2] = d[3] = d[4] = d[5] = d[6] = d[7] = d[8] = d[9] = d[10] = d[11] = d[12] = d[13] = d[14] = d[15] = 0, this.blocks = d) : this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], t ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = t } function i(i, r, s) { var e, n = typeof i; if ("string" === n) { var o, a = [], u = i.length, c = 0; for (e = 0; e < u; ++e)(o = i.charCodeAt(e)) < 128 ? a[c++] = o : o < 2048 ? (a[c++] = 192 | o >> 6, a[c++] = 128 | 63 & o) : o < 55296 || o >= 57344 ? (a[c++] = 224 | o >> 12, a[c++] = 128 | o >> 6 & 63, a[c++] = 128 | 63 & o) : (o = 65536 + ((1023 & o) << 10 | 1023 & i.charCodeAt(++e)), a[c++] = 240 | o >> 18, a[c++] = 128 | o >> 12 & 63, a[c++] = 128 | o >> 6 & 63, a[c++] = 128 | 63 & o); i = a } else { if ("object" !== n) throw new Error(h); if (null === i) throw new Error(h); if (f && i.constructor === ArrayBuffer) i = new Uint8Array(i); else if (!(Array.isArray(i) || f && ArrayBuffer.isView(i))) throw new Error(h) } i.length > 64 && (i = new t(r, !0).update(i).array()); var y = [], p = []; for (e = 0; e < 64; ++e) { var l = i[e] || 0; y[e] = 92 ^ l, p[e] = 54 ^ l } t.call(this, r, s), this.update(p), this.oKeyPad = y, this.inner = !0, this.sharedMemory = s } var h = "input is invalid type", r = "object" == typeof window, s = r ? window : {}; s.JS_SHA256_NO_WINDOW && (r = !1); var e = !r && "object" == typeof self, n = !s.JS_SHA256_NO_NODE_JS && "object" == typeof process && process.versions && process.versions.node; n ? s = global : e && (s = self); var o = !s.JS_SHA256_NO_COMMON_JS && "object" == typeof module && module.exports, a = "function" == typeof define && define.amd, f = !s.JS_SHA256_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer, u = "0123456789abcdef".split(""), c = [-2147483648, 8388608, 32768, 128], y = [24, 16, 8, 0], p = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], l = ["hex", "array", "digest", "arrayBuffer"], d = []; !s.JS_SHA256_NO_NODE_JS && Array.isArray || (Array.isArray = function (t) { return "[object Array]" === Object.prototype.toString.call(t) }), !f || !s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function (t) { return "object" == typeof t && t.buffer && t.buffer.constructor === ArrayBuffer }); var A = function (i, h) { return function (r) { return new t(h, !0).update(r)[i]() } }, w = function (i) { var h = A("hex", i); n && (h = b(h, i)), h.create = function () { return new t(i) }, h.update = function (t) { return h.create().update(t) }; for (var r = 0; r < l.length; ++r) { var s = l[r]; h[s] = A(s, i) } return h }, b = function (t, i) { var r = eval("require('crypto')"), s = eval("require('buffer').Buffer"), e = i ? "sha224" : "sha256", n = function (i) { if ("string" == typeof i) return r.createHash(e).update(i, "utf8").digest("hex"); if (null === i || void 0 === i) throw new Error(h); return i.constructor === ArrayBuffer && (i = new Uint8Array(i)), Array.isArray(i) || ArrayBuffer.isView(i) || i.constructor === s ? r.createHash(e).update(new s(i)).digest("hex") : t(i) }; return n }, v = function (t, h) { return function (r, s) { return new i(r, h, !0).update(s)[t]() } }, _ = function (t) { var h = v("hex", t); h.create = function (h) { return new i(h, t) }, h.update = function (t, i) { return h.create(t).update(i) }; for (var r = 0; r < l.length; ++r) { var s = l[r]; h[s] = v(s, t) } return h }; t.prototype.update = function (t) { if (!this.finalized) { var i, r = typeof t; if ("string" !== r) { if ("object" !== r) throw new Error(h); if (null === t) throw new Error(h); if (f && t.constructor === ArrayBuffer) t = new Uint8Array(t); else if (!(Array.isArray(t) || f && ArrayBuffer.isView(t))) throw new Error(h); i = !0 } for (var s, e, n = 0, o = t.length, a = this.blocks; n < o;) { if (this.hashed && (this.hashed = !1, a[0] = this.block, a[16] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = a[10] = a[11] = a[12] = a[13] = a[14] = a[15] = 0), i) for (e = this.start; n < o && e < 64; ++n)a[e >> 2] |= t[n] << y[3 & e++]; else for (e = this.start; n < o && e < 64; ++n)(s = t.charCodeAt(n)) < 128 ? a[e >> 2] |= s << y[3 & e++] : s < 2048 ? (a[e >> 2] |= (192 | s >> 6) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]) : s < 55296 || s >= 57344 ? (a[e >> 2] |= (224 | s >> 12) << y[3 & e++], a[e >> 2] |= (128 | s >> 6 & 63) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]) : (s = 65536 + ((1023 & s) << 10 | 1023 & t.charCodeAt(++n)), a[e >> 2] |= (240 | s >> 18) << y[3 & e++], a[e >> 2] |= (128 | s >> 12 & 63) << y[3 & e++], a[e >> 2] |= (128 | s >> 6 & 63) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]); this.lastByteIndex = e, this.bytes += e - this.start, e >= 64 ? (this.block = a[16], this.start = e - 64, this.hash(), this.hashed = !0) : this.start = e } return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes = this.bytes % 4294967296), this } }, t.prototype.finalize = function () { if (!this.finalized) { this.finalized = !0; var t = this.blocks, i = this.lastByteIndex; t[16] = this.block, t[i >> 2] |= c[3 & i], this.block = t[16], i >= 56 && (this.hashed || this.hash(), t[0] = this.block, t[16] = t[1] = t[2] = t[3] = t[4] = t[5] = t[6] = t[7] = t[8] = t[9] = t[10] = t[11] = t[12] = t[13] = t[14] = t[15] = 0), t[14] = this.hBytes << 3 | this.bytes >>> 29, t[15] = this.bytes << 3, this.hash() } }, t.prototype.hash = function () { var t, i, h, r, s, e, n, o, a, f = this.h0, u = this.h1, c = this.h2, y = this.h3, l = this.h4, d = this.h5, A = this.h6, w = this.h7, b = this.blocks; for (t = 16; t < 64; ++t)i = ((s = b[t - 15]) >>> 7 | s << 25) ^ (s >>> 18 | s << 14) ^ s >>> 3, h = ((s = b[t - 2]) >>> 17 | s << 15) ^ (s >>> 19 | s << 13) ^ s >>> 10, b[t] = b[t - 16] + i + b[t - 7] + h << 0; for (a = u & c, t = 0; t < 64; t += 4)this.first ? (this.is224 ? (e = 300032, w = (s = b[0] - 1413257819) - 150054599 << 0, y = s + 24177077 << 0) : (e = 704751109, w = (s = b[0] - 210244248) - 1521486534 << 0, y = s + 143694565 << 0), this.first = !1) : (i = (f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10), r = (e = f & u) ^ f & c ^ a, w = y + (s = w + (h = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7)) + (l & d ^ ~l & A) + p[t] + b[t]) << 0, y = s + (i + r) << 0), i = (y >>> 2 | y << 30) ^ (y >>> 13 | y << 19) ^ (y >>> 22 | y << 10), r = (n = y & f) ^ y & u ^ e, A = c + (s = A + (h = (w >>> 6 | w << 26) ^ (w >>> 11 | w << 21) ^ (w >>> 25 | w << 7)) + (w & l ^ ~w & d) + p[t + 1] + b[t + 1]) << 0, i = ((c = s + (i + r) << 0) >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10), r = (o = c & y) ^ c & f ^ n, d = u + (s = d + (h = (A >>> 6 | A << 26) ^ (A >>> 11 | A << 21) ^ (A >>> 25 | A << 7)) + (A & w ^ ~A & l) + p[t + 2] + b[t + 2]) << 0, i = ((u = s + (i + r) << 0) >>> 2 | u << 30) ^ (u >>> 13 | u << 19) ^ (u >>> 22 | u << 10), r = (a = u & c) ^ u & y ^ o, l = f + (s = l + (h = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7)) + (d & A ^ ~d & w) + p[t + 3] + b[t + 3]) << 0, f = s + (i + r) << 0; this.h0 = this.h0 + f << 0, this.h1 = this.h1 + u << 0, this.h2 = this.h2 + c << 0, this.h3 = this.h3 + y << 0, this.h4 = this.h4 + l << 0, this.h5 = this.h5 + d << 0, this.h6 = this.h6 + A << 0, this.h7 = this.h7 + w << 0 }, t.prototype.hex = function () { this.finalize(); var t = this.h0, i = this.h1, h = this.h2, r = this.h3, s = this.h4, e = this.h5, n = this.h6, o = this.h7, a = u[t >> 28 & 15] + u[t >> 24 & 15] + u[t >> 20 & 15] + u[t >> 16 & 15] + u[t >> 12 & 15] + u[t >> 8 & 15] + u[t >> 4 & 15] + u[15 & t] + u[i >> 28 & 15] + u[i >> 24 & 15] + u[i >> 20 & 15] + u[i >> 16 & 15] + u[i >> 12 & 15] + u[i >> 8 & 15] + u[i >> 4 & 15] + u[15 & i] + u[h >> 28 & 15] + u[h >> 24 & 15] + u[h >> 20 & 15] + u[h >> 16 & 15] + u[h >> 12 & 15] + u[h >> 8 & 15] + u[h >> 4 & 15] + u[15 & h] + u[r >> 28 & 15] + u[r >> 24 & 15] + u[r >> 20 & 15] + u[r >> 16 & 15] + u[r >> 12 & 15] + u[r >> 8 & 15] + u[r >> 4 & 15] + u[15 & r] + u[s >> 28 & 15] + u[s >> 24 & 15] + u[s >> 20 & 15] + u[s >> 16 & 15] + u[s >> 12 & 15] + u[s >> 8 & 15] + u[s >> 4 & 15] + u[15 & s] + u[e >> 28 & 15] + u[e >> 24 & 15] + u[e >> 20 & 15] + u[e >> 16 & 15] + u[e >> 12 & 15] + u[e >> 8 & 15] + u[e >> 4 & 15] + u[15 & e] + u[n >> 28 & 15] + u[n >> 24 & 15] + u[n >> 20 & 15] + u[n >> 16 & 15] + u[n >> 12 & 15] + u[n >> 8 & 15] + u[n >> 4 & 15] + u[15 & n]; return this.is224 || (a += u[o >> 28 & 15] + u[o >> 24 & 15] + u[o >> 20 & 15] + u[o >> 16 & 15] + u[o >> 12 & 15] + u[o >> 8 & 15] + u[o >> 4 & 15] + u[15 & o]), a }, t.prototype.toString = t.prototype.hex, t.prototype.digest = function () { this.finalize(); var t = this.h0, i = this.h1, h = this.h2, r = this.h3, s = this.h4, e = this.h5, n = this.h6, o = this.h7, a = [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, i >> 24 & 255, i >> 16 & 255, i >> 8 & 255, 255 & i, h >> 24 & 255, h >> 16 & 255, h >> 8 & 255, 255 & h, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, 255 & r, s >> 24 & 255, s >> 16 & 255, s >> 8 & 255, 255 & s, e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, 255 & e, n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, 255 & n]; return this.is224 || a.push(o >> 24 & 255, o >> 16 & 255, o >> 8 & 255, 255 & o), a }, t.prototype.array = t.prototype.digest, t.prototype.arrayBuffer = function () { this.finalize(); var t = new ArrayBuffer(this.is224 ? 28 : 32), i = new DataView(t); return i.setUint32(0, this.h0), i.setUint32(4, this.h1), i.setUint32(8, this.h2), i.setUint32(12, this.h3), i.setUint32(16, this.h4), i.setUint32(20, this.h5), i.setUint32(24, this.h6), this.is224 || i.setUint32(28, this.h7), t }, i.prototype = new t, i.prototype.finalize = function () { if (t.prototype.finalize.call(this), this.inner) { this.inner = !1; var i = this.array(); t.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(i), t.prototype.finalize.call(this) } }; var B = w(); B.sha256 = B, B.sha224 = w(!0), B.sha256.hmac = _(), B.sha224.hmac = _(!0), o ? module.exports = B : (s.sha256 = B.sha256, s.sha224 = B.sha224, a && define(function () { return B })) }();
+
+        /**
+         * [base64-js]{@link https://github.com/beatgammit/base64-js}
+         *
+         * @version v1.3.0
+         * @author Kirill, Fomichev
+         * @copyright Kirill, Fomichev 2014
+         * @license MIT
+         */
+        (function (r) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = r() } else if (typeof define === "function" && define.amd) { define([], r) } else { var e; if (typeof window !== "undefined") { e = window } else if (typeof global !== "undefined") { e = global } else if (typeof self !== "undefined") { e = self } else { e = this } e.base64js = r() } })(function () { var r, e, n; return function () { function r(e, n, t) { function o(f, i) { if (!n[f]) { if (!e[f]) { var u = "function" == typeof require && require; if (!i && u) return u(f, !0); if (a) return a(f, !0); var v = new Error("Cannot find module '" + f + "'"); throw v.code = "MODULE_NOT_FOUND", v } var d = n[f] = { exports: {} }; e[f][0].call(d.exports, function (r) { var n = e[f][1][r]; return o(n || r) }, d, d.exports, r, e, n, t) } return n[f].exports } for (var a = "function" == typeof require && require, f = 0; f < t.length; f++)o(t[f]); return o } return r }()({ "/": [function (r, e, n) { "use strict"; n.byteLength = d; n.toByteArray = h; n.fromByteArray = p; var t = []; var o = []; var a = typeof Uint8Array !== "undefined" ? Uint8Array : Array; var f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for (var i = 0, u = f.length; i < u; ++i) { t[i] = f[i]; o[f.charCodeAt(i)] = i } o["-".charCodeAt(0)] = 62; o["_".charCodeAt(0)] = 63; function v(r) { var e = r.length; if (e % 4 > 0) { throw new Error("Invalid string. Length must be a multiple of 4") } var n = r.indexOf("="); if (n === -1) n = e; var t = n === e ? 0 : 4 - n % 4; return [n, t] } function d(r) { var e = v(r); var n = e[0]; var t = e[1]; return (n + t) * 3 / 4 - t } function c(r, e, n) { return (e + n) * 3 / 4 - n } function h(r) { var e; var n = v(r); var t = n[0]; var f = n[1]; var i = new a(c(r, t, f)); var u = 0; var d = f > 0 ? t - 4 : t; for (var h = 0; h < d; h += 4) { e = o[r.charCodeAt(h)] << 18 | o[r.charCodeAt(h + 1)] << 12 | o[r.charCodeAt(h + 2)] << 6 | o[r.charCodeAt(h + 3)]; i[u++] = e >> 16 & 255; i[u++] = e >> 8 & 255; i[u++] = e & 255 } if (f === 2) { e = o[r.charCodeAt(h)] << 2 | o[r.charCodeAt(h + 1)] >> 4; i[u++] = e & 255 } if (f === 1) { e = o[r.charCodeAt(h)] << 10 | o[r.charCodeAt(h + 1)] << 4 | o[r.charCodeAt(h + 2)] >> 2; i[u++] = e >> 8 & 255; i[u++] = e & 255 } return i } function s(r) { return t[r >> 18 & 63] + t[r >> 12 & 63] + t[r >> 6 & 63] + t[r & 63] } function l(r, e, n) { var t; var o = []; for (var a = e; a < n; a += 3) { t = (r[a] << 16 & 16711680) + (r[a + 1] << 8 & 65280) + (r[a + 2] & 255); o.push(s(t)) } return o.join("") } function p(r) { var e; var n = r.length; var o = n % 3; var a = []; var f = 16383; for (var i = 0, u = n - o; i < u; i += f) { a.push(l(r, i, i + f > u ? u : i + f)) } if (o === 1) { e = r[n - 1]; a.push(t[e >> 2] + t[e << 4 & 63] + "==") } else if (o === 2) { e = (r[n - 2] << 8) + r[n - 1]; a.push(t[e >> 10] + t[e >> 4 & 63] + t[e << 2 & 63] + "=") } return a.join("") } }, {}] }, {}, [])("/") });
+
+        /**
+         * [promise-polyfill]{@link https://github.com/taylorhakes/promise-polyfill}
+         *
+         * @version v8.1.3
+         * @author Hakes, Taylor
+         * @copyright Hakes, Taylor 2014
+         * @license MIT
+         */
+        !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(e){return!(!e||"undefined"==typeof e.length)}function t(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}function r(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(r){return void f(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}function i(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof o)return e._state=3,e._value=n,void u(e);if("function"==typeof t)return void c(function(e,n){return function(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}function f(e,n){e._state=2,e._value=n,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}function c(e,n){var t=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var o=new this.constructor(t);return r(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){return new o(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(t,r){if(!n(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o});
+
+        var Keycloak = factory( root["sha256"], root["base64js"] );
+        root["Keycloak"] = Keycloak;
+
+        if ( typeof define === "function" && define.amd ) {
+            define( "keycloak", [], function () { return Keycloak; } );
+        }
+    }
+})(window, function (sha256_imported, base64js_imported) {
+    if (typeof Promise === 'undefined') {
+        throw Error('Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.');
+    }
+
+    var loggedPromiseDeprecation = false;
+
+    function logPromiseDeprecation() {
+        if (!loggedPromiseDeprecation) {
+            loggedPromiseDeprecation = true;
+            console.warn('[KEYCLOAK] Usage of legacy style promise methods such as `.error()` and `.success()` has been deprecated and support will be removed in future versions. Use standard style promise methods such as `.then() and `.catch()` instead.');
+        }
+    }
+
+    function Keycloak (config) {
+        if (!(this instanceof Keycloak)) {
+            return new Keycloak(config);
+        }
+
+        var kc = this;
+        var adapter;
+        var refreshQueue = [];
+        var callbackStorage;
+
+        var loginIframe = {
+            enable: true,
+            callbackList: [],
+            interval: 5
+        };
+
+        var scripts = document.getElementsByTagName('script');
+        for (var i = 0; i < scripts.length; i++) {
+            if ((scripts[i].src.indexOf('keycloak.js') !== -1 || scripts[i].src.indexOf('keycloak.min.js') !== -1) && scripts[i].src.indexOf('version=') !== -1) {
+                kc.iframeVersion = scripts[i].src.substring(scripts[i].src.indexOf('version=') + 8).split('&')[0];
+            }
+        }
+
+        var useNonce = true;
+        var logInfo = createLogger(console.info);
+        var logWarn = createLogger(console.warn);
+
+        kc.init = function (initOptions) {
+            kc.authenticated = false;
+
+            callbackStorage = createCallbackStorage();
+            var adapters = ['default', 'cordova', 'cordova-native'];
+
+            if (initOptions && adapters.indexOf(initOptions.adapter) > -1) {
+                adapter = loadAdapter(initOptions.adapter);
+            } else if (initOptions && typeof initOptions.adapter === "object") {
+                adapter = initOptions.adapter;
+            } else {
+                if (window.Cordova || window.cordova) {
+                    adapter = loadAdapter('cordova');
+                } else {
+                    adapter = loadAdapter();
+                }
+            }
+
+            if (initOptions) {
+                if (typeof initOptions.useNonce !== 'undefined') {
+                    useNonce = initOptions.useNonce;
+                }
+
+                if (typeof initOptions.checkLoginIframe !== 'undefined') {
+                    loginIframe.enable = initOptions.checkLoginIframe;
+                }
+
+                if (initOptions.checkLoginIframeInterval) {
+                    loginIframe.interval = initOptions.checkLoginIframeInterval;
+                }
+
+                if (initOptions.onLoad === 'login-required') {
+                    kc.loginRequired = true;
+                }
+
+                if (initOptions.responseMode) {
+                    if (initOptions.responseMode === 'query' || initOptions.responseMode === 'fragment') {
+                        kc.responseMode = initOptions.responseMode;
+                    } else {
+                        throw 'Invalid value for responseMode';
+                    }
+                }
+
+                if (initOptions.flow) {
+                    switch (initOptions.flow) {
+                        case 'standard':
+                            kc.responseType = 'code';
+                            break;
+                        case 'implicit':
+                            kc.responseType = 'id_token token';
+                            break;
+                        case 'hybrid':
+                            kc.responseType = 'code id_token token';
+                            break;
+                        default:
+                            throw 'Invalid value for flow';
+                    }
+                    kc.flow = initOptions.flow;
+                }
+
+                if (initOptions.timeSkew != null) {
+                    kc.timeSkew = initOptions.timeSkew;
+                }
+
+                if(initOptions.redirectUri) {
+                    kc.redirectUri = initOptions.redirectUri;
+                }
+
+                if (initOptions.silentCheckSsoRedirectUri) {
+                    kc.silentCheckSsoRedirectUri = initOptions.silentCheckSsoRedirectUri;
+                }
+
+                if (typeof initOptions.silentCheckSsoFallback === 'boolean') {
+                    kc.silentCheckSsoFallback = initOptions.silentCheckSsoFallback;
+                } else {
+                    kc.silentCheckSsoFallback = true;
+                }
+
+                if (initOptions.pkceMethod) {
+                    if (initOptions.pkceMethod !== "S256") {
+                        throw 'Invalid value for pkceMethod';
+                    }
+                    kc.pkceMethod = initOptions.pkceMethod;
+                }
+
+                if (typeof initOptions.enableLogging === 'boolean') {
+                    kc.enableLogging = initOptions.enableLogging;
+                } else {
+                    kc.enableLogging = false;
+                }
+
+                if (typeof initOptions.scope === 'string') {
+                    kc.scope = initOptions.scope;
+                }
+
+                if (typeof initOptions.messageReceiveTimeout === 'number' && initOptions.messageReceiveTimeout > 0) {
+                    kc.messageReceiveTimeout = initOptions.messageReceiveTimeout;
+                } else {
+                    kc.messageReceiveTimeout = 10000;
+                }
+            }
+
+            if (!kc.responseMode) {
+                kc.responseMode = 'fragment';
+            }
+            if (!kc.responseType) {
+                kc.responseType = 'code';
+                kc.flow = 'standard';
+            }
+
+            var promise = createPromise();
+
+            var initPromise = createPromise();
+            initPromise.promise.then(function() {
+                kc.onReady && kc.onReady(kc.authenticated);
+                promise.setSuccess(kc.authenticated);
+            }).catch(function(error) {
+                promise.setError(error);
+            });
+
+            var configPromise = loadConfig(config);
+
+            function onLoad() {
+                var doLogin = function(prompt) {
+                    if (!prompt) {
+                        options.prompt = 'none';
+                    }
+
+                    kc.login(options).then(function () {
+                        initPromise.setSuccess();
+                    }).catch(function (error) {
+                        initPromise.setError(error);
+                    });
+                }
+
+                var checkSsoSilently = function() {
+                    var ifrm = document.createElement("iframe");
+                    var src = kc.createLoginUrl({prompt: 'none', redirectUri: kc.silentCheckSsoRedirectUri});
+                    ifrm.setAttribute("src", src);
+                    ifrm.setAttribute("title", "keycloak-silent-check-sso");
+                    ifrm.style.display = "none";
+                    document.body.appendChild(ifrm);
+
+                    var messageCallback = function(event) {
+                        if (event.origin !== window.location.origin || ifrm.contentWindow !== event.source) {
+                            return;
+                        }
+
+                        var oauth = parseCallback(event.data);
+                        processCallback(oauth, initPromise);
+
+                        document.body.removeChild(ifrm);
+                        window.removeEventListener("message", messageCallback);
+                    };
+
+                    window.addEventListener("message", messageCallback);
+                };
+
+                var options = {};
+                switch (initOptions.onLoad) {
+                    case 'check-sso':
+                        if (loginIframe.enable) {
+                            setupCheckLoginIframe().then(function() {
+                                checkLoginIframe().then(function (unchanged) {
+                                    if (!unchanged) {
+                                        kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);
+                                    } else {
+                                        initPromise.setSuccess();
+                                    }
+                                }).catch(function (error) {
+                                    initPromise.setError(error);
+                                });
+                            });
+                        } else {
+                            kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);
+                        }
+                        break;
+                    case 'login-required':
+                        doLogin(true);
+                        break;
+                    default:
+                        throw 'Invalid value for onLoad';
+                }
+            }
+
+            function processInit() {
+                var callback = parseCallback(window.location.href);
+
+                if (callback) {
+                    window.history.replaceState(window.history.state, null, callback.newUrl);
+                }
+
+                if (callback && callback.valid) {
+                    return setupCheckLoginIframe().then(function() {
+                        processCallback(callback, initPromise);
+                    }).catch(function (error) {
+                        initPromise.setError(error);
+                    });
+                } else if (initOptions) {
+                    if (initOptions.token && initOptions.refreshToken) {
+                        setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);
+
+                        if (loginIframe.enable) {
+                            setupCheckLoginIframe().then(function() {
+                                checkLoginIframe().then(function (unchanged) {
+                                    if (unchanged) {
+                                        kc.onAuthSuccess && kc.onAuthSuccess();
+                                        initPromise.setSuccess();
+                                        scheduleCheckIframe();
+                                    } else {
+                                        initPromise.setSuccess();
+                                    }
+                                }).catch(function (error) {
+                                    initPromise.setError(error);
+                                });
+                            });
+                        } else {
+                            kc.updateToken(-1).then(function() {
+                                kc.onAuthSuccess && kc.onAuthSuccess();
+                                initPromise.setSuccess();
+                            }).catch(function(error) {
+                                kc.onAuthError && kc.onAuthError();
+                                if (initOptions.onLoad) {
+                                    onLoad();
+                                } else {
+                                    initPromise.setError(error);
+                                }
+                            });
+                        }
+                    } else if (initOptions.onLoad) {
+                        onLoad();
+                    } else {
+                        initPromise.setSuccess();
+                    }
+                } else {
+                    initPromise.setSuccess();
+                }
+            }
+
+            function domReady() {
+                var promise = createPromise();
+
+                var checkReadyState = function () {
+                    if (document.readyState === 'interactive' || document.readyState === 'complete') {
+                        document.removeEventListener('readystatechange', checkReadyState);
+                        promise.setSuccess();
+                    }
+                }
+                document.addEventListener('readystatechange', checkReadyState);
+
+                checkReadyState(); // just in case the event was already fired and we missed it (in case the init is done later than at the load time, i.e. it's done from code)
+
+                return promise.promise;
+            }
+
+            configPromise.then(function () {
+                domReady()
+                    .then(check3pCookiesSupported)
+                    .then(processInit)
+                    .catch(function (error) {
+                        promise.setError(error);
+                    });
+            });
+            configPromise.catch(function (error) {
+                promise.setError(error);
+            });
+
+            return promise.promise;
+        }
+
+        kc.login = function (options) {
+            return adapter.login(options);
+        }
+
+        function generateRandomData(len) {
+            // use web crypto APIs if possible
+            var array = null;
+            var crypto = window.crypto || window.msCrypto;
+            if (crypto && crypto.getRandomValues && window.Uint8Array) {
+                array = new Uint8Array(len);
+                crypto.getRandomValues(array);
+                return array;
+            }
+
+            // fallback to Math random
+            array = new Array(len);
+            for (var j = 0; j < array.length; j++) {
+                array[j] = Math.floor(256 * Math.random());
+            }
+            return array;
+        }
+
+        function generateCodeVerifier(len) {
+            return generateRandomString(len, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
+        }
+
+        function generateRandomString(len, alphabet){
+            var randomData = generateRandomData(len);
+            var chars = new Array(len);
+            for (var i = 0; i < len; i++) {
+                chars[i] = alphabet.charCodeAt(randomData[i] % alphabet.length);
+            }
+            return String.fromCharCode.apply(null, chars);
+        }
+
+        function generatePkceChallenge(pkceMethod, codeVerifier) {
+            switch (pkceMethod) {
+                // The use of the "plain" method is considered insecure and therefore not supported.
+                case "S256":
+                    // hash codeVerifier, then encode as url-safe base64 without padding
+                    var hashBytes = new Uint8Array(sha256_imported.arrayBuffer(codeVerifier));
+                    var encodedHash = base64js_imported.fromByteArray(hashBytes)
+                        .replace(/\+/g, '-')
+                        .replace(/\//g, '_')
+                        .replace(/\=/g, '');
+                    return encodedHash;
+                default:
+                    throw 'Invalid value for pkceMethod';
+            }
+        }
+
+        kc.createLoginUrl = function(options) {
+            var state = createUUID();
+            var nonce = createUUID();
+
+            var redirectUri = adapter.redirectUri(options);
+
+            var callbackState = {
+                state: state,
+                nonce: nonce,
+                redirectUri: encodeURIComponent(redirectUri)
+            };
+
+            if (options && options.prompt) {
+                callbackState.prompt = options.prompt;
+            }
+
+            var baseUrl;
+            if (options && options.action == 'register') {
+                baseUrl = kc.endpoints.register();
+            } else {
+                baseUrl = kc.endpoints.authorize();
+            }
+
+            var scope = options && options.scope || kc.scope;
+            if (!scope) {
+                // if scope is not set, default to "openid"
+                scope = "openid";
+            } else if (scope.indexOf("openid") === -1) {
+                // if openid scope is missing, prefix the given scopes with it
+                scope = "openid " + scope;
+            }
+
+            var url = baseUrl
+                + '?client_id=' + encodeURIComponent(kc.clientId)
+                + '&redirect_uri=' + encodeURIComponent(redirectUri)
+                + '&state=' + encodeURIComponent(state)
+                + '&response_mode=' + encodeURIComponent(kc.responseMode)
+                + '&response_type=' + encodeURIComponent(kc.responseType)
+                + '&scope=' + encodeURIComponent(scope);
+            if (useNonce) {
+                url = url + '&nonce=' + encodeURIComponent(nonce);
+            }
+
+            if (options && options.prompt) {
+                url += '&prompt=' + encodeURIComponent(options.prompt);
+            }
+
+            if (options && options.maxAge) {
+                url += '&max_age=' + encodeURIComponent(options.maxAge);
+            }
+
+            if (options && options.loginHint) {
+                url += '&login_hint=' + encodeURIComponent(options.loginHint);
+            }
+
+            if (options && options.idpHint) {
+                url += '&kc_idp_hint=' + encodeURIComponent(options.idpHint);
+            }
+
+            if (options && options.action && options.action != 'register') {
+                url += '&kc_action=' + encodeURIComponent(options.action);
+            }
+
+            if (options && options.locale) {
+                url += '&ui_locales=' + encodeURIComponent(options.locale);
+            }
+
+            if (kc.pkceMethod) {
+                var codeVerifier = generateCodeVerifier(96);
+                callbackState.pkceCodeVerifier = codeVerifier;
+                var pkceChallenge = generatePkceChallenge(kc.pkceMethod, codeVerifier);
+                url += '&code_challenge=' + pkceChallenge;
+                url += '&code_challenge_method=' + kc.pkceMethod;
+            }
+
+            callbackStorage.add(callbackState);
+
+            return url;
+        }
+
+        kc.logout = function(options) {
+            return adapter.logout(options);
+        }
+
+        kc.createLogoutUrl = function(options) {
+            var url = kc.endpoints.logout()
+                + '?redirect_uri=' + encodeURIComponent(adapter.redirectUri(options, false));
+
+            return url;
+        }
+
+        kc.register = function (options) {
+            return adapter.register(options);
+        }
+
+        kc.createRegisterUrl = function(options) {
+            if (!options) {
+                options = {};
+            }
+            options.action = 'register';
+            return kc.createLoginUrl(options);
+        }
+
+        kc.createAccountUrl = function(options) {
+            var realm = getRealmUrl();
+            var url = undefined;
+            if (typeof realm !== 'undefined') {
+                url = realm
+                + '/account'
+                + '?referrer=' + encodeURIComponent(kc.clientId)
+                + '&referrer_uri=' + encodeURIComponent(adapter.redirectUri(options));
+            }
+            return url;
+        }
+
+        kc.accountManagement = function() {
+            return adapter.accountManagement();
+        }
+
+        kc.hasRealmRole = function (role) {
+            var access = kc.realmAccess;
+            return !!access && access.roles.indexOf(role) >= 0;
+        }
+
+        kc.hasResourceRole = function(role, resource) {
+            if (!kc.resourceAccess) {
+                return false;
+            }
+
+            var access = kc.resourceAccess[resource || kc.clientId];
+            return !!access && access.roles.indexOf(role) >= 0;
+        }
+
+        kc.loadUserProfile = function() {
+            var url = getRealmUrl() + '/account';
+            var req = new XMLHttpRequest();
+            req.open('GET', url, true);
+            req.setRequestHeader('Accept', 'application/json');
+            req.setRequestHeader('Authorization', 'bearer ' + kc.token);
+
+            var promise = createPromise();
+
+            req.onreadystatechange = function () {
+                if (req.readyState == 4) {
+                    if (req.status == 200) {
+                        kc.profile = JSON.parse(req.responseText);
+                        promise.setSuccess(kc.profile);
+                    } else {
+                        promise.setError();
+                    }
+                }
+            }
+
+            req.send();
+
+            return promise.promise;
+        }
+
+        kc.loadUserInfo = function() {
+            var url = kc.endpoints.userinfo();
+            var req = new XMLHttpRequest();
+            req.open('GET', url, true);
+            req.setRequestHeader('Accept', 'application/json');
+            req.setRequestHeader('Authorization', 'bearer ' + kc.token);
+
+            var promise = createPromise();
+
+            req.onreadystatechange = function () {
+                if (req.readyState == 4) {
+                    if (req.status == 200) {
+                        kc.userInfo = JSON.parse(req.responseText);
+                        promise.setSuccess(kc.userInfo);
+                    } else {
+                        promise.setError();
+                    }
+                }
+            }
+
+            req.send();
+
+            return promise.promise;
+        }
+
+        kc.isTokenExpired = function(minValidity) {
+            if (!kc.tokenParsed || (!kc.refreshToken && kc.flow != 'implicit' )) {
+                throw 'Not authenticated';
+            }
+
+            if (kc.timeSkew == null) {
+                logInfo('[KEYCLOAK] Unable to determine if token is expired as timeskew is not set');
+                return true;
+            }
+
+            var expiresIn = kc.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + kc.timeSkew;
+            if (minValidity) {
+                if (isNaN(minValidity)) {
+                    throw 'Invalid minValidity';
+                }
+                expiresIn -= minValidity;
+            }
+            return expiresIn < 0;
+        }
+
+        kc.updateToken = function(minValidity) {
+            var promise = createPromise();
+
+            if (!kc.refreshToken) {
+                promise.setError();
+                return promise.promise;
+            }
+
+            minValidity = minValidity || 5;
+
+            var exec = function() {
+                var refreshToken = false;
+                if (minValidity == -1) {
+                    refreshToken = true;
+                    logInfo('[KEYCLOAK] Refreshing token: forced refresh');
+                } else if (!kc.tokenParsed || kc.isTokenExpired(minValidity)) {
+                    refreshToken = true;
+                    logInfo('[KEYCLOAK] Refreshing token: token expired');
+                }
+
+                if (!refreshToken) {
+                    promise.setSuccess(false);
+                } else {
+                    var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;
+                    var url = kc.endpoints.token();
+
+                    refreshQueue.push(promise);
+
+                    if (refreshQueue.length == 1) {
+                        var req = new XMLHttpRequest();
+                        req.open('POST', url, true);
+                        req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+                        req.withCredentials = true;
+
+                        params += '&client_id=' + encodeURIComponent(kc.clientId);
+
+                        var timeLocal = new Date().getTime();
+
+                        req.onreadystatechange = function () {
+                            if (req.readyState == 4) {
+                                if (req.status == 200) {
+                                    logInfo('[KEYCLOAK] Token refreshed');
+
+                                    timeLocal = (timeLocal + new Date().getTime()) / 2;
+
+                                    var tokenResponse = JSON.parse(req.responseText);
+
+                                    setToken(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], timeLocal);
+
+                                    kc.onAuthRefreshSuccess && kc.onAuthRefreshSuccess();
+                                    for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
+                                        p.setSuccess(true);
+                                    }
+                                } else {
+                                    logWarn('[KEYCLOAK] Failed to refresh token');
+
+                                    if (req.status == 400) {
+                                        kc.clearToken();
+                                    }
+
+                                    kc.onAuthRefreshError && kc.onAuthRefreshError();
+                                    for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
+                                        p.setError(true);
+                                    }
+                                }
+                            }
+                        };
+
+                        req.send(params);
+                    }
+                }
+            }
+
+            if (loginIframe.enable) {
+                var iframePromise = checkLoginIframe();
+                iframePromise.then(function() {
+                    exec();
+                }).catch(function(error) {
+                    promise.setError(error);
+                });
+            } else {
+                exec();
+            }
+
+            return promise.promise;
+        }
+
+        kc.clearToken = function() {
+            if (kc.token) {
+                setToken(null, null, null);
+                kc.onAuthLogout && kc.onAuthLogout();
+                if (kc.loginRequired) {
+                    kc.login();
+                }
+            }
+        }
+
+        function getRealmUrl() {
+            if (typeof kc.authServerUrl !== 'undefined') {
+                if (kc.authServerUrl.charAt(kc.authServerUrl.length - 1) == '/') {
+                    return kc.authServerUrl + 'realms/' + encodeURIComponent(kc.realm);
+                } else {
+                    return kc.authServerUrl + '/realms/' + encodeURIComponent(kc.realm);
+                }
+            } else {
+            	return undefined;
+            }
+        }
+
+        function getOrigin() {
+            if (!window.location.origin) {
+                return window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
+            } else {
+                return window.location.origin;
+            }
+        }
+
+        function processCallback(oauth, promise) {
+            var code = oauth.code;
+            var error = oauth.error;
+            var prompt = oauth.prompt;
+
+            var timeLocal = new Date().getTime();
+
+            if (oauth['kc_action_status']) {
+                kc.onActionUpdate && kc.onActionUpdate(oauth['kc_action_status']);
+            }
+
+            if (error) {
+                if (prompt != 'none') {
+                    var errorData = { error: error, error_description: oauth.error_description };
+                    kc.onAuthError && kc.onAuthError(errorData);
+                    promise && promise.setError(errorData);
+                } else {
+                    promise && promise.setSuccess();
+                }
+                return;
+            } else if ((kc.flow != 'standard') && (oauth.access_token || oauth.id_token)) {
+                authSuccess(oauth.access_token, null, oauth.id_token, true);
+            }
+
+            if ((kc.flow != 'implicit') && code) {
+                var params = 'code=' + code + '&grant_type=authorization_code';
+                var url = kc.endpoints.token();
+
+                var req = new XMLHttpRequest();
+                req.open('POST', url, true);
+                req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+
+                params += '&client_id=' + encodeURIComponent(kc.clientId);
+                params += '&redirect_uri=' + oauth.redirectUri;
+
+                if (oauth.pkceCodeVerifier) {
+                    params += '&code_verifier=' + oauth.pkceCodeVerifier;
+                }
+
+                req.withCredentials = true;
+
+                req.onreadystatechange = function() {
+                    if (req.readyState == 4) {
+                        if (req.status == 200) {
+
+                            var tokenResponse = JSON.parse(req.responseText);
+                            authSuccess(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], kc.flow === 'standard');
+                            scheduleCheckIframe();
+                        } else {
+                            kc.onAuthError && kc.onAuthError();
+                            promise && promise.setError();
+                        }
+                    }
+                };
+
+                req.send(params);
+            }
+
+            function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
+                timeLocal = (timeLocal + new Date().getTime()) / 2;
+
+                setToken(accessToken, refreshToken, idToken, timeLocal);
+
+                if (useNonce && ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||
+                    (kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||
+                    (kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce))) {
+
+                    logInfo('[KEYCLOAK] Invalid nonce, clearing token');
+                    kc.clearToken();
+                    promise && promise.setError();
+                } else {
+                    if (fulfillPromise) {
+                        kc.onAuthSuccess && kc.onAuthSuccess();
+                        promise && promise.setSuccess();
+                    }
+                }
+            }
+
+        }
+
+        function loadConfig(url) {
+            var promise = createPromise();
+            var configUrl;
+
+            if (!config) {
+                configUrl = 'keycloak.json';
+            } else if (typeof config === 'string') {
+                configUrl = config;
+            }
+
+            function setupOidcEndoints(oidcConfiguration) {
+                if (! oidcConfiguration) {
+                    kc.endpoints = {
+                        authorize: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/auth';
+                        },
+                        token: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/token';
+                        },
+                        logout: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/logout';
+                        },
+                        checkSessionIframe: function() {
+                            var src = getRealmUrl() + '/protocol/openid-connect/login-status-iframe.html';
+                            if (kc.iframeVersion) {
+                              src = src + '?version=' + kc.iframeVersion;
+                            }
+                            return src;
+                        },
+                        thirdPartyCookiesIframe: function() {
+                            var src = getRealmUrl() + '/protocol/openid-connect/3p-cookies/step1.html';
+                            if (kc.iframeVersion) {
+                                src = src + '?version=' + kc.iframeVersion;
+                            }
+                            return src;
+                        },
+                        register: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/registrations';
+                        },
+                        userinfo: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/userinfo';
+                        }
+                    };
+                } else {
+                    kc.endpoints = {
+                        authorize: function() {
+                            return oidcConfiguration.authorization_endpoint;
+                        },
+                        token: function() {
+                            return oidcConfiguration.token_endpoint;
+                        },
+                        logout: function() {
+                            if (!oidcConfiguration.end_session_endpoint) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.end_session_endpoint;
+                        },
+                        checkSessionIframe: function() {
+                            if (!oidcConfiguration.check_session_iframe) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.check_session_iframe;
+                        },
+                        register: function() {
+                            throw 'Redirection to "Register user" page not supported in standard OIDC mode';
+                        },
+                        userinfo: function() {
+                            if (!oidcConfiguration.userinfo_endpoint) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.userinfo_endpoint;
+                        }
+                    }
+                }
+            }
+
+            if (configUrl) {
+                var req = new XMLHttpRequest();
+                req.open('GET', configUrl, true);
+                req.setRequestHeader('Accept', 'application/json');
+
+                req.onreadystatechange = function () {
+                    if (req.readyState == 4) {
+                        if (req.status == 200 || fileLoaded(req)) {
+                            var config = JSON.parse(req.responseText);
+
+                            kc.authServerUrl = config['auth-server-url'];
+                            kc.realm = config['realm'];
+                            kc.clientId = config['resource'];
+                            setupOidcEndoints(null);
+                            promise.setSuccess();
+                        } else {
+                            promise.setError();
+                        }
+                    }
+                };
+
+                req.send();
+            } else {
+                if (!config.clientId) {
+                    throw 'clientId missing';
+                }
+
+                kc.clientId = config.clientId;
+
+                var oidcProvider = config['oidcProvider'];
+                if (!oidcProvider) {
+                    if (!config['url']) {
+                        var scripts = document.getElementsByTagName('script');
+                        for (var i = 0; i < scripts.length; i++) {
+                            if (scripts[i].src.match(/.*keycloak\.js/)) {
+                                config.url = scripts[i].src.substr(0, scripts[i].src.indexOf('/js/keycloak.js'));
+                                break;
+                            }
+                        }
+                    }
+                    if (!config.realm) {
+                        throw 'realm missing';
+                    }
+
+                    kc.authServerUrl = config.url;
+                    kc.realm = config.realm;
+                    setupOidcEndoints(null);
+                    promise.setSuccess();
+                } else {
+                    if (typeof oidcProvider === 'string') {
+                        var oidcProviderConfigUrl;
+                        if (oidcProvider.charAt(oidcProvider.length - 1) == '/') {
+                            oidcProviderConfigUrl = oidcProvider + '.well-known/openid-configuration';
+                        } else {
+                            oidcProviderConfigUrl = oidcProvider + '/.well-known/openid-configuration';
+                        }
+                        var req = new XMLHttpRequest();
+                        req.open('GET', oidcProviderConfigUrl, true);
+                        req.setRequestHeader('Accept', 'application/json');
+
+                        req.onreadystatechange = function () {
+                            if (req.readyState == 4) {
+                                if (req.status == 200 || fileLoaded(req)) {
+                                    var oidcProviderConfig = JSON.parse(req.responseText);
+                                    setupOidcEndoints(oidcProviderConfig);
+                                    promise.setSuccess();
+                                } else {
+                                    promise.setError();
+                                }
+                            }
+                        };
+
+                        req.send();
+                    } else {
+                        setupOidcEndoints(oidcProvider);
+                        promise.setSuccess();
+                    }
+                }
+            }
+
+            return promise.promise;
+        }
+
+        function fileLoaded(xhr) {
+            return xhr.status == 0 && xhr.responseText && xhr.responseURL.startsWith('file:');
+        }
+
+        function setToken(token, refreshToken, idToken, timeLocal) {
+            if (kc.tokenTimeoutHandle) {
+                clearTimeout(kc.tokenTimeoutHandle);
+                kc.tokenTimeoutHandle = null;
+            }
+
+            if (refreshToken) {
+                kc.refreshToken = refreshToken;
+                kc.refreshTokenParsed = decodeToken(refreshToken);
+            } else {
+                delete kc.refreshToken;
+                delete kc.refreshTokenParsed;
+            }
+
+            if (idToken) {
+                kc.idToken = idToken;
+                kc.idTokenParsed = decodeToken(idToken);
+            } else {
+                delete kc.idToken;
+                delete kc.idTokenParsed;
+            }
+
+            if (token) {
+                kc.token = token;
+                kc.tokenParsed = decodeToken(token);
+                kc.sessionId = kc.tokenParsed.session_state;
+                kc.authenticated = true;
+                kc.subject = kc.tokenParsed.sub;
+                kc.realmAccess = kc.tokenParsed.realm_access;
+                kc.resourceAccess = kc.tokenParsed.resource_access;
+
+                if (timeLocal) {
+                    kc.timeSkew = Math.floor(timeLocal / 1000) - kc.tokenParsed.iat;
+                }
+
+                if (kc.timeSkew != null) {
+                    logInfo('[KEYCLOAK] Estimated time difference between browser and server is ' + kc.timeSkew + ' seconds');
+
+                    if (kc.onTokenExpired) {
+                        var expiresIn = (kc.tokenParsed['exp'] - (new Date().getTime() / 1000) + kc.timeSkew) * 1000;
+                        logInfo('[KEYCLOAK] Token expires in ' + Math.round(expiresIn / 1000) + ' s');
+                        if (expiresIn <= 0) {
+                            kc.onTokenExpired();
+                        } else {
+                            kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn);
+                        }
+                    }
+                }
+            } else {
+                delete kc.token;
+                delete kc.tokenParsed;
+                delete kc.subject;
+                delete kc.realmAccess;
+                delete kc.resourceAccess;
+
+                kc.authenticated = false;
+            }
+        }
+
+        function decodeToken(str) {
+            str = str.split('.')[1];
+
+            str = str.replace(/-/g, '+');
+            str = str.replace(/_/g, '/');
+            switch (str.length % 4) {
+                case 0:
+                    break;
+                case 2:
+                    str += '==';
+                    break;
+                case 3:
+                    str += '=';
+                    break;
+                default:
+                    throw 'Invalid token';
+            }
+
+            str = decodeURIComponent(escape(atob(str)));
+
+            str = JSON.parse(str);
+            return str;
+        }
+
+        function createUUID() {
+            var hexDigits = '0123456789abcdef';
+            var s = generateRandomString(36, hexDigits).split("");
+            s[14] = '4';
+            s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
+            s[8] = s[13] = s[18] = s[23] = '-';
+            var uuid = s.join('');
+            return uuid;
+        }
+
+        function parseCallback(url) {
+            var oauth = parseCallbackUrl(url);
+            if (!oauth) {
+                return;
+            }
+
+            var oauthState = callbackStorage.get(oauth.state);
+
+            if (oauthState) {
+                oauth.valid = true;
+                oauth.redirectUri = oauthState.redirectUri;
+                oauth.storedNonce = oauthState.nonce;
+                oauth.prompt = oauthState.prompt;
+                oauth.pkceCodeVerifier = oauthState.pkceCodeVerifier;
+            }
+
+            return oauth;
+        }
+
+        function parseCallbackUrl(url) {
+            var supportedParams;
+            switch (kc.flow) {
+                case 'standard':
+                    supportedParams = ['code', 'state', 'session_state', 'kc_action_status'];
+                    break;
+                case 'implicit':
+                    supportedParams = ['access_token', 'token_type', 'id_token', 'state', 'session_state', 'expires_in', 'kc_action_status'];
+                    break;
+                case 'hybrid':
+                    supportedParams = ['access_token', 'token_type', 'id_token', 'code', 'state', 'session_state', 'expires_in', 'kc_action_status'];
+                    break;
+            }
+
+            supportedParams.push('error');
+            supportedParams.push('error_description');
+            supportedParams.push('error_uri');
+
+            var queryIndex = url.indexOf('?');
+            var fragmentIndex = url.indexOf('#');
+
+            var newUrl;
+            var parsed;
+
+            if (kc.responseMode === 'query' && queryIndex !== -1) {
+                newUrl = url.substring(0, queryIndex);
+                parsed = parseCallbackParams(url.substring(queryIndex + 1, fragmentIndex !== -1 ? fragmentIndex : url.length), supportedParams);
+                if (parsed.paramsString !== '') {
+                    newUrl += '?' + parsed.paramsString;
+                }
+                if (fragmentIndex !== -1) {
+                    newUrl += url.substring(fragmentIndex);
+                }
+            } else if (kc.responseMode === 'fragment' && fragmentIndex !== -1) {
+                newUrl = url.substring(0, fragmentIndex);
+                parsed = parseCallbackParams(url.substring(fragmentIndex + 1), supportedParams);
+                if (parsed.paramsString !== '') {
+                    newUrl += '#' + parsed.paramsString;
+                }
+            }
+
+            if (parsed && parsed.oauthParams) {
+                if (kc.flow === 'standard' || kc.flow === 'hybrid') {
+                    if ((parsed.oauthParams.code || parsed.oauthParams.error) && parsed.oauthParams.state) {
+                        parsed.oauthParams.newUrl = newUrl;
+                        return parsed.oauthParams;
+                    }
+                } else if (kc.flow === 'implicit') {
+                    if ((parsed.oauthParams.access_token || parsed.oauthParams.error) && parsed.oauthParams.state) {
+                        parsed.oauthParams.newUrl = newUrl;
+                        return parsed.oauthParams;
+                    }
+                }
+            }
+        }
+
+        function parseCallbackParams(paramsString, supportedParams) {
+            var p = paramsString.split('&');
+            var result = {
+                paramsString: '',
+                oauthParams: {}
+            }
+            for (var i = 0; i < p.length; i++) {
+                var split = p[i].indexOf("=");
+                var key = p[i].slice(0, split);
+                if (supportedParams.indexOf(key) !== -1) {
+                    result.oauthParams[key] = p[i].slice(split + 1);
+                } else {
+                    if (result.paramsString !== '') {
+                        result.paramsString += '&';
+                    }
+                    result.paramsString += p[i];
+                }
+            }
+            return result;
+        }
+
+        function createPromise() {
+            // Need to create a native Promise which also preserves the
+            // interface of the custom promise type previously used by the API
+            var p = {
+                setSuccess: function(result) {
+                    p.resolve(result);
+                },
+
+                setError: function(result) {
+                    p.reject(result);
+                }
+            };
+            p.promise = new Promise(function(resolve, reject) {
+                p.resolve = resolve;
+                p.reject = reject;
+            });
+
+            p.promise.success = function(callback) {
+                logPromiseDeprecation();
+
+                this.then(function handleSuccess(value) {
+                    callback(value);
+                });
+
+                return this;
+            }
+
+            p.promise.error = function(callback) {
+                logPromiseDeprecation();
+
+                this.catch(function handleError(error) {
+                    callback(error);
+                });
+
+                return this;
+            }
+
+            return p;
+        }
+
+        // Function to extend existing native Promise with timeout
+        function applyTimeoutToPromise(promise, timeout, errorMessage) {
+            var timeoutHandle = null;
+            var timeoutPromise = new Promise(function (resolve, reject) {
+                timeoutHandle = setTimeout(function () {
+                    reject({ "error": errorMessage || "Promise is not settled within timeout of " + timeout + "ms" });
+                }, timeout);
+            });
+
+            return Promise.race([promise, timeoutPromise]).finally(function () {
+                clearTimeout(timeoutHandle);
+            });
+        }
+
+        function setupCheckLoginIframe() {
+            var promise = createPromise();
+
+            if (!loginIframe.enable) {
+                promise.setSuccess();
+                return promise.promise;
+            }
+
+            if (loginIframe.iframe) {
+                promise.setSuccess();
+                return promise.promise;
+            }
+
+            var iframe = document.createElement('iframe');
+            loginIframe.iframe = iframe;
+
+            iframe.onload = function() {
+                var authUrl = kc.endpoints.authorize();
+                if (authUrl.charAt(0) === '/') {
+                    loginIframe.iframeOrigin = getOrigin();
+                } else {
+                    loginIframe.iframeOrigin = authUrl.substring(0, authUrl.indexOf('/', 8));
+                }
+                promise.setSuccess();
+            }
+
+            var src = kc.endpoints.checkSessionIframe();
+            iframe.setAttribute('src', src );
+            iframe.setAttribute('title', 'keycloak-session-iframe' );
+            iframe.style.display = 'none';
+            document.body.appendChild(iframe);
+
+            var messageCallback = function(event) {
+                if ((event.origin !== loginIframe.iframeOrigin) || (loginIframe.iframe.contentWindow !== event.source)) {
+                    return;
+                }
+
+                if (!(event.data == 'unchanged' || event.data == 'changed' || event.data == 'error')) {
+                    return;
+                }
+
+
+                if (event.data != 'unchanged') {
+                    kc.clearToken();
+                }
+
+                var callbacks = loginIframe.callbackList.splice(0, loginIframe.callbackList.length);
+
+                for (var i = callbacks.length - 1; i >= 0; --i) {
+                    var promise = callbacks[i];
+                    if (event.data == 'error') {
+                        promise.setError();
+                    } else {
+                        promise.setSuccess(event.data == 'unchanged');
+                    }
+                }
+            };
+
+            window.addEventListener('message', messageCallback, false);
+
+            return promise.promise;
+        }
+
+        function scheduleCheckIframe() {
+            if (loginIframe.enable) {
+                if (kc.token) {
+                    setTimeout(function() {
+                        checkLoginIframe().then(function(unchanged) {
+                            if (unchanged) {
+                                scheduleCheckIframe();
+                            }
+                        });
+                    }, loginIframe.interval * 1000);
+                }
+            }
+        }
+
+        function checkLoginIframe() {
+            var promise = createPromise();
+
+            if (loginIframe.iframe && loginIframe.iframeOrigin ) {
+                var msg = kc.clientId + ' ' + (kc.sessionId ? kc.sessionId : '');
+                loginIframe.callbackList.push(promise);
+                var origin = loginIframe.iframeOrigin;
+                if (loginIframe.callbackList.length == 1) {
+                    loginIframe.iframe.contentWindow.postMessage(msg, origin);
+                }
+            } else {
+                promise.setSuccess();
+            }
+
+            return promise.promise;
+        }
+
+        function check3pCookiesSupported() {
+            var promise = createPromise();
+
+            if (loginIframe.enable || kc.silentCheckSsoRedirectUri) {
+                var iframe = document.createElement('iframe');
+                iframe.setAttribute('src', kc.endpoints.thirdPartyCookiesIframe());
+                iframe.setAttribute('title', 'keycloak-3p-check-iframe' );
+                iframe.style.display = 'none';
+                document.body.appendChild(iframe);
+
+                var messageCallback = function(event) {
+                    if (iframe.contentWindow !== event.source) {
+                        return;
+                    }
+
+                    if (event.data !== "supported" && event.data !== "unsupported") {
+                        return;
+                    } else if (event.data === "unsupported") {
+                        loginIframe.enable = false;
+                        if (kc.silentCheckSsoFallback) {
+                            kc.silentCheckSsoRedirectUri = false;
+                        }
+                        logWarn("[KEYCLOAK] 3rd party cookies aren't supported by this browser. checkLoginIframe and " +
+                            "silent check-sso are not available.")
+                    }
+
+                    document.body.removeChild(iframe);
+                    window.removeEventListener("message", messageCallback);
+                    promise.setSuccess();
+                };
+
+                window.addEventListener('message', messageCallback, false);
+            } else {
+                promise.setSuccess();
+            }
+
+            return applyTimeoutToPromise(promise.promise, kc.messageReceiveTimeout, "Timeout when waiting for 3rd party check iframe message.");
+        }
+
+        function loadAdapter(type) {
+            if (!type || type == 'default') {
+                return {
+                    login: function(options) {
+                        window.location.replace(kc.createLoginUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    logout: function(options) {
+                        window.location.replace(kc.createLogoutUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    register: function(options) {
+                        window.location.replace(kc.createRegisterUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            window.location.href = accountUrl;
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                        return createPromise().promise;
+                    },
+
+                    redirectUri: function(options, encodeHash) {
+                        if (arguments.length == 1) {
+                            encodeHash = true;
+                        }
+
+                        if (options && options.redirectUri) {
+                            return options.redirectUri;
+                        } else if (kc.redirectUri) {
+                            return kc.redirectUri;
+                        } else {
+                            return location.href;
+                        }
+                    }
+                };
+            }
+
+            if (type == 'cordova') {
+                loginIframe.enable = false;
+                var cordovaOpenWindowWrapper = function(loginUrl, target, options) {
+                    if (window.cordova && window.cordova.InAppBrowser) {
+                        // Use inappbrowser for IOS and Android if available
+                        return window.cordova.InAppBrowser.open(loginUrl, target, options);
+                    } else {
+                        return window.open(loginUrl, target, options);
+                    }
+                };
+
+                var shallowCloneCordovaOptions = function (userOptions) {
+                    if (userOptions && userOptions.cordovaOptions) {
+                        return Object.keys(userOptions.cordovaOptions).reduce(function (options, optionName) {
+                            options[optionName] = userOptions.cordovaOptions[optionName];
+                            return options;
+                        }, {});
+                    } else {
+                        return {};
+                    }
+                };
+
+                var formatCordovaOptions = function (cordovaOptions) {
+                    return Object.keys(cordovaOptions).reduce(function (options, optionName) {
+                        options.push(optionName+"="+cordovaOptions[optionName]);
+                        return options;
+                    }, []).join(",");
+                };
+
+                var createCordovaOptions = function (userOptions) {
+                    var cordovaOptions = shallowCloneCordovaOptions(userOptions);
+                    cordovaOptions.location = 'no';
+                    if (userOptions && userOptions.prompt == 'none') {
+                        cordovaOptions.hidden = 'yes';
+                    }
+                    return formatCordovaOptions(cordovaOptions);
+                };
+
+                return {
+                    login: function(options) {
+                        var promise = createPromise();
+
+                        var cordovaOptions = createCordovaOptions(options);
+                        var loginUrl = kc.createLoginUrl(options);
+                        var ref = cordovaOpenWindowWrapper(loginUrl, '_blank', cordovaOptions);
+                        var completed = false;
+
+                        var closed = false;
+                        var closeBrowser = function() {
+                            closed = true;
+                            ref.close();
+                        };
+
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                var callback = parseCallback(event.url);
+                                processCallback(callback, promise);
+                                closeBrowser();
+                                completed = true;
+                            }
+                        });
+
+                        ref.addEventListener('loaderror', function(event) {
+                            if (!completed) {
+                                if (event.url.indexOf('http://localhost') == 0) {
+                                    var callback = parseCallback(event.url);
+                                    processCallback(callback, promise);
+                                    closeBrowser();
+                                    completed = true;
+                                } else {
+                                    promise.setError();
+                                    closeBrowser();
+                                }
+                            }
+                        });
+
+                        ref.addEventListener('exit', function(event) {
+                            if (!closed) {
+                                promise.setError({
+                                    reason: "closed_by_user"
+                                });
+                            }
+                        });
+
+                        return promise.promise;
+                    },
+
+                    logout: function(options) {
+                        var promise = createPromise();
+
+                        var logoutUrl = kc.createLogoutUrl(options);
+                        var ref = cordovaOpenWindowWrapper(logoutUrl, '_blank', 'location=no,hidden=yes,clearcache=yes');
+
+                        var error;
+
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                            }
+                        });
+
+                        ref.addEventListener('loaderror', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                            } else {
+                                error = true;
+                                ref.close();
+                            }
+                        });
+
+                        ref.addEventListener('exit', function(event) {
+                            if (error) {
+                                promise.setError();
+                            } else {
+                                kc.clearToken();
+                                promise.setSuccess();
+                            }
+                        });
+
+                        return promise.promise;
+                    },
+
+                    register : function(options) {
+                        var promise = createPromise();
+                        var registerUrl = kc.createRegisterUrl();
+                        var cordovaOptions = createCordovaOptions(options);
+                        var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                                var oauth = parseCallback(event.url);
+                                processCallback(oauth, promise);
+                            }
+                        });
+                        return promise.promise;
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            var ref = cordovaOpenWindowWrapper(accountUrl, '_blank', 'location=no');
+                            ref.addEventListener('loadstart', function(event) {
+                                if (event.url.indexOf('http://localhost') == 0) {
+                                    ref.close();
+                                }
+                            });
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                    },
+
+                    redirectUri: function(options) {
+                        return 'http://localhost';
+                    }
+                }
+            }
+
+            if (type == 'cordova-native') {
+                loginIframe.enable = false;
+
+                return {
+                    login: function(options) {
+                        var promise = createPromise();
+                        var loginUrl = kc.createLoginUrl(options);
+
+                        universalLinks.subscribe('keycloak', function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            var oauth = parseCallback(event.url);
+                            processCallback(oauth, promise);
+                        });
+
+                        window.cordova.plugins.browsertab.openUrl(loginUrl);
+                        return promise.promise;
+                    },
+
+                    logout: function(options) {
+                        var promise = createPromise();
+                        var logoutUrl = kc.createLogoutUrl(options);
+
+                        universalLinks.subscribe('keycloak', function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            kc.clearToken();
+                            promise.setSuccess();
+                        });
+
+                        window.cordova.plugins.browsertab.openUrl(logoutUrl);
+                        return promise.promise;
+                    },
+
+                    register : function(options) {
+                        var promise = createPromise();
+                        var registerUrl = kc.createRegisterUrl(options);
+                        universalLinks.subscribe('keycloak' , function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            var oauth = parseCallback(event.url);
+                            processCallback(oauth, promise);
+                        });
+                        window.cordova.plugins.browsertab.openUrl(registerUrl);
+                        return promise.promise;
+
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            window.cordova.plugins.browsertab.openUrl(accountUrl);
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                    },
+
+                    redirectUri: function(options) {
+                        if (options && options.redirectUri) {
+                            return options.redirectUri;
+                        } else if (kc.redirectUri) {
+                            return kc.redirectUri;
+                        } else {
+                            return "http://localhost";
+                        }
+                    }
+                }
+            }
+
+            throw 'invalid adapter type: ' + type;
+        }
+
+        var LocalStorage = function() {
+            if (!(this instanceof LocalStorage)) {
+                return new LocalStorage();
+            }
+
+            localStorage.setItem('kc-test', 'test');
+            localStorage.removeItem('kc-test');
+
+            var cs = this;
+
+            function clearExpired() {
+                var time = new Date().getTime();
+                for (var i = 0; i < localStorage.length; i++)  {
+                    var key = localStorage.key(i);
+                    if (key && key.indexOf('kc-callback-') == 0) {
+                        var value = localStorage.getItem(key);
+                        if (value) {
+                            try {
+                                var expires = JSON.parse(value).expires;
+                                if (!expires || expires < time) {
+                                    localStorage.removeItem(key);
+                                }
+                            } catch (err) {
+                                localStorage.removeItem(key);
+                            }
+                        }
+                    }
+                }
+            }
+
+            cs.get = function(state) {
+                if (!state) {
+                    return;
+                }
+
+                var key = 'kc-callback-' + state;
+                var value = localStorage.getItem(key);
+                if (value) {
+                    localStorage.removeItem(key);
+                    value = JSON.parse(value);
+                }
+
+                clearExpired();
+                return value;
+            };
+
+            cs.add = function(state) {
+                clearExpired();
+
+                var key = 'kc-callback-' + state.state;
+                state.expires = new Date().getTime() + (60 * 60 * 1000);
+                localStorage.setItem(key, JSON.stringify(state));
+            };
+        };
+
+        var CookieStorage = function() {
+            if (!(this instanceof CookieStorage)) {
+                return new CookieStorage();
+            }
+
+            var cs = this;
+
+            cs.get = function(state) {
+                if (!state) {
+                    return;
+                }
+
+                var value = getCookie('kc-callback-' + state);
+                setCookie('kc-callback-' + state, '', cookieExpiration(-100));
+                if (value) {
+                    return JSON.parse(value);
+                }
+            };
+
+            cs.add = function(state) {
+                setCookie('kc-callback-' + state.state, JSON.stringify(state), cookieExpiration(60));
+            };
+
+            cs.removeItem = function(key) {
+                setCookie(key, '', cookieExpiration(-100));
+            };
+
+            var cookieExpiration = function (minutes) {
+                var exp = new Date();
+                exp.setTime(exp.getTime() + (minutes*60*1000));
+                return exp;
+            };
+
+            var getCookie = function (key) {
+                var name = key + '=';
+                var ca = document.cookie.split(';');
+                for (var i = 0; i < ca.length; i++) {
+                    var c = ca[i];
+                    while (c.charAt(0) == ' ') {
+                        c = c.substring(1);
+                    }
+                    if (c.indexOf(name) == 0) {
+                        return c.substring(name.length, c.length);
+                    }
+                }
+                return '';
+            };
+
+            var setCookie = function (key, value, expirationDate) {
+                var cookie = key + '=' + value + '; '
+                    + 'expires=' + expirationDate.toUTCString() + '; ';
+                document.cookie = cookie;
+            }
+        };
+
+        function createCallbackStorage() {
+            try {
+                return new LocalStorage();
+            } catch (err) {
+            }
+
+            return new CookieStorage();
+        }
+
+        function createLogger(fn) {
+            return function() {
+                if (kc.enableLogging) {
+                    fn.apply(console, Array.prototype.slice.call(arguments));
+                }
+            };
+        }
+    }
+
+    return Keycloak;
+})
diff --git a/BMA.EHR.Report.Service/wwwroot/keycloak.json b/BMA.EHR.Report.Service/wwwroot/keycloak.json
new file mode 100644
index 00000000..9eba3b39
--- /dev/null
+++ b/BMA.EHR.Report.Service/wwwroot/keycloak.json
@@ -0,0 +1,7 @@
+{
+  "realm": "bma-ehr",
+  "auth-server-url": "https://identity.frappet.com",
+  "ssl-required": "external",
+  "resource": "bma-ehr",
+  "public-client": true
+}
\ No newline at end of file
diff --git a/BMA.EHR.Solution.sln b/BMA.EHR.Solution.sln
index 51a7c74b..58eade2a 100644
--- a/BMA.EHR.Solution.sln
+++ b/BMA.EHR.Solution.sln
@@ -15,12 +15,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F3C2F68F-8DC
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Service", "Service", "{FA618F0C-1AF5-49AB-AE13-C020B403B64F}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.API.Command", "BMA.EHR.API.Command\BMA.EHR.API.Command.csproj", "{FC7215BD-5651-4226-9210-8894E8FA8767}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Placement.Service", "BMA.EHR.Placement.Service\BMA.EHR.Placement.Service.csproj", "{81610EF7-AF80-44D8-9263-925C821CF45F}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.OrganizationEmployee.Service", "BMA.EHR.OrganizationEmployee.Service\BMA.EHR.OrganizationEmployee.Service.csproj", "{A54AA069-8B0E-4784-953B-5DA9F9C8285E}"
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.OrganizationEmployee.Service", "BMA.EHR.OrganizationEmployee.Service\BMA.EHR.OrganizationEmployee.Service.csproj", "{A54AA069-8B0E-4784-953B-5DA9F9C8285E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Command.Service", "BMA.EHR.Command.Service\BMA.EHR.Command.Service.csproj", "{E4E905EE-61DF-4451-B063-5C86BC7574CE}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -44,10 +45,6 @@ Global
 		{939DD34A-C7AE-406E-B557-33F69AC64127}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{939DD34A-C7AE-406E-B557-33F69AC64127}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{939DD34A-C7AE-406E-B557-33F69AC64127}.Release|Any CPU.Build.0 = Release|Any CPU
-		{FC7215BD-5651-4226-9210-8894E8FA8767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{FC7215BD-5651-4226-9210-8894E8FA8767}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{FC7215BD-5651-4226-9210-8894E8FA8767}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{FC7215BD-5651-4226-9210-8894E8FA8767}.Release|Any CPU.Build.0 = Release|Any CPU
 		{81610EF7-AF80-44D8-9263-925C821CF45F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{81610EF7-AF80-44D8-9263-925C821CF45F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{81610EF7-AF80-44D8-9263-925C821CF45F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -60,6 +57,10 @@ Global
 		{AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -70,10 +71,10 @@ Global
 		{F83D3633-4A7A-432A-9E47-29378F4D175F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
 		{939DD34A-C7AE-406E-B557-33F69AC64127} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 		{FA618F0C-1AF5-49AB-AE13-C020B403B64F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
-		{FC7215BD-5651-4226-9210-8894E8FA8767} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
 		{81610EF7-AF80-44D8-9263-925C821CF45F} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 		{A54AA069-8B0E-4784-953B-5DA9F9C8285E} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 		{AC4B2602-C543-4165-85D7-F6F92F553D80} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
+		{E4E905EE-61DF-4451-B063-5C86BC7574CE} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A}