apiร้องเรียน
This commit is contained in:
parent
2cdf724d58
commit
d06e1af217
24 changed files with 34538 additions and 91 deletions
|
|
@ -51,7 +51,7 @@ namespace BMA.EHR.Application
|
|||
|
||||
public static IServiceCollection AddDisciplineApplication(this IServiceCollection services)
|
||||
{
|
||||
// services.AddTransient<DutyTimeRepository>();
|
||||
services.AddTransient<MinIODisciplineService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
|
|
|||
449
BMA.EHR.Application/Repositories/MinIODisciplineService.cs
Normal file
449
BMA.EHR.Application/Repositories/MinIODisciplineService.cs
Normal file
|
|
@ -0,0 +1,449 @@
|
|||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Net.Http.Headers;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using MimeTypes;
|
||||
using BMA.EHR.Domain.Models.Discipline;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
public class MinIODisciplineService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly IDisciplineDbContext _dbContext;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly AmazonS3Client _s3Client;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private string _bucketName = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructors "
|
||||
|
||||
public MinIODisciplineService(IDisciplineDbContext dbContext,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_configuration = configuration;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
_s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
this._bucketName = _configuration["MinIO:BucketName"] ?? "bma-recruit";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<Document> UploadFileAsync(IFormFile file, string newFileName = "")
|
||||
{
|
||||
var fileName = "";
|
||||
var fileExt = Path.GetExtension(file.FileName);
|
||||
if (newFileName != "")
|
||||
fileName = $"{newFileName}";
|
||||
else
|
||||
fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
|
||||
|
||||
|
||||
var tmpDir = Path.Combine("tmp");
|
||||
if (!Directory.Exists(tmpDir))
|
||||
Directory.CreateDirectory(tmpDir);
|
||||
|
||||
var tmpFile = Path.Combine(tmpDir, $"tmp_{DateTime.Now.ToString("ddMMyyyyHHmmss")}{fileExt}");
|
||||
|
||||
try
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
file.CopyTo(ms);
|
||||
var fileBytes = ms.ToArray();
|
||||
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileBytes);
|
||||
|
||||
var request = new PutObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = id.ToString("D"),
|
||||
InputStream = filestream,
|
||||
ContentType = file.ContentType,
|
||||
CannedACL = S3CannedACL.PublicRead
|
||||
};
|
||||
|
||||
await _s3Client.PutObjectAsync(request);
|
||||
|
||||
// create document object
|
||||
var doc = new Document()
|
||||
{
|
||||
FileName = fileName,
|
||||
FileType = file.ContentType,
|
||||
FileSize = Convert.ToInt32(file.Length),
|
||||
ObjectRefId = id,
|
||||
CreatedDate = DateTime.Now
|
||||
};
|
||||
await _dbContext.Set<Document>().AddAsync(doc);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(tmpFile);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<FileDownloadResponse> DownloadFileAsync(Guid fileId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = await _dbContext.Set<Document>().AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
GetObjectRequest request = new GetObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc.ObjectRefId.ToString("D")
|
||||
};
|
||||
|
||||
using (GetObjectResponse response = await _s3Client.GetObjectAsync(request))
|
||||
{
|
||||
using (Stream responseStream = response.ResponseStream)
|
||||
{
|
||||
responseStream.CopyTo(memoryStream);
|
||||
}
|
||||
}
|
||||
|
||||
var fileContent = memoryStream.ToArray();
|
||||
|
||||
return new FileDownloadResponse
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
FileType = doc.FileType,
|
||||
FileContent = fileContent
|
||||
};
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteFileAsync(Guid fileId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = await _dbContext.Set<Document>().AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
else
|
||||
{
|
||||
DeleteObjectRequest request = new DeleteObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc?.ObjectRefId.ToString("D")
|
||||
};
|
||||
|
||||
// delete from minio
|
||||
await _s3Client.DeleteObjectAsync(request);
|
||||
|
||||
_dbContext.Set<Document>().Remove(doc);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> ImagesPath(Guid? fileId)
|
||||
{
|
||||
if (fileId == null)
|
||||
return "";
|
||||
|
||||
var doc = await _dbContext.Set<Document>().AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||
var _protocol = _configuration["Protocol"];
|
||||
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc?.ObjectRefId.ToString("D"),
|
||||
Expires = expires,
|
||||
Protocol = _protocol == "HTTPS" ? Protocol.HTTPS : Protocol.HTTP
|
||||
};
|
||||
string path = _s3Client.GetPreSignedURL(request);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public async Task<string> ImagesPathByName(string fileName)
|
||||
{
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||
var _protocol = _configuration["Protocol"];
|
||||
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = fileName,
|
||||
Expires = expires,
|
||||
Protocol = _protocol == "HTTPS" ? Protocol.HTTPS : Protocol.HTTP
|
||||
};
|
||||
string path = _s3Client.GetPreSignedURL(request);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async Task<bool> IsExistBucketAsync(string bucketName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _s3Client.ListObjectsV2Async(new ListObjectsV2Request
|
||||
{
|
||||
BucketName = bucketName
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> CreateBucketAsync(string bucketName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var request = new PutBucketRequest
|
||||
{
|
||||
BucketName = bucketName,
|
||||
UseClientRegion = true,
|
||||
};
|
||||
|
||||
var response = await _s3Client.PutBucketAsync(request);
|
||||
return response.HttpStatusCode == System.Net.HttpStatusCode.OK;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// public List<Guid> GetAllIdByRoot(Guid? id)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var ret = new List<Guid>();
|
||||
// if (id == null)
|
||||
// return ret;
|
||||
|
||||
// var oc = _dbContext.Set<OrganizationEntity>().FirstOrDefault(x => x.Id == id);
|
||||
// if (oc != null)
|
||||
// ret.Add(oc.Id);
|
||||
|
||||
// var child = _dbContext.Set<OrganizationEntity>().AsQueryable().Where(x => x.Parent != null && x.Parent.Id == id).ToList();
|
||||
// if (child.Any())
|
||||
// {
|
||||
// foreach (var item in child)
|
||||
// {
|
||||
// ret.AddRange(GetAllIdByRoot(item.Id));
|
||||
// }
|
||||
// }
|
||||
|
||||
// return ret;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public async Task<string?> CheckBmaOfficer(string CitizenId)
|
||||
// {
|
||||
// var data = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == CitizenId);
|
||||
// if (data == null)
|
||||
// return null;
|
||||
// if (data.ProfileType.Trim().ToUpper() == "OFFICER")
|
||||
// return "OFFICER";
|
||||
// if (data.EmployeeClass.Trim().ToUpper() == "PERM")
|
||||
// return "EMPLOYEE_PERM";
|
||||
// if (data.EmployeeClass.Trim().ToUpper() == "TEMP")
|
||||
// return "EMPLOYEE_TEMP";
|
||||
// return "EMPLOYEE";
|
||||
// }
|
||||
|
||||
public async Task UploadFileAsyncTemp(string fileName, string subFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileContents = File.ReadAllBytes(fileName);
|
||||
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents);
|
||||
//var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName);
|
||||
var fileExt = Path.GetExtension(fileName);
|
||||
var fileType = MimeTypeMap.GetMimeType(fileExt);
|
||||
var file_name = Path.GetFileName(fileName);
|
||||
|
||||
var request = new PutObjectRequest
|
||||
{
|
||||
BucketName = $"{_bucketName}",
|
||||
// BucketName = $"{_bucketName}{subFolder}",
|
||||
Key = file_name,
|
||||
InputStream = filestream,
|
||||
ContentType = fileType,
|
||||
CannedACL = S3CannedACL.PublicRead
|
||||
};
|
||||
|
||||
await _s3Client.PutObjectAsync(request);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UploadFileAsync(string fileName, MemoryStream fileStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var fileTransferUtility = new TransferUtility(_s3Client);
|
||||
|
||||
var fileExt = Path.GetExtension(fileName);
|
||||
var fileType = MimeTypeMap.GetMimeType(fileExt);
|
||||
//var file_name = Path.GetFileName(fileName);
|
||||
|
||||
var request = new PutObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = fileName,
|
||||
InputStream = fileStream,
|
||||
ContentType = fileType,
|
||||
CannedACL = S3CannedACL.BucketOwnerFullControl
|
||||
};
|
||||
|
||||
await _s3Client.PutObjectAsync(request);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UploadFileAsync(string fileName, string subFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileContents = File.ReadAllBytes(fileName);
|
||||
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents);
|
||||
//var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName);
|
||||
var fileExt = Path.GetExtension(fileName);
|
||||
var fileType = MimeTypeMap.GetMimeType(fileExt);
|
||||
var file_name = Path.GetFileName(fileName);
|
||||
|
||||
var request = new PutObjectRequest
|
||||
{
|
||||
//BucketName = $"{_bucketName}",
|
||||
BucketName = $"{_bucketName}{subFolder}",
|
||||
Key = file_name,
|
||||
InputStream = filestream,
|
||||
ContentType = fileType,
|
||||
CannedACL = S3CannedACL.PublicRead
|
||||
};
|
||||
|
||||
await _s3Client.PutObjectAsync(request);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task GenerateJsonFile(string json, string path, string fileName)
|
||||
{
|
||||
var tmpDir = Path.Combine("tmp");
|
||||
if (!Directory.Exists(tmpDir))
|
||||
Directory.CreateDirectory(tmpDir);
|
||||
|
||||
var tmpFile = Path.Combine(tmpDir, $"{fileName}.json");
|
||||
|
||||
try
|
||||
{
|
||||
SaveToJsonFile(tmpFile, json);
|
||||
await UploadFileAsyncTemp(tmpFile, path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tmpFile != "")
|
||||
{
|
||||
if (System.IO.File.Exists(tmpFile))
|
||||
System.IO.File.Delete(tmpFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveToJsonFile(string fileName, string data)
|
||||
{
|
||||
TextWriter writer = null;
|
||||
try
|
||||
{
|
||||
writer = new StreamWriter(fileName);
|
||||
writer.Write(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (writer != null)
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -19,15 +19,15 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("ระบบวินัย")]
|
||||
[SwaggerTag("ระบบวินัยเรื่องร้องเรียน")]
|
||||
public class DisciplineComplaintController : BaseController
|
||||
{
|
||||
private readonly DisciplineDbContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly MinIODisciplineService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public DisciplineComplaintController(DisciplineDbContext context,
|
||||
MinIOService documentService,
|
||||
MinIODisciplineService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
// _repository = repository;
|
||||
|
|
@ -41,11 +41,41 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
public static string TextOffenseDetails(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "NOT_SPECIFIED": return "ยังไม่ระบุ";
|
||||
case "NOT_DEADLY": return "ร้ายแรง";
|
||||
case "DEADLY": return "ไม่ร้ายแรง";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
public static string TextLevelConsideration(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "NORMAL": return "ปกติ";
|
||||
case "URGENT": return "ด่วน";
|
||||
case "VERT_URGENT": return "ด่วนมาก";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
public static string TextStatus(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "NEW": return "ใหม่";
|
||||
case "STOP": return "ยุติเรื่อง";
|
||||
case "SEND_INVESTIGATE": return "มีมูลส่งไปสืบสวนแล้ว";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// list รายการวินัย
|
||||
/// list รายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -53,29 +83,42 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetDisciplineComplaint(int page = 1, int pageSize = 25, string keyword = "")
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
var data_search = (from x in _context.DisciplineComplaints
|
||||
where x.Title.Contains(keyword) ||
|
||||
x.Description.Contains(keyword) ||
|
||||
x.Appellant.Contains(keyword)
|
||||
// TextOffenseDetails(x.OffenseDetails).Contains(keyword) ||
|
||||
// x.CreatedAt.Contains(keyword) ||
|
||||
// TextLevelConsideration(x.LevelConsideration).Contains(keyword) ||
|
||||
// x.DateConsideration.Contains(keyword) ||
|
||||
// TextStatus(x.Status).Contains(keyword) ||
|
||||
// x.RejectReason == null ? false : x.RejectReason.Contains(keyword)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
Description = x.Description,//รายละเอียด
|
||||
//Respondent = x.xxx,//ผู้ถูกร้องเรียน
|
||||
DescMistake = x.OffenseDetails,//ลักษณะความผิด
|
||||
Appellant = x.Appellant,//ผู้ถูกร้องเรียน
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องร้องเรียน
|
||||
DevLevel = x.LevelConsideration,//ระดับการพัฒนา
|
||||
ConsiderationDate = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
ComplaintStatus = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
|
||||
LevelConsideration = x.LevelConsideration,//ระดับการพิจารณา
|
||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
Status = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
|
||||
RejectReason = x.RejectReason,//หมายเหตุยุติเรื่อง
|
||||
})
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
return Success(new { data, total = data.Count() });
|
||||
.ToList();
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัย
|
||||
/// get รายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -83,30 +126,84 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
|
||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineComplaint(Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
var _data = await _context.DisciplineComplaints
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
RespondentType = x.RespondentType,//ผู้ถูกร้องเรียน
|
||||
Persons = x.DisciplineComplaint_Profiles.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
Idcard = p.CitizenId,
|
||||
Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
Prefix = p.Prefix,
|
||||
FirstName = p.FirstName,
|
||||
LastName = p.LastName,
|
||||
Position = p.Position,
|
||||
PositionLevel = p.PositionLevel,
|
||||
Salary = p.Salary,
|
||||
PersonId = p.PersonId,
|
||||
PosNo = p.PosNo,
|
||||
Organization = p.Organization,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกร้องเรียน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
Description = x.Description,//รายละเอียด
|
||||
//Respondent = x.xxx,//ผู้ถูกร้องเรียน
|
||||
DescMistake = x.OffenseDetails,//ลักษณะความผิด
|
||||
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องร้องเรียน
|
||||
DevLevel = x.LevelConsideration,//ระดับการพัฒนา
|
||||
ConsiderationDate = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
ComplaintStatus = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
|
||||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
ComplaintFrom = x.ComplaintFrom,//รับเรื่องร้องเรียนจาก
|
||||
Appellant = x.Appellant,//ผู้ถูกร้องเรียน
|
||||
Status = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
|
||||
RejectReason = x.RejectReason,//หมายเหตุยุติเรื่อง
|
||||
DisciplineComplaintDocs = x.DisciplineComplaint_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
if (_data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
var disciplineComplaintDocs = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineComplaintDocs)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineComplaintDocs.Add(_doc);
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
_data.Id,
|
||||
_data.RespondentType,
|
||||
_data.Persons,
|
||||
_data.OrganizationId,
|
||||
_data.ConsideredAgency,
|
||||
_data.Title,
|
||||
_data.Description,
|
||||
_data.DateReceived,
|
||||
_data.LevelConsideration,
|
||||
_data.DateConsideration,
|
||||
_data.OffenseDetails,
|
||||
_data.DateNotification,
|
||||
_data.ComplaintFrom,
|
||||
_data.Appellant,
|
||||
_data.Status,
|
||||
_data.RejectReason,
|
||||
disciplineComplaintDocs,
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สร้างรายการวินัย
|
||||
/// สร้างรายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -114,21 +211,19 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost()]
|
||||
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromForm] DisciplineComplaintRequest req)
|
||||
public async Task<ActionResult<ResponseObject>> CreateDisciplineComplaint([FromBody] DisciplineComplaintRequest req)
|
||||
{
|
||||
var disciplineComplaint = new Domain.Models.Discipline.DisciplineComplaint
|
||||
{
|
||||
RespondentType = req.respondentType,
|
||||
// xxx = req.xxx,
|
||||
// xxx = req.xxx,
|
||||
// xxx = req.xxx,
|
||||
// xxx = req.xxx,
|
||||
RespondentType = req.respondentType.Trim().ToUpper(),
|
||||
Organization = req.organizationId,
|
||||
ConsideredAgency = req.consideredAgency,
|
||||
Title = req.title,
|
||||
Description = req.description,
|
||||
DateReceived = req.dateReceived,
|
||||
LevelConsideration = req.levelConsideration,
|
||||
LevelConsideration = req.levelConsideration.Trim().ToUpper(),
|
||||
DateConsideration = req.dateConsideration,
|
||||
OffenseDetails = req.offenseDetails,
|
||||
OffenseDetails = req.offenseDetails.Trim().ToUpper(),
|
||||
DateNotification = req.dateNotification,
|
||||
ComplaintFrom = req.complaintFrom,
|
||||
Appellant = req.appellant,
|
||||
|
|
@ -140,17 +235,37 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
// var _doc = await _context.Documents.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
// disciplineComplaint.Document = _doc;
|
||||
foreach (var item in req.persons)
|
||||
{
|
||||
disciplineComplaint.DisciplineComplaint_Profiles.Add(
|
||||
new DisciplineComplaint_Profile
|
||||
{
|
||||
PersonId = item.personId,
|
||||
CitizenId = item.idcard,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
Organization = item.organization,
|
||||
Salary = item.salary,
|
||||
PosNo = item.posNo,
|
||||
Position = item.position,
|
||||
PositionLevel = item.positionLevel,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
|
||||
await _context.DisciplineComplaints.AddAsync(disciplineComplaint);
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
return Success(disciplineComplaint.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวินัย
|
||||
/// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -158,47 +273,63 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromForm] DisciplineComplaintRequest req)
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineComplaint([FromBody] DisciplineComplaintRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
var data = await _context.DisciplineComplaints.Include(x => x.DisciplineComplaint_Profiles).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
|
||||
data.RespondentType = req.respondentType;
|
||||
// data.xxx = req.xxx;
|
||||
// data.xxx = req.xxx;
|
||||
// data.xxx = req.xxx;
|
||||
// data.xxx = req.xxx;
|
||||
data.RespondentType = req.respondentType.Trim().ToUpper();
|
||||
data.Organization = req.organizationId;
|
||||
data.ConsideredAgency = req.consideredAgency;
|
||||
data.Title = req.title;
|
||||
data.Description = req.description;
|
||||
data.DateReceived = req.dateReceived;
|
||||
data.LevelConsideration = req.levelConsideration;
|
||||
data.LevelConsideration = req.levelConsideration.Trim().ToUpper();
|
||||
data.DateConsideration = req.dateConsideration;
|
||||
data.OffenseDetails = req.offenseDetails;
|
||||
data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
data.DateNotification = req.dateNotification;
|
||||
data.ComplaintFrom = req.complaintFrom;
|
||||
data.Appellant = req.appellant;
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
_context.DisciplineComplaint_Profiles.RemoveRange(data.DisciplineComplaint_Profiles);
|
||||
if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
{
|
||||
foreach (var item in req.persons)
|
||||
{
|
||||
data.DisciplineComplaint_Profiles.Add(
|
||||
new DisciplineComplaint_Profile
|
||||
{
|
||||
CitizenId = item.idcard,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
Organization = item.organization,
|
||||
Position = item.position,
|
||||
PositionLevel = item.positionLevel,
|
||||
Salary = item.salary,
|
||||
PersonId = item.personId,
|
||||
PosNo = item.posNo,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
// if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
// {
|
||||
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
// var _doc = await _context.Documents.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
// disciplineComplaint.Document = _doc;
|
||||
// var _docId = profileDoc.Document.Id;
|
||||
// await _documentService.DeleteFileAsync(_docId);
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
return Success(data);
|
||||
return Success(data.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบรายการวินัย
|
||||
/// ลบรายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -206,7 +337,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteDiscipline(Guid id)
|
||||
public async Task<ActionResult<ResponseObject>> DeleteDisciplineComplaint(Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
// .Include(x=>x.Document)
|
||||
|
|
@ -221,5 +352,222 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ยุติเรื่อง
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("reject/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectDisciplineComplaint([FromBody] DisciplineReasonRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถยุติเรื่องได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
data.Status = "STOP";
|
||||
data.RejectReason = req.reason;
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งเรื่องสอบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("approve/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveDisciplineComplaint(Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถส่งต่อไปสืบสวนได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
data.Status = "SEND_INVESTIGATE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ยกเลิกการยุติเรื่อง
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("resume/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> ResumeDisciplineComplaint(Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "STOP")
|
||||
return Error(new Exception("รายการนี้ยังไม่ถูกยุติเรื่อง"), (int)StatusCodes.Status500InternalServerError);
|
||||
data.Status = "NEW";
|
||||
data.RejectReason = null;
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพไฟล์เอกสารร้องเรียนวินัย
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("file/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> UploadFileDisciplineComplaint([FromForm] DisciplineFileRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
foreach (var file in Request.Form.Files)
|
||||
{
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
var _doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
if (_doc != null)
|
||||
{
|
||||
var disciplineComplaint_Doc = new DisciplineComplaint_Doc
|
||||
{
|
||||
DisciplineComplaint = data,
|
||||
Document = _doc,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.DisciplineComplaint_Docs.AddAsync(disciplineComplaint_Doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบอัพไฟล์เอกสารร้องเรียนวินัย
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("file/{id:guid}/{docId:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteFileDisciplineComplaint(Guid id, Guid docId)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints
|
||||
.Include(x => x.DisciplineComplaint_Docs)
|
||||
.ThenInclude(x => x.Document)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
var dataDoc = data.DisciplineComplaint_Docs.Where(x => x.Document.Id == docId).FirstOrDefault();
|
||||
if (dataDoc != null)
|
||||
{
|
||||
_context.DisciplineComplaint_Docs.Remove(dataDoc);
|
||||
await _context.SaveChangesAsync();
|
||||
await _documentService.DeleteFileAsync(docId);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งเรื่องร้องเรียนไปสืบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("send/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> SendDisciplineComplaint([FromBody] DisciplineComplaintPersonIdRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineComplaints.Include(x => x.DisciplineComplaint_Profiles).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถส่งเรื่องนี้ไปสอบสวนได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
|
||||
// data.RespondentType = req.respondentType.Trim().ToUpper();
|
||||
// data.Organization = req.organizationId;
|
||||
// data.ConsideredAgency = req.consideredAgency;
|
||||
// data.Title = req.title;
|
||||
// data.Description = req.description;
|
||||
// data.DateReceived = req.dateReceived;
|
||||
// data.LevelConsideration = req.levelConsideration.Trim().ToUpper();
|
||||
// data.DateConsideration = req.dateConsideration;
|
||||
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
// data.DateNotification = req.dateNotification;
|
||||
// data.ComplaintFrom = req.complaintFrom;
|
||||
// data.Appellant = req.appellant;
|
||||
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// data.LastUpdateUserId = UserId ?? "";
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// _context.DisciplineComplaint_Profiles.RemoveRange(data.DisciplineComplaint_Profiles);
|
||||
// if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
// {
|
||||
// foreach (var item in req.persons)
|
||||
// {
|
||||
// data.DisciplineComplaint_Profiles.Add(
|
||||
// new DisciplineComplaint_Profile
|
||||
// {
|
||||
// CitizenId = item.idcard,
|
||||
// Prefix = item.prefix,
|
||||
// FirstName = item.firstName,
|
||||
// LastName = item.lastName,
|
||||
// Organization = item.organization,
|
||||
// Position = item.position,
|
||||
// PositionLevel = item.positionLevel,
|
||||
// Salary = item.salary,
|
||||
// PersonId = item.personId,
|
||||
// PosNo = item.posNo,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
return Success(data.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,10 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
|
||||
{
|
||||
var data = await _context.DisciplineComplaint_Channels
|
||||
var data_search = (from x in _context.DisciplineComplaint_Channels
|
||||
where x.Name.Contains(keyword)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
|
|
@ -63,8 +66,8 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
})
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
return Success(new { data, total = data.Count() });
|
||||
.ToList();
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -133,7 +136,7 @@ namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
|
|||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
var dupicateData = await _context.DisciplineComplaint_Channels.Where(x => x.Id != id && x.Name == req.name).FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
if (dupicateData != null)
|
||||
return Error(new Exception("ชื่อประเภทนี้มีอยู่ในระบบแล้ว"), (int)StatusCodes.Status400BadRequest);
|
||||
|
||||
data.Name = req.name;
|
||||
|
|
|
|||
|
|
@ -55,11 +55,19 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
|
||||
{
|
||||
var data = await _context.DisciplineDirectors
|
||||
var data_search = (from x in _context.DisciplineDirectors
|
||||
where x.Prefix.Contains(keyword) ||
|
||||
x.FirstName.Contains(keyword) ||
|
||||
x.LastName.Contains(keyword) ||
|
||||
x.Position.Contains(keyword) ||
|
||||
x.Email.Contains(keyword) ||
|
||||
x.Phone.Contains(keyword)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
// Prefix = x.Prefix,
|
||||
Prefix = x.Prefix,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Position = x.Position,
|
||||
|
|
@ -68,8 +76,8 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
})
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
return Success(new { data, total = data.Count() });
|
||||
.ToList();
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -87,7 +95,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
// Prefix = x.Prefix,
|
||||
Prefix = x.Prefix,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Position = x.Position,
|
||||
|
|
@ -114,7 +122,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
{
|
||||
var disciplineDirector = new Domain.Models.Discipline.DisciplineDirector
|
||||
{
|
||||
// Prefix = req.Prefix,
|
||||
Prefix = req.prefix,
|
||||
FirstName = req.firstName,
|
||||
LastName = req.lastName,
|
||||
Position = req.position,
|
||||
|
|
@ -147,7 +155,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
// data.Prefix = req.Prefix;
|
||||
data.Prefix = req.prefix;
|
||||
data.FirstName = req.firstName;
|
||||
data.LastName = req.lastName;
|
||||
data.Position = req.position;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Discipline.Service.Requests
|
||||
{
|
||||
public class DisciplineComplaintPersonIdRequest
|
||||
{
|
||||
public Guid[] personId { get; set; }// id บุคคลผู้ถูกร้องเรียน
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Discipline.Service.Requests
|
||||
|
|
@ -6,10 +5,9 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public class DisciplineComplaintRequest
|
||||
{
|
||||
public string respondentType { get; set; }// *ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)
|
||||
// public Array personId { get; set; }// กรณีบุคคลใส่ id คน มาใน array แต่ถ้าเป็น type อื่นจะ null
|
||||
// public Guid organizationId { get; set; }// กรณีหน่วยงานใส่ id ของหน่วยงาน
|
||||
// public Array[Guid, Guid] respondentId { get; set; }// *ถ้าเป็นบุคคลคือ id ของบุคคล / ถ้าหน่วยงาน คือ id ของหน่วยงาน / กรุงเทพมหานคร คือ null
|
||||
// public Guid consideredAgency { get; set; }// *หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
public DisciplineComplaintProfileRequest[] persons { get; set; }// กรณีบุคคลใส่ id คน มาใน array แต่ถ้าเป็น type อื่นจะ null
|
||||
public Guid? organizationId { get; set; }// กรณีหน่วยงานใส่ id ของหน่วยงาน
|
||||
public Guid consideredAgency { get; set; }// *หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
public string title { get; set; }// *เรื่องที่ร้องเรียน
|
||||
public string description { get; set; }// *รายละเอียดของเรื่องร้องเรียน
|
||||
public DateTime dateReceived { get; set; }// *วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ
|
||||
|
|
@ -19,6 +17,19 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public DateTime dateNotification { get; set; }//*วันแจ้งเตือนล่วงหน้า
|
||||
public string complaintFrom { get; set; }//*รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)
|
||||
public string appellant { get; set; }//*ผู้ร้องเรียน
|
||||
public FormFile documentFile { get; set; }//*ไฟล์เอกสารหลักฐาน
|
||||
// public FormFile documentFile { get; set; }//*ไฟล์เอกสารหลักฐาน
|
||||
}
|
||||
public class DisciplineComplaintProfileRequest
|
||||
{
|
||||
public Guid? personId { get; set; }
|
||||
public string? idcard { get; set; }
|
||||
public string? prefix { get; set; }
|
||||
public string? firstName { get; set; }
|
||||
public string? lastName { get; set; }
|
||||
public string? organization { get; set; }
|
||||
public string? position { get; set; }
|
||||
public string? positionLevel { get; set; }
|
||||
public string? posNo { get; set; }
|
||||
public double? salary { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
{
|
||||
public class DisciplineDirectorRequest
|
||||
{
|
||||
// public Guid prefix { get; set; }
|
||||
public string prefix { get; set; }
|
||||
public string firstName { get; set; }
|
||||
public string lastName { get; set; }
|
||||
public string position { get; set; }
|
||||
|
|
|
|||
10
BMA.EHR.Discipline.Service/Requests/DisciplineFileRequest.cs
Normal file
10
BMA.EHR.Discipline.Service/Requests/DisciplineFileRequest.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Discipline.Service.Requests
|
||||
{
|
||||
public class DisciplineFileRequest
|
||||
{
|
||||
public FormFile? File { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Discipline.Service.Requests
|
||||
{
|
||||
public class DisciplineReasonRequest
|
||||
{
|
||||
public string reason { get; set; }//*เหตุผล
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Discipline
|
||||
|
|
@ -12,13 +14,10 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
[Required, Comment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)")]
|
||||
public string RespondentType { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง")]
|
||||
public string ConsideredAgency { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("เรื่องที่ร้องเรียน")]
|
||||
[Required, Comment("เรื่องที่ร้องเรียน"), Column(TypeName = "text")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("รายละเอียดของเรื่องร้องเรียน")]
|
||||
[Required, Comment("รายละเอียดของเรื่องร้องเรียน"), Column(TypeName = "text")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ")]
|
||||
|
|
@ -41,5 +40,16 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
|
||||
// [Required, Comment("อ้างอิงรหัสเอกสาร")]
|
||||
// public Document Document { get; set; }
|
||||
|
||||
[Comment("เหตุผลยุติเรื่อง")]
|
||||
public string? RejectReason { get; set; }
|
||||
|
||||
[Comment("กรณีหน่วยงานใส่ id ของหน่วยงาน")]
|
||||
public Guid? Organization { get; set; }
|
||||
|
||||
[Required, Comment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง")]
|
||||
public Guid ConsideredAgency { get; set; }
|
||||
public virtual List<DisciplineComplaint_Profile> DisciplineComplaint_Profiles { get; set; } = new List<DisciplineComplaint_Profile>();
|
||||
public virtual List<DisciplineComplaint_Doc> DisciplineComplaint_Docs { get; set; } = new List<DisciplineComplaint_Doc>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Doc.cs
Normal file
16
BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Doc.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Discipline
|
||||
{
|
||||
public class DisciplineComplaint_Doc : EntityBase
|
||||
{
|
||||
[Required, Comment("อ้างอิงรหัสเอกสาร")]
|
||||
public Document Document { get; set; }
|
||||
[Required, Comment("อ้างอิงเรื่องร้องเรียน")]
|
||||
public DisciplineComplaint DisciplineComplaint { get; set; }
|
||||
}
|
||||
}
|
||||
337
BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Profile.cs
Normal file
337
BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Profile.cs
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Discipline
|
||||
{
|
||||
public class DisciplineComplaint_Profile : EntityBase
|
||||
{
|
||||
[Comment("id อ้างอิง profile")]
|
||||
public Guid? PersonId { get; set; }
|
||||
[MaxLength(13), Comment("รหัสบัตรประชาชน")]
|
||||
public string? CitizenId { get; set; }
|
||||
// [MaxLength(50)]
|
||||
// public string? ProfileType { get; set; }
|
||||
// [MaxLength(20), Comment("ประเภทการจ้าง")]
|
||||
// public string? EmployeeType { get; set; }
|
||||
// [MaxLength(20), Comment("ประเภทลูกจ้าง")]
|
||||
// public string? EmployeeClass { get; set; }
|
||||
[Comment("คำนำหน้า")]
|
||||
public string? Prefix { get; set; }
|
||||
[Required, MaxLength(100), Comment("ชื่อ")]
|
||||
public string? FirstName { get; set; }
|
||||
[Required, MaxLength(100), Comment("นามสกุล")]
|
||||
public string? LastName { get; set; }
|
||||
// [Comment("Id คำนำหน้า(เดิม)")]
|
||||
// public Guid? PrefixOldId { get; set; }
|
||||
// [Required, MaxLength(100), Comment("ชื่อ(เดิม)")]
|
||||
// public string? FirstNameOld { get; set; }
|
||||
// [Required, MaxLength(100), Comment("นามสกุล(เดิม)")]
|
||||
// public string? LastNameOld { get; set; }
|
||||
// [MaxLength(100)]
|
||||
// public string AvatarRef { get; set; }
|
||||
// [Comment("Id เพศ")]
|
||||
// public Gender? Gender { get; set; }
|
||||
// [MaxLength(100), Comment("สัญชาติ")]
|
||||
// public string? Nationality { get; set; }
|
||||
// [MaxLength(100), Comment("เชื้อชาติ")]
|
||||
// public string? Race { get; set; }
|
||||
// [Comment("Id ศาสนา")]
|
||||
// public Guid? ReligionId { get; set; }
|
||||
// [Required, Comment("วันเกิด")]
|
||||
// public DateTime BirthDate { get; set; }
|
||||
// [Comment("Id กลุ่มเลือด")]
|
||||
// public Guid? BloodGroupId { get; set; }
|
||||
// [Comment("Id สถานะภาพ")]
|
||||
// public Guid? RelationshipId { get; set; }
|
||||
// [MaxLength(50), Comment("เบอร์โทร")]
|
||||
// public string? TelephoneNumber { get; set; }
|
||||
// [Comment("คู่สมรส")]
|
||||
// public bool? Couple { get; set; }
|
||||
// [Comment("Id คำนำหน้าคู่สมรส")]
|
||||
// public Guid? CouplePrefixId { get; set; }
|
||||
// [MaxLength(100), Comment("ชื่อคู่สมรส")]
|
||||
// public string? CoupleFirstName { get; set; }
|
||||
// [MaxLength(100), Comment("นามสกุลคู่สมรส")]
|
||||
// public string? CoupleLastName { get; set; }
|
||||
// [MaxLength(100), Comment("นามสกุลคู่สมรส(เดิม)")]
|
||||
// public string? CoupleLastNameOld { get; set; }
|
||||
// [MaxLength(100), Comment("อาชีพคู่สมรส")]
|
||||
// public string? CoupleCareer { get; set; }
|
||||
// [MaxLength(20), Comment("เลขที่บัตรประชาชนคู่สมรส")]
|
||||
// public string? CoupleCitizenId { get; set; }
|
||||
|
||||
// [Comment("มีชีวิตคู่สมรส")]
|
||||
// public bool CoupleLive { get; set; } = true;
|
||||
// [Comment("Id คำนำหน้าบิดา")]
|
||||
// public Guid? FatherPrefixId { get; set; }
|
||||
// [MaxLength(100), Comment("ชื่อบิดา")]
|
||||
// public string? FatherFirstName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("นามสกุลบิดา")]
|
||||
// public string? FatherLastName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("อาชีพบิดา")]
|
||||
// public string? FatherCareer { get; set; }
|
||||
// [MaxLength(20), Comment("เลขที่บัตรประชาชนบิดา")]
|
||||
// public string? FatherCitizenId { get; set; }
|
||||
|
||||
// [Comment("มีชีวิตบิดา")]
|
||||
// public bool FatherLive { get; set; } = true;
|
||||
// [Comment("Id คำนำหน้ามารดา")]
|
||||
// public Guid? MotherPrefixId { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("ชื่อมารดา")]
|
||||
// public string? MotherFirstName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("นามสกุลมารดา")]
|
||||
// public string? MotherLastName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("อาชีพมารดา")]
|
||||
// public string? MotherCareer { get; set; }
|
||||
// [MaxLength(20), Comment("เลขที่บัตรประชาชนมารดา")]
|
||||
// public string? MotherCitizenId { get; set; }
|
||||
|
||||
// [Comment("มีชีวิตมารดา")]
|
||||
// public bool MotherLive { get; set; } = true;
|
||||
// [MaxLength(200), Comment("ที่อยู่ปัจจุบัน")]
|
||||
// public string? CurrentAddress { get; set; }
|
||||
// [Comment("Id แขวงปัจจุบัน")]
|
||||
// public Guid? CurrentSubDistrictId { get; set; }
|
||||
// [Comment("Id เขตปัจจุบัน")]
|
||||
// public Guid? CurrentDistrictId { get; set; }
|
||||
// [Comment("Id จังหวัดปัจจุบัน")]
|
||||
// public Guid? CurrentProvinceId { get; set; }
|
||||
// [MaxLength(5), Comment("รหัสไปรษณีย์ปัจจุบัน")]
|
||||
// public string? CurrentZipCode { get; set; }
|
||||
// [Comment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่")]
|
||||
// public bool? RegistrationSame { get; set; } = false;
|
||||
// [MaxLength(200), Comment("Id แขวงตามทะเบียนบ้าน")]
|
||||
// public string? RegistrationAddress { get; set; }
|
||||
// [Comment("แขวงตามทะเบียนบ้าน")]
|
||||
// public Guid? RegistrationSubDistrictId { get; set; }
|
||||
// [Comment("Id เขตตามทะเบียนบ้าน")]
|
||||
// public Guid? RegistrationDistrictId { get; set; }
|
||||
// [Comment("Id จังหวัดตามทะเบียนบ้าน")]
|
||||
// public Guid? RegistrationProvinceId { get; set; }
|
||||
// [MaxLength(5), Comment("รหัสไปรษณีย์ตามทะเบียนบ้าน")]
|
||||
// public string? RegistrationZipCode { get; set; }
|
||||
|
||||
// public DateTime? DateAppoint { get; set; }
|
||||
|
||||
// public DateTime? DateStart { get; set; }
|
||||
|
||||
// public DateTime? DateRetire { get; set; }
|
||||
|
||||
// public string? ReasonSameDate { get; set; }
|
||||
// // public Guid? AffiliationId { get; set; }
|
||||
// // public Guid? PositionId { get; set; }
|
||||
// // public Guid? WorkId { get; set; }
|
||||
// // public Guid? TypeId { get; set; }
|
||||
// // public Guid? LevelId { get; set; }
|
||||
// // public Guid? NumberId { get; set; }
|
||||
// // public Guid? BusinessId { get; set; }
|
||||
// [Comment("Id สังกัด")]
|
||||
// public Guid? OcId { get; set; }
|
||||
[Comment("สังกัด")]
|
||||
public string? Organization { get; set; }
|
||||
// public Guid? OrganizationShortNameId { get; set; }
|
||||
// public string? OrganizationShortName { get; set; }
|
||||
// public string? GovernmentCode { get; set; }
|
||||
// public Guid? OrganizationOrganizationId { get; set; }
|
||||
// public string? OrganizationOrganization { get; set; }
|
||||
[Comment("ตำแหน่ง")]
|
||||
public string? Position { get; set; }
|
||||
// [Comment("ตำแหน่ง")]
|
||||
// public string? Position { get; set; }
|
||||
[Comment("เลขที่ตำแหน่ง")]
|
||||
public string? PosNo { get; set; }
|
||||
// [Comment("เลขที่ตำแหน่ง")]
|
||||
// public string? PosNo { get; set; }
|
||||
// [Comment("เลขที่ตำแหน่งลูกจ้าง")]
|
||||
// public string? PosNoEmployee { get; set; }
|
||||
// [Comment("Id สายงาน")]
|
||||
// public Guid? PositionLineId { get; set; }
|
||||
// [Comment("สายงาน")]
|
||||
// public string? PositionLine { get; set; }
|
||||
// [Comment("Id ด้าน/สาขา")]
|
||||
// public Guid? PositionPathSideId { get; set; }
|
||||
// [Comment("ด้าน/สาขา")]
|
||||
// public string? PositionPathSide { get; set; }
|
||||
// // [Comment("Id ประเภทตำแหน่ง")]
|
||||
// // public Guid? PositionTypeId { get; set; }
|
||||
// [Comment("ประเภทตำแหน่ง")]
|
||||
// public PositionType? PositionType { get; set; }
|
||||
// // [Comment(" Id ระดับ")]
|
||||
// // public Guid? PositionLevelId { get; set; }
|
||||
[Comment("ระดับ")]
|
||||
public string? PositionLevel { get; set; }
|
||||
// [Comment("Id ตำแหน่งทางการบริหาร")]
|
||||
// public Guid? PositionExecutiveId { get; set; }
|
||||
// [Comment("ตำแหน่งทางการบริหาร")]
|
||||
// public string? PositionExecutive { get; set; }
|
||||
// [Comment("Id ด้านทางการบริหาร")]
|
||||
// public Guid? PositionExecutiveSideId { get; set; }
|
||||
// [Comment("ด้านทางการบริหาร")]
|
||||
// public string? PositionExecutiveSide { get; set; }
|
||||
|
||||
// [Comment("Id ตำแหน่ง")]
|
||||
// public PositionEmployeePosition? PositionEmployeePosition { get; set; }
|
||||
// // [Comment("ตำแหน่ง")]
|
||||
// // public string? PositionEmployeePosition { get; set; }
|
||||
// [Comment("Id ด้านของตำแหน่ง")]
|
||||
// public PositionEmployeePositionSide? PositionEmployeePositionSide { get; set; }
|
||||
// // [Comment("ด้านของตำแหน่ง")]
|
||||
// // public string? PositionEmployeePositionSide { get; set; }
|
||||
// [Comment(" Id ระดับชั้นงาน")]
|
||||
// public PositionEmployeeLevel? PositionEmployeeLevel { get; set; }
|
||||
// // [Comment("ระดับชั้นงาน")]
|
||||
// // public string? PositionEmployeeLevel { get; set; }
|
||||
// [Comment("Id กลุ่มงาน")]
|
||||
// public PositionEmployeeGroup? PositionEmployeeGroup { get; set; }
|
||||
// // [Comment("กลุ่มงาน")]
|
||||
// // public string? PositionEmployeeGroup { get; set; }
|
||||
// [Comment("Id สายงาน")]
|
||||
// public PositionEmployeeLine? PositionEmployeeLine { get; set; }
|
||||
// // [Comment("สายงาน")]
|
||||
// // public string? PositionEmployeeLine { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("สถานภาพทางกาย")]
|
||||
// public string Physical { get; set; }
|
||||
|
||||
// [MaxLength(100)]
|
||||
// public string Ability { get; set; }
|
||||
|
||||
// public bool IsActive { get; set; } = true;
|
||||
|
||||
// public bool IsLeave { get; set; } = false;
|
||||
|
||||
// public DateTime? LeaveDate { get; set; }
|
||||
|
||||
// [MaxLength(1000)]
|
||||
// public string? LeaveReason { get; set; }
|
||||
// public string? LeaveDetail { get; set; }
|
||||
// public string? LeaveNumberOrder { get; set; }
|
||||
// public DateTime? LeaveDateOrder { get; set; }
|
||||
|
||||
// public DateTime? CreatedDate { get; set; }
|
||||
|
||||
// public DateTime? ModifiedDate { get; set; }
|
||||
|
||||
// [MaxLength(250)]
|
||||
// public string CreatedUser { get; set; } = string.Empty;
|
||||
|
||||
// [MaxLength(5)]
|
||||
// public string EntryStatus { get; set; } = "st1"; // สถานะการตรวจสอบ st1 = create; st2 = pending
|
||||
|
||||
// public bool IsTransfer { get; set; } = false;
|
||||
|
||||
// public DateTime? TransferDate { get; set; }
|
||||
|
||||
// public int GovAgeAbsent { get; set; } = 0;
|
||||
|
||||
// public int GovAgePlus { get; set; } = 0;
|
||||
|
||||
// // public OrganizationEntity? Organization { get; set; }
|
||||
|
||||
// // public PositionNumberEntity PositionNumber { get; set; }
|
||||
|
||||
// // public Position Position { get; set; }
|
||||
|
||||
// // public PositionExecutive PositionExecutive { get; set; }
|
||||
|
||||
// public bool IsVerified { get; set; } = false;
|
||||
|
||||
// [MaxLength(100)]
|
||||
// public string VerifiedUser { get; set; } = string.Empty;
|
||||
|
||||
// public DateTime? VerifiedDate { get; set; }
|
||||
|
||||
// public Document? Avatar { get; set; }
|
||||
|
||||
// public bool IsProbation { get; set; } = true;
|
||||
|
||||
// // public PositionType PositionType { get; set; } // ประเภทตำแหน่ง
|
||||
|
||||
// // public PositionLevel PositionLevel { get; set; } // ระดับ
|
||||
|
||||
// // public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||
// public LimitLeave? LimitLeave { get; set; }
|
||||
// public Guid? KeycloakId { get; set; }
|
||||
// [Comment("สังกัด")]
|
||||
// public string? EmployeeOc { get; set; }
|
||||
// [Comment("ค่าจ้าง")]
|
||||
// public double? EmployeeWage { get; set; }
|
||||
// [Comment("ประเภทบุคคล")]
|
||||
// public string? EmployeeTypeIndividual { get; set; }
|
||||
// [Comment("เงินเพิ่มการครองชีพชั่วคราว")]
|
||||
// public double? EmployeeMoneyIncrease { get; set; }
|
||||
// [Comment("เงินช่วยเหลือค่าครองชีพชั่วคราว")]
|
||||
// public double? EmployeeMoneyAllowance { get; set; }
|
||||
// [Comment("เงินสมทบประกันสังคม(ลูกจ้าง)")]
|
||||
// public double? EmployeeMoneyEmployee { get; set; }
|
||||
// [Comment("เงินสมทบประกันสังคม(นายจ้าง)")]
|
||||
// public double? EmployeeMoneyEmployer { get; set; }
|
||||
|
||||
// public virtual List<ProfileEducation> Educations { get; set; } = new List<ProfileEducation>();
|
||||
|
||||
// public virtual List<ProfileHonor> Honors { get; set; } = new List<ProfileHonor>();
|
||||
// public virtual List<ProfileAssessment> Assessments { get; set; } = new List<ProfileAssessment>();
|
||||
|
||||
// public virtual List<ProfileDiscipline> Disciplines { get; set; } = new List<ProfileDiscipline>();
|
||||
|
||||
// public virtual List<ProfileCertificate> Certificates { get; set; } = new List<ProfileCertificate>();
|
||||
|
||||
// public virtual List<ProfileTraining> Trainings { get; set; } = new List<ProfileTraining>();
|
||||
|
||||
// public virtual List<ProfileInsignia> Insignias { get; set; } = new List<ProfileInsignia>();
|
||||
|
||||
// public virtual List<ProfileSalary> Salaries { get; set; } = new List<ProfileSalary>();
|
||||
|
||||
// public virtual List<ProfileHistory> ProfileHistory { get; set; } = new List<ProfileHistory>();
|
||||
|
||||
// public virtual List<ProfileCoupleHistory> CoupleHistory { get; set; } = new List<ProfileCoupleHistory>();
|
||||
|
||||
// public virtual List<ProfileFatherHistory> FatherHistory { get; set; } = new List<ProfileFatherHistory>();
|
||||
|
||||
// public virtual List<ProfileMotherHistory> MotherHistory { get; set; } = new List<ProfileMotherHistory>();
|
||||
|
||||
// public virtual List<ProfileFamilyHistory> FamilyHistory { get; set; } = new List<ProfileFamilyHistory>();
|
||||
|
||||
// public virtual List<ProfileGovernmentHistory> GovernmentHistory { get; set; } = new List<ProfileGovernmentHistory>();
|
||||
|
||||
// public virtual List<ProfileLeave> Leaves { get; set; } = new List<ProfileLeave>();
|
||||
|
||||
// public virtual List<ProfileCurrentAddressHistory> CurrentAddressHistory { get; set; } = new List<ProfileCurrentAddressHistory>();
|
||||
|
||||
// public virtual List<ProfileRegistrationAddressHistory> RegistrationAddressHistory { get; set; } = new List<ProfileRegistrationAddressHistory>();
|
||||
|
||||
// public virtual List<ProfileAddressHistory> AddressHistory { get; set; } = new List<ProfileAddressHistory>();
|
||||
|
||||
// public virtual List<ProfileOther> Others { get; set; } = new List<ProfileOther>();
|
||||
|
||||
// public virtual List<ProfileAbility> Abilitys { get; set; } = new List<ProfileAbility>();
|
||||
|
||||
// public virtual List<ProfileDuty> Dutys { get; set; } = new List<ProfileDuty>();
|
||||
|
||||
// public virtual List<ProfileNopaid> Nopaids { get; set; } = new List<ProfileNopaid>();
|
||||
|
||||
// public virtual List<ProfileAvatarHistory> AvatarHistory { get; set; } = new List<ProfileAvatarHistory>();
|
||||
|
||||
// public virtual List<ProfilePaper> Papers { get; set; } = new List<ProfilePaper>();
|
||||
|
||||
// public virtual List<ProfileChildren> Childrens { get; set; } = new List<ProfileChildren>();
|
||||
// public virtual List<ProfileChangeName> ChangeNames { get; set; } = new List<ProfileChangeName>();
|
||||
// public virtual List<ProfileEmployment> Employments { get; set; } = new List<ProfileEmployment>();
|
||||
[Comment("เงินเดือน")]
|
||||
public double? Salary { get; set; }
|
||||
|
||||
// [Comment("Id ระดับการศึกษา")]
|
||||
// public EducationLevel? EducationLevel { get; set; }
|
||||
[Required, Comment("Id เรื่องร้องเรียน")]
|
||||
public DisciplineComplaint DisciplineComplaint { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,8 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
{
|
||||
public class DisciplineDirector : EntityBase
|
||||
{
|
||||
// [Comment("คำนำหน้าชื่อ")]
|
||||
// public Guid Prefix { get; set; }
|
||||
[Required, Comment("คำนำหน้าชื่อ")]
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("ชื่อ")]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
|
|
|||
29
BMA.EHR.Domain/Models/Discipline/Document.cs
Normal file
29
BMA.EHR.Domain/Models/Discipline/Document.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Discipline
|
||||
{
|
||||
public class Document
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public int FileSize { get; set; } = 0;
|
||||
|
||||
[Required, MaxLength(128)]
|
||||
public string FileType { get; set; } = string.Empty;
|
||||
|
||||
[Column(TypeName = "text")]
|
||||
public string Detail { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public Guid ObjectRefId { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime CreatedDate { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
330
BMA.EHR.Domain/Models/Discipline/Profile.cs
Normal file
330
BMA.EHR.Domain/Models/Discipline/Profile.cs
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Discipline
|
||||
{
|
||||
public class Profile : EntityBase
|
||||
{
|
||||
[MaxLength(13), Comment("รหัสบัตรประชาชน")]
|
||||
public string? CitizenId { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string? ProfileType { get; set; }
|
||||
// [MaxLength(20), Comment("ประเภทการจ้าง")]
|
||||
// public string? EmployeeType { get; set; }
|
||||
// [MaxLength(20), Comment("ประเภทลูกจ้าง")]
|
||||
// public string? EmployeeClass { get; set; }
|
||||
[Comment("Id คำนำหน้า")]
|
||||
public Prefix? Prefix { get; set; }
|
||||
[Required, MaxLength(100), Comment("ชื่อ")]
|
||||
public string? FirstName { get; set; }
|
||||
[Required, MaxLength(100), Comment("นามสกุล")]
|
||||
public string? LastName { get; set; }
|
||||
// [Comment("Id คำนำหน้า(เดิม)")]
|
||||
// public Guid? PrefixOldId { get; set; }
|
||||
// [Required, MaxLength(100), Comment("ชื่อ(เดิม)")]
|
||||
// public string? FirstNameOld { get; set; }
|
||||
// [Required, MaxLength(100), Comment("นามสกุล(เดิม)")]
|
||||
// public string? LastNameOld { get; set; }
|
||||
// [MaxLength(100)]
|
||||
// public string AvatarRef { get; set; }
|
||||
// [Comment("Id เพศ")]
|
||||
// public Gender? Gender { get; set; }
|
||||
// [MaxLength(100), Comment("สัญชาติ")]
|
||||
// public string? Nationality { get; set; }
|
||||
// [MaxLength(100), Comment("เชื้อชาติ")]
|
||||
// public string? Race { get; set; }
|
||||
// [Comment("Id ศาสนา")]
|
||||
// public Guid? ReligionId { get; set; }
|
||||
// [Required, Comment("วันเกิด")]
|
||||
// public DateTime BirthDate { get; set; }
|
||||
// [Comment("Id กลุ่มเลือด")]
|
||||
// public Guid? BloodGroupId { get; set; }
|
||||
// [Comment("Id สถานะภาพ")]
|
||||
// public Guid? RelationshipId { get; set; }
|
||||
// [MaxLength(50), Comment("เบอร์โทร")]
|
||||
// public string? TelephoneNumber { get; set; }
|
||||
// [Comment("คู่สมรส")]
|
||||
// public bool? Couple { get; set; }
|
||||
// [Comment("Id คำนำหน้าคู่สมรส")]
|
||||
// public Guid? CouplePrefixId { get; set; }
|
||||
// [MaxLength(100), Comment("ชื่อคู่สมรส")]
|
||||
// public string? CoupleFirstName { get; set; }
|
||||
// [MaxLength(100), Comment("นามสกุลคู่สมรส")]
|
||||
// public string? CoupleLastName { get; set; }
|
||||
// [MaxLength(100), Comment("นามสกุลคู่สมรส(เดิม)")]
|
||||
// public string? CoupleLastNameOld { get; set; }
|
||||
// [MaxLength(100), Comment("อาชีพคู่สมรส")]
|
||||
// public string? CoupleCareer { get; set; }
|
||||
// [MaxLength(20), Comment("เลขที่บัตรประชาชนคู่สมรส")]
|
||||
// public string? CoupleCitizenId { get; set; }
|
||||
|
||||
// [Comment("มีชีวิตคู่สมรส")]
|
||||
// public bool CoupleLive { get; set; } = true;
|
||||
// [Comment("Id คำนำหน้าบิดา")]
|
||||
// public Guid? FatherPrefixId { get; set; }
|
||||
// [MaxLength(100), Comment("ชื่อบิดา")]
|
||||
// public string? FatherFirstName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("นามสกุลบิดา")]
|
||||
// public string? FatherLastName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("อาชีพบิดา")]
|
||||
// public string? FatherCareer { get; set; }
|
||||
// [MaxLength(20), Comment("เลขที่บัตรประชาชนบิดา")]
|
||||
// public string? FatherCitizenId { get; set; }
|
||||
|
||||
// [Comment("มีชีวิตบิดา")]
|
||||
// public bool FatherLive { get; set; } = true;
|
||||
// [Comment("Id คำนำหน้ามารดา")]
|
||||
// public Guid? MotherPrefixId { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("ชื่อมารดา")]
|
||||
// public string? MotherFirstName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("นามสกุลมารดา")]
|
||||
// public string? MotherLastName { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("อาชีพมารดา")]
|
||||
// public string? MotherCareer { get; set; }
|
||||
// [MaxLength(20), Comment("เลขที่บัตรประชาชนมารดา")]
|
||||
// public string? MotherCitizenId { get; set; }
|
||||
|
||||
// [Comment("มีชีวิตมารดา")]
|
||||
// public bool MotherLive { get; set; } = true;
|
||||
// [MaxLength(200), Comment("ที่อยู่ปัจจุบัน")]
|
||||
// public string? CurrentAddress { get; set; }
|
||||
// [Comment("Id แขวงปัจจุบัน")]
|
||||
// public Guid? CurrentSubDistrictId { get; set; }
|
||||
// [Comment("Id เขตปัจจุบัน")]
|
||||
// public Guid? CurrentDistrictId { get; set; }
|
||||
// [Comment("Id จังหวัดปัจจุบัน")]
|
||||
// public Guid? CurrentProvinceId { get; set; }
|
||||
// [MaxLength(5), Comment("รหัสไปรษณีย์ปัจจุบัน")]
|
||||
// public string? CurrentZipCode { get; set; }
|
||||
// [Comment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่")]
|
||||
// public bool? RegistrationSame { get; set; } = false;
|
||||
// [MaxLength(200), Comment("Id แขวงตามทะเบียนบ้าน")]
|
||||
// public string? RegistrationAddress { get; set; }
|
||||
// [Comment("แขวงตามทะเบียนบ้าน")]
|
||||
// public Guid? RegistrationSubDistrictId { get; set; }
|
||||
// [Comment("Id เขตตามทะเบียนบ้าน")]
|
||||
// public Guid? RegistrationDistrictId { get; set; }
|
||||
// [Comment("Id จังหวัดตามทะเบียนบ้าน")]
|
||||
// public Guid? RegistrationProvinceId { get; set; }
|
||||
// [MaxLength(5), Comment("รหัสไปรษณีย์ตามทะเบียนบ้าน")]
|
||||
// public string? RegistrationZipCode { get; set; }
|
||||
|
||||
// public DateTime? DateAppoint { get; set; }
|
||||
|
||||
// public DateTime? DateStart { get; set; }
|
||||
|
||||
// public DateTime? DateRetire { get; set; }
|
||||
|
||||
// public string? ReasonSameDate { get; set; }
|
||||
// // public Guid? AffiliationId { get; set; }
|
||||
// // public Guid? PositionId { get; set; }
|
||||
// // public Guid? WorkId { get; set; }
|
||||
// // public Guid? TypeId { get; set; }
|
||||
// // public Guid? LevelId { get; set; }
|
||||
// // public Guid? NumberId { get; set; }
|
||||
// // public Guid? BusinessId { get; set; }
|
||||
// [Comment("Id สังกัด")]
|
||||
// public Guid? OcId { get; set; }
|
||||
[Comment("สังกัด")]
|
||||
public OrganizationEntity? Oc { get; set; }
|
||||
// public Guid? OrganizationShortNameId { get; set; }
|
||||
// public string? OrganizationShortName { get; set; }
|
||||
// public string? GovernmentCode { get; set; }
|
||||
// public Guid? OrganizationOrganizationId { get; set; }
|
||||
// public string? OrganizationOrganization { get; set; }
|
||||
[Comment("Id ตำแหน่ง")]
|
||||
public PositionPath? Position { get; set; }
|
||||
// [Comment("ตำแหน่ง")]
|
||||
// public string? Position { get; set; }
|
||||
[Comment("Id เลขที่ตำแหน่ง")]
|
||||
public PositionNumberEntity? PosNo { get; set; }
|
||||
// [Comment("เลขที่ตำแหน่ง")]
|
||||
// public string? PosNo { get; set; }
|
||||
[Comment("เลขที่ตำแหน่งลูกจ้าง")]
|
||||
public string? PosNoEmployee { get; set; }
|
||||
// [Comment("Id สายงาน")]
|
||||
// public Guid? PositionLineId { get; set; }
|
||||
// [Comment("สายงาน")]
|
||||
// public string? PositionLine { get; set; }
|
||||
// [Comment("Id ด้าน/สาขา")]
|
||||
// public Guid? PositionPathSideId { get; set; }
|
||||
// [Comment("ด้าน/สาขา")]
|
||||
// public string? PositionPathSide { get; set; }
|
||||
// // [Comment("Id ประเภทตำแหน่ง")]
|
||||
// // public Guid? PositionTypeId { get; set; }
|
||||
// [Comment("ประเภทตำแหน่ง")]
|
||||
// public PositionType? PositionType { get; set; }
|
||||
// // [Comment(" Id ระดับ")]
|
||||
// // public Guid? PositionLevelId { get; set; }
|
||||
[Comment("ระดับ")]
|
||||
public PositionLevel? PositionLevel { get; set; }
|
||||
// [Comment("Id ตำแหน่งทางการบริหาร")]
|
||||
// public Guid? PositionExecutiveId { get; set; }
|
||||
// [Comment("ตำแหน่งทางการบริหาร")]
|
||||
// public string? PositionExecutive { get; set; }
|
||||
// [Comment("Id ด้านทางการบริหาร")]
|
||||
// public Guid? PositionExecutiveSideId { get; set; }
|
||||
// [Comment("ด้านทางการบริหาร")]
|
||||
// public string? PositionExecutiveSide { get; set; }
|
||||
|
||||
[Comment("Id ตำแหน่ง")]
|
||||
public PositionEmployeePosition? PositionEmployeePosition { get; set; }
|
||||
// // [Comment("ตำแหน่ง")]
|
||||
// // public string? PositionEmployeePosition { get; set; }
|
||||
// [Comment("Id ด้านของตำแหน่ง")]
|
||||
// public PositionEmployeePositionSide? PositionEmployeePositionSide { get; set; }
|
||||
// // [Comment("ด้านของตำแหน่ง")]
|
||||
// // public string? PositionEmployeePositionSide { get; set; }
|
||||
[Comment(" Id ระดับชั้นงาน")]
|
||||
public PositionEmployeeLevel? PositionEmployeeLevel { get; set; }
|
||||
// // [Comment("ระดับชั้นงาน")]
|
||||
// // public string? PositionEmployeeLevel { get; set; }
|
||||
// [Comment("Id กลุ่มงาน")]
|
||||
// public PositionEmployeeGroup? PositionEmployeeGroup { get; set; }
|
||||
// // [Comment("กลุ่มงาน")]
|
||||
// // public string? PositionEmployeeGroup { get; set; }
|
||||
// [Comment("Id สายงาน")]
|
||||
// public PositionEmployeeLine? PositionEmployeeLine { get; set; }
|
||||
// // [Comment("สายงาน")]
|
||||
// // public string? PositionEmployeeLine { get; set; }
|
||||
|
||||
// [MaxLength(100), Comment("สถานภาพทางกาย")]
|
||||
// public string Physical { get; set; }
|
||||
|
||||
// [MaxLength(100)]
|
||||
// public string Ability { get; set; }
|
||||
|
||||
// public bool IsActive { get; set; } = true;
|
||||
|
||||
// public bool IsLeave { get; set; } = false;
|
||||
|
||||
// public DateTime? LeaveDate { get; set; }
|
||||
|
||||
// [MaxLength(1000)]
|
||||
// public string? LeaveReason { get; set; }
|
||||
// public string? LeaveDetail { get; set; }
|
||||
// public string? LeaveNumberOrder { get; set; }
|
||||
// public DateTime? LeaveDateOrder { get; set; }
|
||||
|
||||
// public DateTime? CreatedDate { get; set; }
|
||||
|
||||
// public DateTime? ModifiedDate { get; set; }
|
||||
|
||||
// [MaxLength(250)]
|
||||
// public string CreatedUser { get; set; } = string.Empty;
|
||||
|
||||
// [MaxLength(5)]
|
||||
// public string EntryStatus { get; set; } = "st1"; // สถานะการตรวจสอบ st1 = create; st2 = pending
|
||||
|
||||
// public bool IsTransfer { get; set; } = false;
|
||||
|
||||
// public DateTime? TransferDate { get; set; }
|
||||
|
||||
// public int GovAgeAbsent { get; set; } = 0;
|
||||
|
||||
// public int GovAgePlus { get; set; } = 0;
|
||||
|
||||
// // public OrganizationEntity? Organization { get; set; }
|
||||
|
||||
// // public PositionNumberEntity PositionNumber { get; set; }
|
||||
|
||||
// // public Position Position { get; set; }
|
||||
|
||||
// // public PositionExecutive PositionExecutive { get; set; }
|
||||
|
||||
// public bool IsVerified { get; set; } = false;
|
||||
|
||||
// [MaxLength(100)]
|
||||
// public string VerifiedUser { get; set; } = string.Empty;
|
||||
|
||||
// public DateTime? VerifiedDate { get; set; }
|
||||
|
||||
// public Document? Avatar { get; set; }
|
||||
|
||||
// public bool IsProbation { get; set; } = true;
|
||||
|
||||
// // public PositionType PositionType { get; set; } // ประเภทตำแหน่ง
|
||||
|
||||
// // public PositionLevel PositionLevel { get; set; } // ระดับ
|
||||
|
||||
// // public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||
// public LimitLeave? LimitLeave { get; set; }
|
||||
// public Guid? KeycloakId { get; set; }
|
||||
// [Comment("สังกัด")]
|
||||
// public string? EmployeeOc { get; set; }
|
||||
// [Comment("ค่าจ้าง")]
|
||||
// public double? EmployeeWage { get; set; }
|
||||
// [Comment("ประเภทบุคคล")]
|
||||
// public string? EmployeeTypeIndividual { get; set; }
|
||||
// [Comment("เงินเพิ่มการครองชีพชั่วคราว")]
|
||||
// public double? EmployeeMoneyIncrease { get; set; }
|
||||
// [Comment("เงินช่วยเหลือค่าครองชีพชั่วคราว")]
|
||||
// public double? EmployeeMoneyAllowance { get; set; }
|
||||
// [Comment("เงินสมทบประกันสังคม(ลูกจ้าง)")]
|
||||
// public double? EmployeeMoneyEmployee { get; set; }
|
||||
// [Comment("เงินสมทบประกันสังคม(นายจ้าง)")]
|
||||
// public double? EmployeeMoneyEmployer { get; set; }
|
||||
|
||||
// public virtual List<ProfileEducation> Educations { get; set; } = new List<ProfileEducation>();
|
||||
|
||||
// public virtual List<ProfileHonor> Honors { get; set; } = new List<ProfileHonor>();
|
||||
// public virtual List<ProfileAssessment> Assessments { get; set; } = new List<ProfileAssessment>();
|
||||
|
||||
// public virtual List<ProfileDiscipline> Disciplines { get; set; } = new List<ProfileDiscipline>();
|
||||
|
||||
// public virtual List<ProfileCertificate> Certificates { get; set; } = new List<ProfileCertificate>();
|
||||
|
||||
// public virtual List<ProfileTraining> Trainings { get; set; } = new List<ProfileTraining>();
|
||||
|
||||
// public virtual List<ProfileInsignia> Insignias { get; set; } = new List<ProfileInsignia>();
|
||||
|
||||
// public virtual List<ProfileSalary> Salaries { get; set; } = new List<ProfileSalary>();
|
||||
|
||||
// public virtual List<ProfileHistory> ProfileHistory { get; set; } = new List<ProfileHistory>();
|
||||
|
||||
// public virtual List<ProfileCoupleHistory> CoupleHistory { get; set; } = new List<ProfileCoupleHistory>();
|
||||
|
||||
// public virtual List<ProfileFatherHistory> FatherHistory { get; set; } = new List<ProfileFatherHistory>();
|
||||
|
||||
// public virtual List<ProfileMotherHistory> MotherHistory { get; set; } = new List<ProfileMotherHistory>();
|
||||
|
||||
// public virtual List<ProfileFamilyHistory> FamilyHistory { get; set; } = new List<ProfileFamilyHistory>();
|
||||
|
||||
// public virtual List<ProfileGovernmentHistory> GovernmentHistory { get; set; } = new List<ProfileGovernmentHistory>();
|
||||
|
||||
// public virtual List<ProfileLeave> Leaves { get; set; } = new List<ProfileLeave>();
|
||||
|
||||
// public virtual List<ProfileCurrentAddressHistory> CurrentAddressHistory { get; set; } = new List<ProfileCurrentAddressHistory>();
|
||||
|
||||
// public virtual List<ProfileRegistrationAddressHistory> RegistrationAddressHistory { get; set; } = new List<ProfileRegistrationAddressHistory>();
|
||||
|
||||
// public virtual List<ProfileAddressHistory> AddressHistory { get; set; } = new List<ProfileAddressHistory>();
|
||||
|
||||
// public virtual List<ProfileOther> Others { get; set; } = new List<ProfileOther>();
|
||||
|
||||
// public virtual List<ProfileAbility> Abilitys { get; set; } = new List<ProfileAbility>();
|
||||
|
||||
// public virtual List<ProfileDuty> Dutys { get; set; } = new List<ProfileDuty>();
|
||||
|
||||
// public virtual List<ProfileNopaid> Nopaids { get; set; } = new List<ProfileNopaid>();
|
||||
|
||||
// public virtual List<ProfileAvatarHistory> AvatarHistory { get; set; } = new List<ProfileAvatarHistory>();
|
||||
|
||||
// public virtual List<ProfilePaper> Papers { get; set; } = new List<ProfilePaper>();
|
||||
|
||||
// public virtual List<ProfileChildren> Childrens { get; set; } = new List<ProfileChildren>();
|
||||
// public virtual List<ProfileChangeName> ChangeNames { get; set; } = new List<ProfileChangeName>();
|
||||
// public virtual List<ProfileEmployment> Employments { get; set; } = new List<ProfileEmployment>();
|
||||
[Comment("เงินเดือน")]
|
||||
public double? Salary { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,275 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||
{
|
||||
[DbContext(typeof(DisciplineDbContext))]
|
||||
[Migration("20231120044819_update table disciplinedirector add prefix")]
|
||||
partial class updatetabledisciplinedirectoraddprefix
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("Appellant")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ผู้ร้องเรียน");
|
||||
|
||||
b.Property<string>("ComplaintFrom")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
||||
|
||||
b.Property<string>("ConsideredAgency")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<DateTime?>("DateConsideration")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่กำหนดพิจารณา");
|
||||
|
||||
b.Property<DateTime>("DateNotification")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันแจ้งเตือนล่วงหน้า");
|
||||
|
||||
b.Property<DateTime>("DateReceived")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รายละเอียดของเรื่องร้องเรียน");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("LevelConsideration")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)");
|
||||
|
||||
b.Property<string>("OffenseDetails")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)");
|
||||
|
||||
b.Property<string>("RespondentType")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เรื่องที่ร้องเรียน");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("DisciplineComplaints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อประเภทการร้องเรียน");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("DisciplineComplaint_Channels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("อีเมล");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อ");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("นามสกุล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เบอร์โทรศัพท์");
|
||||
|
||||
b.Property<string>("Position")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ตำแหน่ง");
|
||||
|
||||
b.Property<string>("Prefix")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("คำนำหน้าชื่อ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("DisciplineDirectors");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetabledisciplinedirectoraddprefix : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Prefix",
|
||||
table: "DisciplineDirectors",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
comment: "คำนำหน้าชื่อ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Prefix",
|
||||
table: "DisciplineDirectors");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableDisciplineComplaint_Profileadddocument : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Profile_Documents_AvatarId",
|
||||
table: "Profile");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfileAvatarHistory_Documents_AvatarFileId",
|
||||
table: "ProfileAvatarHistory");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfileChangeName_Documents_DocumentId",
|
||||
table: "ProfileChangeName");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfileChangeNameHistory_Documents_DocumentId",
|
||||
table: "ProfileChangeNameHistory");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfilePaper_Documents_DocumentId",
|
||||
table: "ProfilePaper");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DisciplineComplaint_Docs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
DisciplineComplaintId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DisciplineComplaint_Docs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DisciplineComplaint_Docs_DisciplineComplaints_DisciplineComp~",
|
||||
column: x => x.DisciplineComplaintId,
|
||||
principalTable: "DisciplineComplaints",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DisciplineComplaint_Docs_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Document",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
FileName = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileSize = table.Column<int>(type: "int", nullable: false),
|
||||
FileType = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Detail = table.Column<string>(type: "text", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ObjectRefId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Document", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DisciplineComplaint_Docs_DisciplineComplaintId",
|
||||
table: "DisciplineComplaint_Docs",
|
||||
column: "DisciplineComplaintId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DisciplineComplaint_Docs_DocumentId",
|
||||
table: "DisciplineComplaint_Docs",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Profile_Document_AvatarId",
|
||||
table: "Profile",
|
||||
column: "AvatarId",
|
||||
principalTable: "Document",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfileAvatarHistory_Document_AvatarFileId",
|
||||
table: "ProfileAvatarHistory",
|
||||
column: "AvatarFileId",
|
||||
principalTable: "Document",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfileChangeName_Document_DocumentId",
|
||||
table: "ProfileChangeName",
|
||||
column: "DocumentId",
|
||||
principalTable: "Document",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfileChangeNameHistory_Document_DocumentId",
|
||||
table: "ProfileChangeNameHistory",
|
||||
column: "DocumentId",
|
||||
principalTable: "Document",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfilePaper_Document_DocumentId",
|
||||
table: "ProfilePaper",
|
||||
column: "DocumentId",
|
||||
principalTable: "Document",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Profile_Document_AvatarId",
|
||||
table: "Profile");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfileAvatarHistory_Document_AvatarFileId",
|
||||
table: "ProfileAvatarHistory");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfileChangeName_Document_DocumentId",
|
||||
table: "ProfileChangeName");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfileChangeNameHistory_Document_DocumentId",
|
||||
table: "ProfileChangeNameHistory");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ProfilePaper_Document_DocumentId",
|
||||
table: "ProfilePaper");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DisciplineComplaint_Docs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Document");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Profile_Documents_AvatarId",
|
||||
table: "Profile",
|
||||
column: "AvatarId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfileAvatarHistory_Documents_AvatarFileId",
|
||||
table: "ProfileAvatarHistory",
|
||||
column: "AvatarFileId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfileChangeName_Documents_DocumentId",
|
||||
table: "ProfileChangeName",
|
||||
column: "DocumentId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfileChangeNameHistory_Documents_DocumentId",
|
||||
table: "ProfileChangeNameHistory",
|
||||
column: "DocumentId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ProfilePaper_Documents_DocumentId",
|
||||
table: "ProfilePaper",
|
||||
column: "DocumentId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,9 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Discipline;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
|
||||
|
||||
|
||||
// using BMA.EHR.Domain.Models.Discipline;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -13,9 +17,113 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
public DbSet<DisciplineComplaint> DisciplineComplaints { get; set; }
|
||||
public DbSet<DisciplineComplaint_Channel> DisciplineComplaint_Channels { get; set; }
|
||||
public DbSet<DisciplineDirector> DisciplineDirectors { get; set; }
|
||||
public DbSet<DisciplineComplaint_Profile> DisciplineComplaint_Profiles { get; set; }
|
||||
public DbSet<DisciplineComplaint_Doc> DisciplineComplaint_Docs { get; set; }
|
||||
public DbSet<Document> Documents { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Meta Data "
|
||||
|
||||
public DbSet<Prefix> Prefixes { get; set; }
|
||||
|
||||
public DbSet<BloodGroup> BloodGroups { get; set; }
|
||||
|
||||
public DbSet<Gender> Genders { get; set; }
|
||||
|
||||
public DbSet<PhysicalStatus> PhysicalStatuses { get; set; }
|
||||
|
||||
public DbSet<Religion> Religions { get; set; }
|
||||
|
||||
public DbSet<EducationLevel> EducationLevels { get; set; }
|
||||
|
||||
public DbSet<PositionPath> PositionPaths { get; set; }
|
||||
|
||||
public DbSet<PositionType> PositionTypes { get; set; }
|
||||
|
||||
public DbSet<PositionEmployeePosition> PositionEmployeePositions { get; set; }
|
||||
|
||||
public DbSet<PositionEmployeePositionSide> PositionEmployeePositionSides { get; set; }
|
||||
|
||||
public DbSet<PositionEmployeeGroup> PositionEmployeeGroups { get; set; }
|
||||
|
||||
public DbSet<PositionEmployeeLine> PositionEmployeeLines { get; set; }
|
||||
|
||||
public DbSet<PositionEmployeeLevel> PositionEmployeeLevels { get; set; }
|
||||
|
||||
public DbSet<PositionEmployeeStatus> PositionEmployeeStatuses { get; set; }
|
||||
|
||||
public DbSet<PositionLine> PositionLines { get; set; }
|
||||
|
||||
public DbSet<PositionExecutive> PositionExecutives { get; set; }
|
||||
|
||||
public DbSet<PositionStatus> PositionStatuss { get; set; }
|
||||
|
||||
public DbSet<PositionLevel> PositionLevels { get; set; }
|
||||
|
||||
public DbSet<Relationship> Relationships { get; set; }
|
||||
|
||||
public DbSet<Position> Positions { get; set; }
|
||||
|
||||
public DbSet<PositionPathSide> PositionPathSides { get; set; }
|
||||
|
||||
public DbSet<PositionExecutiveSide> PositionExecutiveSides { get; set; }
|
||||
|
||||
public DbSet<InsigniaType> InsigniaTypes { get; set; }
|
||||
|
||||
public DbSet<Insignia> Insignias { get; set; }
|
||||
|
||||
public DbSet<Province> Provinces { get; set; }
|
||||
|
||||
public DbSet<District> Districts { get; set; }
|
||||
|
||||
public DbSet<SubDistrict> SubDistricts { get; set; }
|
||||
|
||||
public DbSet<Holiday> Holidays { get; set; }
|
||||
|
||||
public DbSet<OrganizationType> OrganizationTypes { get; set; }
|
||||
|
||||
public DbSet<OrganizationLevel> OrganizationLevels { get; set; }
|
||||
|
||||
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
|
||||
|
||||
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
|
||||
|
||||
public DbSet<OrganizationStatus> OrganizationStatuses { get; set; }
|
||||
|
||||
public DbSet<OrganizationAgency> OrganizationAgencys { get; set; }
|
||||
|
||||
public DbSet<OrganizationGovernmentAgency> OrganizationGovernmentAgencys { get; set; }
|
||||
|
||||
public DbSet<OrganizationTelExternal> OrganizationTelExternals { get; set; }
|
||||
|
||||
public DbSet<OrganizationTelInternal> OrganizationTelInternals { get; set; }
|
||||
|
||||
public DbSet<OrganizationFax> OrganizationFaxs { get; set; }
|
||||
|
||||
public DbSet<RoyalHierarchy> RoyalHierarchys { get; set; }
|
||||
|
||||
public DbSet<RoyalType> RoyalTypes { get; set; }
|
||||
|
||||
public DbSet<Royal> Royals { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Organizations "
|
||||
|
||||
public DbSet<AvailablePositionLevelEntity> AvailablePositionLevels { get; set; }
|
||||
|
||||
public DbSet<PositionMasterEntity> PositionMasters { get; set; }
|
||||
|
||||
public DbSet<OrganizationEntity> Organizations { get; set; }
|
||||
|
||||
public DbSet<PositionNumberEntity> PositionNumbers { get; set; }
|
||||
|
||||
public DbSet<OrganizationPositionEntity> OrganizationPositions { get; set; }
|
||||
|
||||
public DbSet<ProfilePosition> ProfilePositions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DisciplineDbContext(DbContextOptions<DisciplineDbContext> options) : base(options)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue