แจ้งเตือนร้องทุกข์
This commit is contained in:
parent
a0b7be76ae
commit
b8c5f88142
11 changed files with 3533 additions and 458 deletions
36
.github/workflows/release_discipline.yaml
vendored
36
.github/workflows/release_discipline.yaml
vendored
|
|
@ -67,21 +67,21 @@ jobs:
|
||||||
docker-compose pull
|
docker-compose pull
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
if: success()
|
# if: success()
|
||||||
with:
|
# with:
|
||||||
access_token: ${{ env.TOKEN_LINE }}
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
message: |
|
# message: |
|
||||||
-Success✅✅✅
|
# -Success✅✅✅
|
||||||
Image: ${{env.IMAGE_NAME}}
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
By: ${{secrets.DOCKER_USER}}
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
if: failure()
|
# if: failure()
|
||||||
with:
|
# with:
|
||||||
access_token: ${{ env.TOKEN_LINE }}
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
message: |
|
# message: |
|
||||||
-Failure❌❌❌
|
# -Failure❌❌❌
|
||||||
Image: ${{env.IMAGE_NAME}}
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
By: ${{secrets.DOCKER_USER}}
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ namespace BMA.EHR.Application
|
||||||
public static IServiceCollection AddDisciplineApplication(this IServiceCollection services)
|
public static IServiceCollection AddDisciplineApplication(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddTransient<MinIODisciplineService>();
|
services.AddTransient<MinIODisciplineService>();
|
||||||
|
services.AddTransient<NotificationRepository>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,18 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
private readonly DisciplineDbContext _context;
|
private readonly DisciplineDbContext _context;
|
||||||
private readonly MinIODisciplineService _documentService;
|
private readonly MinIODisciplineService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
|
|
||||||
public DisciplineComplaintController(DisciplineDbContext context,
|
public DisciplineComplaintController(DisciplineDbContext context,
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -223,7 +226,14 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||||
|
$"มีคำขอร้องเรียนเรื่อง {req.title}",
|
||||||
|
$"มีคำขอร้องเรียนเรื่อง {req.title}",
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
await _context.DisciplineComplaints.AddAsync(disciplineComplaint);
|
await _context.DisciplineComplaints.AddAsync(disciplineComplaint);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success(disciplineComplaint.Id);
|
return Success(disciplineComplaint.Id);
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,21 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
public class DisciplineComplaint_AppealController : BaseController
|
public class DisciplineComplaint_AppealController : BaseController
|
||||||
{
|
{
|
||||||
private readonly DisciplineDbContext _context;
|
private readonly DisciplineDbContext _context;
|
||||||
|
private readonly ApplicationDBContext _contextMain;
|
||||||
private readonly MinIODisciplineService _documentService;
|
private readonly MinIODisciplineService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
|
|
||||||
public DisciplineComplaint_AppealController(DisciplineDbContext context,
|
public DisciplineComplaint_AppealController(DisciplineDbContext context,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
|
ApplicationDBContext contextMain,
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_contextMain = contextMain;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +62,10 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
[HttpGet("user")]
|
[HttpGet("user")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
||||||
{
|
{
|
||||||
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
var profile = _contextMain.Profiles.FirstOrDefault(x => x.KeycloakId == userId);
|
||||||
|
if (profile == null)
|
||||||
|
return Success(new { data = new List<dynamic>(), total = 0 });
|
||||||
var data_search = (from x in _context.DisciplineComplaint_Appeals
|
var data_search = (from x in _context.DisciplineComplaint_Appeals
|
||||||
where x.Title.Contains(keyword) ||
|
where x.Title.Contains(keyword) ||
|
||||||
x.Description.Contains(keyword) ||
|
x.Description.Contains(keyword) ||
|
||||||
|
|
@ -63,7 +73,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
x.CaseNumber.Contains(keyword) ||
|
x.CaseNumber.Contains(keyword) ||
|
||||||
x.Fullname.Contains(keyword) ||
|
x.Fullname.Contains(keyword) ||
|
||||||
x.CitizenId.Contains(keyword)
|
x.CitizenId.Contains(keyword)
|
||||||
where x.CreatedUserId == UserId
|
where x.ProfileId == profile.Id
|
||||||
select x).ToList();
|
select x).ToList();
|
||||||
if (status.Trim().ToUpper() != "ALL")
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
data_search = data_search.Where(x => x.Status == status).ToList();
|
data_search = data_search.Where(x => x.Status == status).ToList();
|
||||||
|
|
@ -240,6 +250,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||||
|
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||||
|
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success(disciplineComplaint_Appeal.Id);
|
return Success(disciplineComplaint_Appeal.Id);
|
||||||
}
|
}
|
||||||
|
|
@ -414,6 +432,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
await _context.DisciplineComplaint_Appeal_Historys.AddAsync(disciplineComplaint_Appeal_History);
|
await _context.DisciplineComplaint_Appeal_Historys.AddAsync(disciplineComplaint_Appeal_History);
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
data.ProfileId,
|
||||||
|
$"มีการแก้ไขสถานะคำขออุทธรณ์/ร้องทุกข์จาก {data.Fullname}",
|
||||||
|
$"มีการแก้ไขสถานะคำขออุทธรณ์/ร้องทุกข์จาก {data.Fullname}",
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
data.Status = req.Status.Trim().ToUpper();
|
data.Status = req.Status.Trim().ToUpper();
|
||||||
data.Type = req.Type.Trim().ToUpper();
|
data.Type = req.Type.Trim().ToUpper();
|
||||||
|
|
|
||||||
|
|
@ -81,308 +81,308 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
return Success(new { data, total = data_search.Count() });
|
return Success(new { data, total = data_search.Count() });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// get รายการวินัยเรื่องร้องเรียน
|
// /// get รายการวินัยเรื่องร้องเรียน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("complaint/{id:guid}")]
|
// [HttpGet("complaint/{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryComplaint(Guid id)
|
// public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryComplaint(Guid id)
|
||||||
{
|
// {
|
||||||
var _data = await _context.DisciplineDisciplinarys
|
// var _data = await _context.DisciplineDisciplinarys
|
||||||
.Select(x => new
|
// .Select(x => new
|
||||||
{
|
// {
|
||||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
// Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||||
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
// IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||||
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
// IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
// RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||||
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
|
// Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
|
||||||
{
|
// {
|
||||||
Id = p.Id,
|
// Id = p.Id,
|
||||||
Idcard = p.CitizenId,
|
// Idcard = p.CitizenId,
|
||||||
Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
// Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||||
Prefix = p.Prefix,
|
// Prefix = p.Prefix,
|
||||||
FirstName = p.FirstName,
|
// FirstName = p.FirstName,
|
||||||
LastName = p.LastName,
|
// LastName = p.LastName,
|
||||||
Position = p.Position,
|
// Position = p.Position,
|
||||||
PositionLevel = p.PositionLevel,
|
// PositionLevel = p.PositionLevel,
|
||||||
Salary = p.Salary,
|
// Salary = p.Salary,
|
||||||
PersonId = p.PersonId,
|
// PersonId = p.PersonId,
|
||||||
PosNo = p.PosNo,
|
// PosNo = p.PosNo,
|
||||||
Organization = p.Organization,
|
// Organization = p.Organization,
|
||||||
IsSend = p.IsReport,
|
// IsSend = p.IsReport,
|
||||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
// }),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
// OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||||
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
// ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||||
Title = x.Title,//ชื่อเรื่อง
|
// Title = x.Title,//ชื่อเรื่อง
|
||||||
Description = x.Description,//รายละเอียด
|
// Description = x.Description,//รายละเอียด
|
||||||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
// DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||||
LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
// LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
// DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
// OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||||
DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
// DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||||
ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
// ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||||
Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
// Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||||
Result = x.ResultComplaint,//ผลการตรวจสอบ
|
// Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||||
DisciplineDisciplinaryDocComplaintInvestigates = x.DisciplineDisciplinary_DocComplaintInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// DisciplineDisciplinaryDocComplaintInvestigates = x.DisciplineDisciplinary_DocComplaintInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
})
|
// })
|
||||||
.Where(x => x.Id == id)
|
// .Where(x => x.Id == id)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (_data == null)
|
// if (_data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
var disciplineDisciplinaryDocComplaintInvestigates = new List<dynamic>();
|
// var disciplineDisciplinaryDocComplaintInvestigates = new List<dynamic>();
|
||||||
foreach (var doc in _data.DisciplineDisciplinaryDocComplaintInvestigates)
|
// foreach (var doc in _data.DisciplineDisciplinaryDocComplaintInvestigates)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.Id,
|
// doc.Id,
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
disciplineDisciplinaryDocComplaintInvestigates.Add(_doc);
|
// disciplineDisciplinaryDocComplaintInvestigates.Add(_doc);
|
||||||
}
|
// }
|
||||||
var data = new
|
// var data = new
|
||||||
{
|
// {
|
||||||
_data.Id,
|
// _data.Id,
|
||||||
_data.IdInvestigate,
|
// _data.IdInvestigate,
|
||||||
_data.IdComplaint,
|
// _data.IdComplaint,
|
||||||
_data.RespondentType,
|
// _data.RespondentType,
|
||||||
_data.Persons,
|
// _data.Persons,
|
||||||
_data.OrganizationId,
|
// _data.OrganizationId,
|
||||||
_data.ConsideredAgency,
|
// _data.ConsideredAgency,
|
||||||
_data.Title,
|
// _data.Title,
|
||||||
_data.Description,
|
// _data.Description,
|
||||||
_data.DateReceived,
|
// _data.DateReceived,
|
||||||
_data.LevelConsideration,
|
// _data.LevelConsideration,
|
||||||
_data.DateConsideration,
|
// _data.DateConsideration,
|
||||||
_data.OffenseDetails,
|
// _data.OffenseDetails,
|
||||||
_data.DateNotification,
|
// _data.DateNotification,
|
||||||
_data.ComplaintFrom,
|
// _data.ComplaintFrom,
|
||||||
_data.Appellant,
|
// _data.Appellant,
|
||||||
_data.Result,
|
// _data.Result,
|
||||||
_data.Status,
|
// _data.Status,
|
||||||
disciplineDisciplinaryDocComplaintInvestigates,
|
// disciplineDisciplinaryDocComplaintInvestigates,
|
||||||
};
|
// };
|
||||||
return Success(data);
|
// return Success(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// แก้ไขรายการวินัยเรื่องร้องเรียน
|
// /// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("complaint/{id:guid}")]
|
// [HttpPut("complaint/{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryComplaint([FromBody] DisciplineDisciplinaryComplaintRequest req, Guid id)
|
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryComplaint([FromBody] DisciplineDisciplinaryComplaintRequest req, Guid id)
|
||||||
{
|
// {
|
||||||
var data = await _context.DisciplineDisciplinarys.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates).Where(x => x.Id == id).FirstOrDefaultAsync();
|
// var data = await _context.DisciplineDisciplinarys.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||||
if (data == null)
|
// if (data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||||
if (data.Status.Trim().ToUpper() != "NEW")
|
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||||
|
|
||||||
data.Title = req.title;
|
// data.Title = req.title;
|
||||||
data.Description = req.description;
|
// data.Description = req.description;
|
||||||
data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
data.LastUpdateUserId = UserId ?? "";
|
// data.LastUpdateUserId = UserId ?? "";
|
||||||
data.LastUpdatedAt = DateTime.Now;
|
// data.LastUpdatedAt = DateTime.Now;
|
||||||
// var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
// // var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
||||||
// _context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
// // _context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
||||||
// if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
// // if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||||
// {
|
// // {
|
||||||
// foreach (var item in req.persons)
|
// // foreach (var item in req.persons)
|
||||||
// {
|
// // {
|
||||||
// var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
// // var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||||
// data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
// // data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||||
// new DisciplineDisciplinary_ProfileComplaintInvestigate
|
// // new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||||
// {
|
// // {
|
||||||
// CitizenId = item.idcard,
|
// // CitizenId = item.idcard,
|
||||||
// Prefix = item.prefix,
|
// // Prefix = item.prefix,
|
||||||
// FirstName = item.firstName,
|
// // FirstName = item.firstName,
|
||||||
// LastName = item.lastName,
|
// // LastName = item.lastName,
|
||||||
// Organization = item.organization,
|
// // Organization = item.organization,
|
||||||
// Position = item.position,
|
// // Position = item.position,
|
||||||
// PositionLevel = item.positionLevel,
|
// // PositionLevel = item.positionLevel,
|
||||||
// Salary = item.salary,
|
// // Salary = item.salary,
|
||||||
// PersonId = item.personId,
|
// // PersonId = item.personId,
|
||||||
// PosNo = item.posNo,
|
// // PosNo = item.posNo,
|
||||||
// Status = "NEW",
|
// // Status = "NEW",
|
||||||
// IsReport = isReport == null ? false : isReport.IsReport,
|
// // IsReport = isReport == null ? false : isReport.IsReport,
|
||||||
// CreatedFullName = FullName ?? "System Administrator",
|
// // CreatedFullName = FullName ?? "System Administrator",
|
||||||
// CreatedUserId = UserId ?? "",
|
// // CreatedUserId = UserId ?? "",
|
||||||
// CreatedAt = DateTime.Now,
|
// // CreatedAt = DateTime.Now,
|
||||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
// // LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
// LastUpdateUserId = UserId ?? "",
|
// // LastUpdateUserId = UserId ?? "",
|
||||||
// LastUpdatedAt = DateTime.Now,
|
// // LastUpdatedAt = DateTime.Now,
|
||||||
// }
|
// // }
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
return Success(data.Id);
|
// return Success(data.Id);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// get รายการวินัยเรื่องสืบสวน
|
// /// get รายการวินัยเรื่องสืบสวน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("investigate/{id:guid}")]
|
// [HttpGet("investigate/{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryInvestigate(Guid id)
|
// public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryInvestigate(Guid id)
|
||||||
{
|
// {
|
||||||
var _data = await _context.DisciplineDisciplinarys
|
// var _data = await _context.DisciplineDisciplinarys
|
||||||
.Select(x => new
|
// .Select(x => new
|
||||||
{
|
// {
|
||||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
// Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||||
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
// IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||||
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
// IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||||
InvestigationDetail = x.InvestigationDetail,
|
// InvestigationDetail = x.InvestigationDetail,
|
||||||
InvestigationDetailOther = x.InvestigationDetailOther,
|
// InvestigationDetailOther = x.InvestigationDetailOther,
|
||||||
InvestigationDateStart = x.InvestigationDateStart,
|
// InvestigationDateStart = x.InvestigationDateStart,
|
||||||
InvestigationDateEnd = x.InvestigationDateEnd,
|
// InvestigationDateEnd = x.InvestigationDateEnd,
|
||||||
InvestigationDescription = x.InvestigationDescription,
|
// InvestigationDescription = x.InvestigationDescription,
|
||||||
InvestigationStatusResult = x.InvestigationStatusResult,
|
// InvestigationStatusResult = x.InvestigationStatusResult,
|
||||||
InvestigationCauseText = x.InvestigationCauseText,
|
// InvestigationCauseText = x.InvestigationCauseText,
|
||||||
InvestigationExtendStatus = x.InvestigationExtendStatus,
|
// InvestigationExtendStatus = x.InvestigationExtendStatus,
|
||||||
InvestigationDaysExtend = x.InvestigationDaysExtend,
|
// InvestigationDaysExtend = x.InvestigationDaysExtend,
|
||||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||||
Result = x.Result,//ผลการตรวจสอบ
|
// Result = x.Result,//ผลการตรวจสอบ
|
||||||
Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(d => new
|
// Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(d => new
|
||||||
{
|
// {
|
||||||
DirectorId = d.Id,
|
// DirectorId = d.Id,
|
||||||
Id = d.DisciplineDirector.Id,
|
// Id = d.DisciplineDirector.Id,
|
||||||
Prefix = d.DisciplineDirector.Prefix,
|
// Prefix = d.DisciplineDirector.Prefix,
|
||||||
FirstName = d.DisciplineDirector.FirstName,
|
// FirstName = d.DisciplineDirector.FirstName,
|
||||||
LastName = d.DisciplineDirector.LastName,
|
// LastName = d.DisciplineDirector.LastName,
|
||||||
Position = d.DisciplineDirector.Position,
|
// Position = d.DisciplineDirector.Position,
|
||||||
Email = d.DisciplineDirector.Email,
|
// Email = d.DisciplineDirector.Email,
|
||||||
Duty = "",
|
// Duty = "",
|
||||||
Phone = d.DisciplineDirector.Phone,
|
// Phone = d.DisciplineDirector.Phone,
|
||||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
// // Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||||
}).ToList(),
|
// }).ToList(),
|
||||||
DisciplineDisciplinaryDocInvestigates = x.DisciplineDisciplinary_DocInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// DisciplineDisciplinaryDocInvestigates = x.DisciplineDisciplinary_DocInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
DisciplineDisciplinaryDocInvestigateRelevants = x.DisciplineDisciplinary_DocInvestigateRelevants.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// DisciplineDisciplinaryDocInvestigateRelevants = x.DisciplineDisciplinary_DocInvestigateRelevants.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
})
|
// })
|
||||||
.Where(x => x.Id == id)
|
// .Where(x => x.Id == id)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (_data == null)
|
// if (_data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
var disciplineDisciplinaryDocInvestigates = new List<dynamic>();
|
// var disciplineDisciplinaryDocInvestigates = new List<dynamic>();
|
||||||
foreach (var doc in _data.DisciplineDisciplinaryDocInvestigates)
|
// foreach (var doc in _data.DisciplineDisciplinaryDocInvestigates)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.Id,
|
// doc.Id,
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
disciplineDisciplinaryDocInvestigates.Add(_doc);
|
// disciplineDisciplinaryDocInvestigates.Add(_doc);
|
||||||
}
|
// }
|
||||||
|
|
||||||
var disciplineDisciplinaryDocInvestigateRelevants = new List<dynamic>();
|
// var disciplineDisciplinaryDocInvestigateRelevants = new List<dynamic>();
|
||||||
foreach (var doc in _data.DisciplineDisciplinaryDocInvestigateRelevants)
|
// foreach (var doc in _data.DisciplineDisciplinaryDocInvestigateRelevants)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.Id,
|
// doc.Id,
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
disciplineDisciplinaryDocInvestigateRelevants.Add(_doc);
|
// disciplineDisciplinaryDocInvestigateRelevants.Add(_doc);
|
||||||
}
|
// }
|
||||||
var data = new
|
// var data = new
|
||||||
{
|
// {
|
||||||
_data.Id,
|
// _data.Id,
|
||||||
_data.IdInvestigate,
|
// _data.IdInvestigate,
|
||||||
_data.IdComplaint,
|
// _data.IdComplaint,
|
||||||
_data.InvestigationDetail,
|
// _data.InvestigationDetail,
|
||||||
_data.InvestigationDetailOther,
|
// _data.InvestigationDetailOther,
|
||||||
_data.InvestigationDateStart,
|
// _data.InvestigationDateStart,
|
||||||
_data.InvestigationDateEnd,
|
// _data.InvestigationDateEnd,
|
||||||
_data.InvestigationDescription,
|
// _data.InvestigationDescription,
|
||||||
_data.InvestigationStatusResult,
|
// _data.InvestigationStatusResult,
|
||||||
_data.InvestigationCauseText,
|
// _data.InvestigationCauseText,
|
||||||
_data.InvestigationExtendStatus,
|
// _data.InvestigationExtendStatus,
|
||||||
_data.InvestigationDaysExtend,
|
// _data.InvestigationDaysExtend,
|
||||||
_data.Status,
|
// _data.Status,
|
||||||
_data.Result,
|
// _data.Result,
|
||||||
_data.Director,
|
// _data.Director,
|
||||||
disciplineDisciplinaryDocInvestigates,
|
// disciplineDisciplinaryDocInvestigates,
|
||||||
disciplineDisciplinaryDocInvestigateRelevants,
|
// disciplineDisciplinaryDocInvestigateRelevants,
|
||||||
};
|
// };
|
||||||
return Success(data);
|
// return Success(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// แก้ไขรายการวินัยเรื่องสืบสวน
|
// /// แก้ไขรายการวินัยเรื่องสืบสวน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("investigate/{id:guid}")]
|
// [HttpPut("investigate/{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryInvestigate([FromBody] DisciplineDisciplinaryInvestigateRequest req, Guid id)
|
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryInvestigate([FromBody] DisciplineDisciplinaryInvestigateRequest req, Guid id)
|
||||||
{
|
// {
|
||||||
var data = await _context.DisciplineDisciplinarys
|
// var data = await _context.DisciplineDisciplinarys
|
||||||
.Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
// .Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||||
.ThenInclude(x => x.DisciplineDirector)
|
// .ThenInclude(x => x.DisciplineDirector)
|
||||||
.Where(x => x.Id == id)
|
// .Where(x => x.Id == id)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (data == null)
|
// if (data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||||
if (data.Status.Trim().ToUpper() != "NEW")
|
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||||
|
|
||||||
data.InvestigationDetail = req.investigationDetail.Trim().ToUpper();
|
// data.InvestigationDetail = req.investigationDetail.Trim().ToUpper();
|
||||||
data.InvestigationDetailOther = req.investigationDetailOther;
|
// data.InvestigationDetailOther = req.investigationDetailOther;
|
||||||
data.InvestigationDateStart = req.investigationDateStart;
|
// data.InvestigationDateStart = req.investigationDateStart;
|
||||||
data.InvestigationDateEnd = req.investigationDateEnd;
|
// data.InvestigationDateEnd = req.investigationDateEnd;
|
||||||
data.InvestigationDescription = req.investigationDescription;
|
// data.InvestigationDescription = req.investigationDescription;
|
||||||
data.InvestigationStatusResult = req.investigationStatusResult.Trim().ToUpper();
|
// data.InvestigationStatusResult = req.investigationStatusResult.Trim().ToUpper();
|
||||||
data.InvestigationCauseText = req.investigationCauseText.Trim().ToUpper();
|
// data.InvestigationCauseText = req.investigationCauseText.Trim().ToUpper();
|
||||||
data.InvestigationExtendStatus = req.investigationExtendStatus;
|
// data.InvestigationExtendStatus = req.investigationExtendStatus;
|
||||||
data.InvestigationDaysExtend = req.investigationDaysExtend;
|
// data.InvestigationDaysExtend = req.investigationDaysExtend;
|
||||||
data.Result = req.result;
|
// data.Result = req.result;
|
||||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
data.LastUpdateUserId = UserId ?? "";
|
// data.LastUpdateUserId = UserId ?? "";
|
||||||
data.LastUpdatedAt = DateTime.Now;
|
// data.LastUpdatedAt = DateTime.Now;
|
||||||
_context.DisciplineDisciplinary_DirectorInvestigates.RemoveRange(data.DisciplineDisciplinary_DirectorInvestigates);
|
// _context.DisciplineDisciplinary_DirectorInvestigates.RemoveRange(data.DisciplineDisciplinary_DirectorInvestigates);
|
||||||
foreach (var item in req.directors)
|
// foreach (var item in req.directors)
|
||||||
{
|
// {
|
||||||
var director = await _context.DisciplineDirectors.AsQueryable()
|
// var director = await _context.DisciplineDirectors.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == item);
|
// .FirstOrDefaultAsync(x => x.Id == item);
|
||||||
if (director != null)
|
// if (director != null)
|
||||||
{
|
// {
|
||||||
data.DisciplineDisciplinary_DirectorInvestigates.Add(
|
// data.DisciplineDisciplinary_DirectorInvestigates.Add(
|
||||||
new DisciplineDisciplinary_DirectorInvestigate
|
// new DisciplineDisciplinary_DirectorInvestigate
|
||||||
{
|
// {
|
||||||
DisciplineDirector = director,
|
// DisciplineDirector = director,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
// CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
// CreatedAt = DateTime.Now,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
// LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
// LastUpdatedAt = DateTime.Now,
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
return Success(data.Id);
|
// return Success(data.Id);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// get รายการวินัยเรื่องสอบสวน
|
/// get รายการวินัยเรื่องสอบสวน
|
||||||
|
|
@ -439,7 +439,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
LastName = d.DisciplineDirector.LastName,
|
LastName = d.DisciplineDirector.LastName,
|
||||||
Position = d.DisciplineDirector.Position,
|
Position = d.DisciplineDirector.Position,
|
||||||
Email = d.DisciplineDirector.Email,
|
Email = d.DisciplineDirector.Email,
|
||||||
Duty = "",
|
Duty = d.Duty,
|
||||||
Phone = d.DisciplineDirector.Phone,
|
Phone = d.DisciplineDirector.Phone,
|
||||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
|
|
|
||||||
|
|
@ -79,151 +79,151 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
return Success(new { data, total = data_search.Count() });
|
return Success(new { data, total = data_search.Count() });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// get รายการวินัยเรื่องร้องเรียน
|
// /// get รายการวินัยเรื่องร้องเรียน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("complaint/{id:guid}")]
|
// [HttpGet("complaint/{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineInvestigateComplaint(Guid id)
|
// public async Task<ActionResult<ResponseObject>> GetByDisciplineInvestigateComplaint(Guid id)
|
||||||
{
|
// {
|
||||||
var _data = await _context.DisciplineInvestigates
|
// var _data = await _context.DisciplineInvestigates
|
||||||
.Select(x => new
|
// .Select(x => new
|
||||||
{
|
// {
|
||||||
Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
// Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||||
IdComplaint = x.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
// IdComplaint = x.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
// RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||||
Persons = x.DisciplineInvestigate_ProfileComplaints.Select(p => new
|
// Persons = x.DisciplineInvestigate_ProfileComplaints.Select(p => new
|
||||||
{
|
// {
|
||||||
Id = p.Id,
|
// Id = p.Id,
|
||||||
Idcard = p.CitizenId,
|
// Idcard = p.CitizenId,
|
||||||
Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
// Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||||
Prefix = p.Prefix,
|
// Prefix = p.Prefix,
|
||||||
FirstName = p.FirstName,
|
// FirstName = p.FirstName,
|
||||||
LastName = p.LastName,
|
// LastName = p.LastName,
|
||||||
Position = p.Position,
|
// Position = p.Position,
|
||||||
PositionLevel = p.PositionLevel,
|
// PositionLevel = p.PositionLevel,
|
||||||
Salary = p.Salary,
|
// Salary = p.Salary,
|
||||||
PersonId = p.PersonId,
|
// PersonId = p.PersonId,
|
||||||
PosNo = p.PosNo,
|
// PosNo = p.PosNo,
|
||||||
Organization = p.Organization,
|
// Organization = p.Organization,
|
||||||
IsSend = p.IsReport,
|
// IsSend = p.IsReport,
|
||||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
// }),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
// OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||||
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
// ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||||
Title = x.Title,//ชื่อเรื่อง
|
// Title = x.Title,//ชื่อเรื่อง
|
||||||
Description = x.Description,//รายละเอียด
|
// Description = x.Description,//รายละเอียด
|
||||||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
// DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||||
LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
// LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
// DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
// OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||||
DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
// DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||||
ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
// ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||||
Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
// Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||||
Result = x.ResultComplaint,//ผลการตรวจสอบ
|
// Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||||
DisciplineInvestigateDocComplaints = x.DisciplineInvestigate_DocComplaints.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// DisciplineInvestigateDocComplaints = x.DisciplineInvestigate_DocComplaints.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
})
|
// })
|
||||||
.Where(x => x.Id == id)
|
// .Where(x => x.Id == id)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (_data == null)
|
// if (_data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
// return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
var disciplineInvestigateDocComplaints = new List<dynamic>();
|
// var disciplineInvestigateDocComplaints = new List<dynamic>();
|
||||||
foreach (var doc in _data.DisciplineInvestigateDocComplaints)
|
// foreach (var doc in _data.DisciplineInvestigateDocComplaints)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.Id,
|
// doc.Id,
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
disciplineInvestigateDocComplaints.Add(_doc);
|
// disciplineInvestigateDocComplaints.Add(_doc);
|
||||||
}
|
// }
|
||||||
var data = new
|
// var data = new
|
||||||
{
|
// {
|
||||||
_data.Id,
|
// _data.Id,
|
||||||
_data.IdComplaint,
|
// _data.IdComplaint,
|
||||||
_data.RespondentType,
|
// _data.RespondentType,
|
||||||
_data.Persons,
|
// _data.Persons,
|
||||||
_data.OrganizationId,
|
// _data.OrganizationId,
|
||||||
_data.ConsideredAgency,
|
// _data.ConsideredAgency,
|
||||||
_data.Title,
|
// _data.Title,
|
||||||
_data.Description,
|
// _data.Description,
|
||||||
_data.DateReceived,
|
// _data.DateReceived,
|
||||||
_data.LevelConsideration,
|
// _data.LevelConsideration,
|
||||||
_data.DateConsideration,
|
// _data.DateConsideration,
|
||||||
_data.OffenseDetails,
|
// _data.OffenseDetails,
|
||||||
_data.DateNotification,
|
// _data.DateNotification,
|
||||||
_data.ComplaintFrom,
|
// _data.ComplaintFrom,
|
||||||
_data.Appellant,
|
// _data.Appellant,
|
||||||
_data.Result,
|
// _data.Result,
|
||||||
_data.Status,
|
// _data.Status,
|
||||||
disciplineInvestigateDocComplaints,
|
// disciplineInvestigateDocComplaints,
|
||||||
};
|
// };
|
||||||
return Success(data);
|
// return Success(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// แก้ไขรายการวินัยเรื่องร้องเรียน
|
// /// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("complaint/{id:guid}")]
|
// [HttpPut("complaint/{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineInvestigateComplaint([FromBody] DisciplineInvestigateComplaintRequest req, Guid id)
|
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineInvestigateComplaint([FromBody] DisciplineInvestigateComplaintRequest req, Guid id)
|
||||||
{
|
// {
|
||||||
var data = await _context.DisciplineInvestigates.Include(x => x.DisciplineInvestigate_ProfileComplaints).Where(x => x.Id == id).FirstOrDefaultAsync();
|
// var data = await _context.DisciplineInvestigates.Include(x => x.DisciplineInvestigate_ProfileComplaints).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||||
if (data == null)
|
// if (data == null)
|
||||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
// return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
if (data.Status.Trim().ToUpper() != "NEW")
|
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
||||||
|
|
||||||
data.Title = req.title;
|
// data.Title = req.title;
|
||||||
data.Description = req.description;
|
// data.Description = req.description;
|
||||||
data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
data.LastUpdateUserId = UserId ?? "";
|
// data.LastUpdateUserId = UserId ?? "";
|
||||||
data.LastUpdatedAt = DateTime.Now;
|
// data.LastUpdatedAt = DateTime.Now;
|
||||||
var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
|
// var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
|
||||||
_context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
|
// _context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
|
||||||
if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
// if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||||
{
|
// {
|
||||||
foreach (var item in req.persons)
|
// foreach (var item in req.persons)
|
||||||
{
|
// {
|
||||||
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
// var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||||
data.DisciplineInvestigate_ProfileComplaints.Add(
|
// data.DisciplineInvestigate_ProfileComplaints.Add(
|
||||||
new DisciplineInvestigate_ProfileComplaint
|
// new DisciplineInvestigate_ProfileComplaint
|
||||||
{
|
// {
|
||||||
CitizenId = item.idcard,
|
// CitizenId = item.idcard,
|
||||||
Prefix = item.prefix,
|
// Prefix = item.prefix,
|
||||||
FirstName = item.firstName,
|
// FirstName = item.firstName,
|
||||||
LastName = item.lastName,
|
// LastName = item.lastName,
|
||||||
Organization = item.organization,
|
// Organization = item.organization,
|
||||||
Position = item.position,
|
// Position = item.position,
|
||||||
PositionLevel = item.positionLevel,
|
// PositionLevel = item.positionLevel,
|
||||||
Salary = item.salary,
|
// Salary = item.salary,
|
||||||
PersonId = item.personId,
|
// PersonId = item.personId,
|
||||||
PosNo = item.posNo,
|
// PosNo = item.posNo,
|
||||||
IsReport = isReport == null ? false : isReport.IsReport,
|
// IsReport = isReport == null ? false : isReport.IsReport,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
// CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
// CreatedAt = DateTime.Now,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
// LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
// LastUpdatedAt = DateTime.Now,
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
return Success(data.Id);
|
// return Success(data.Id);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// get รายการวินัยเรื่องสืบสวน
|
/// get รายการวินัยเรื่องสืบสวน
|
||||||
|
|
@ -269,7 +269,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
LastName = d.DisciplineDirector.LastName,
|
LastName = d.DisciplineDirector.LastName,
|
||||||
Position = d.DisciplineDirector.Position,
|
Position = d.DisciplineDirector.Position,
|
||||||
Email = d.DisciplineDirector.Email,
|
Email = d.DisciplineDirector.Email,
|
||||||
Duty = "",
|
Duty = d.Duty,
|
||||||
Phone = d.DisciplineDirector.Phone,
|
Phone = d.DisciplineDirector.Phone,
|
||||||
// Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(),
|
// Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(),
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,7 @@ namespace BMA.EHR.Domain.Models.Discipline
|
||||||
public DisciplineDirector DisciplineDirector { get; set; }
|
public DisciplineDirector DisciplineDirector { get; set; }
|
||||||
[Required, Comment("อ้างอิงเรื่องสอบสวน")]
|
[Required, Comment("อ้างอิงเรื่องสอบสวน")]
|
||||||
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
|
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
|
||||||
|
[Comment("หน้าที่")]
|
||||||
|
public string Duty { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,7 @@ namespace BMA.EHR.Domain.Models.Discipline
|
||||||
public DisciplineDirector DisciplineDirector { get; set; }
|
public DisciplineDirector DisciplineDirector { get; set; }
|
||||||
[Required, Comment("อ้างอิงเรื่องสืบสวน")]
|
[Required, Comment("อ้างอิงเรื่องสืบสวน")]
|
||||||
public DisciplineInvestigate DisciplineInvestigate { get; set; }
|
public DisciplineInvestigate DisciplineInvestigate { get; set; }
|
||||||
|
[Comment("หน้าที่")]
|
||||||
|
public string Duty { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,42 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetableDisciplineDisciplinarysaddDuty : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Duty",
|
||||||
|
table: "DisciplineInvestigate_Directors",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "หน้าที่")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Duty",
|
||||||
|
table: "DisciplineDisciplinary_DirectorInvestigates",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "หน้าที่")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Duty",
|
||||||
|
table: "DisciplineInvestigate_Directors");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Duty",
|
||||||
|
table: "DisciplineDisciplinary_DirectorInvestigates");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1033,6 +1033,11 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
b.Property<Guid>("DisciplineDisciplinaryId")
|
b.Property<Guid>("DisciplineDisciplinaryId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Duty")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("หน้าที่");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
|
|
@ -2075,6 +2080,11 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
b.Property<Guid>("DisciplineInvestigateId")
|
b.Property<Guid>("DisciplineInvestigateId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Duty")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("หน้าที่");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue