แจ้งเตือนร้องทุกข์
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 up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: success()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Success✅✅✅
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: failure()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Failure❌❌❌
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace BMA.EHR.Application
|
|||
public static IServiceCollection AddDisciplineApplication(this IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<MinIODisciplineService>();
|
||||
services.AddTransient<NotificationRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,15 +25,18 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
private readonly DisciplineDbContext _context;
|
||||
private readonly MinIODisciplineService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public DisciplineComplaintController(DisciplineDbContext context,
|
||||
MinIODisciplineService documentService,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
// _repository = repository;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -223,7 +226,14 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
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.SaveChangesAsync();
|
||||
return Success(disciplineComplaint.Id);
|
||||
|
|
|
|||
|
|
@ -24,15 +24,21 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
public class DisciplineComplaint_AppealController : BaseController
|
||||
{
|
||||
private readonly DisciplineDbContext _context;
|
||||
private readonly ApplicationDBContext _contextMain;
|
||||
private readonly MinIODisciplineService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public DisciplineComplaint_AppealController(DisciplineDbContext context,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext contextMain,
|
||||
MinIODisciplineService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
// _repository = repository;
|
||||
_context = context;
|
||||
_contextMain = contextMain;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
|
@ -56,6 +62,10 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
[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 = "")
|
||||
{
|
||||
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
|
||||
where x.Title.Contains(keyword) ||
|
||||
x.Description.Contains(keyword) ||
|
||||
|
|
@ -63,7 +73,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
x.CaseNumber.Contains(keyword) ||
|
||||
x.Fullname.Contains(keyword) ||
|
||||
x.CitizenId.Contains(keyword)
|
||||
where x.CreatedUserId == UserId
|
||||
where x.ProfileId == profile.Id
|
||||
select x).ToList();
|
||||
if (status.Trim().ToUpper() != "ALL")
|
||||
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();
|
||||
return Success(disciplineComplaint_Appeal.Id);
|
||||
}
|
||||
|
|
@ -414,6 +432,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
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.Type = req.Type.Trim().ToUpper();
|
||||
|
|
|
|||
|
|
@ -81,308 +81,308 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("complaint/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryComplaint(Guid id)
|
||||
{
|
||||
var _data = await _context.DisciplineDisciplinarys
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.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,
|
||||
IsSend = p.IsReport,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
Description = x.Description,//รายละเอียด
|
||||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
DisciplineDisciplinaryDocComplaintInvestigates = x.DisciplineDisciplinary_DocComplaintInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (_data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
// /// <summary>
|
||||
// /// get รายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("complaint/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryComplaint(Guid id)
|
||||
// {
|
||||
// var _data = await _context.DisciplineDisciplinarys
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
// IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
// IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
// RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
// Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.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,
|
||||
// IsSend = p.IsReport,
|
||||
// }),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
// OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
// ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
// Title = x.Title,//ชื่อเรื่อง
|
||||
// Description = x.Description,//รายละเอียด
|
||||
// DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
// LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
// DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
// OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
// DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
// ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
// Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
// Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
// DisciplineDisciplinaryDocComplaintInvestigates = x.DisciplineDisciplinary_DocComplaintInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// })
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (_data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
var disciplineDisciplinaryDocComplaintInvestigates = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineDisciplinaryDocComplaintInvestigates)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineDisciplinaryDocComplaintInvestigates.Add(_doc);
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
_data.Id,
|
||||
_data.IdInvestigate,
|
||||
_data.IdComplaint,
|
||||
_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.Result,
|
||||
_data.Status,
|
||||
disciplineDisciplinaryDocComplaintInvestigates,
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
// var disciplineDisciplinaryDocComplaintInvestigates = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineDisciplinaryDocComplaintInvestigates)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineDisciplinaryDocComplaintInvestigates.Add(_doc);
|
||||
// }
|
||||
// var data = new
|
||||
// {
|
||||
// _data.Id,
|
||||
// _data.IdInvestigate,
|
||||
// _data.IdComplaint,
|
||||
// _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.Result,
|
||||
// _data.Status,
|
||||
// disciplineDisciplinaryDocComplaintInvestigates,
|
||||
// };
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("complaint/{id:guid}")]
|
||||
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();
|
||||
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);
|
||||
// /// <summary>
|
||||
// /// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("complaint/{id:guid}")]
|
||||
// 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();
|
||||
// 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.Title = req.title;
|
||||
data.Description = req.description;
|
||||
data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
// var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
||||
// _context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
||||
// if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
// {
|
||||
// foreach (var item in req.persons)
|
||||
// {
|
||||
// var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
// data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||
// new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
// {
|
||||
// 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,
|
||||
// Status = "NEW",
|
||||
// IsReport = isReport == null ? false : isReport.IsReport,
|
||||
// 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);
|
||||
}
|
||||
// data.Title = req.title;
|
||||
// data.Description = req.description;
|
||||
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// data.LastUpdateUserId = UserId ?? "";
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// // var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
||||
// // _context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
||||
// // if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
// // {
|
||||
// // foreach (var item in req.persons)
|
||||
// // {
|
||||
// // var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
// // data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||
// // new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
// // {
|
||||
// // 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,
|
||||
// // Status = "NEW",
|
||||
// // IsReport = isReport == null ? false : isReport.IsReport,
|
||||
// // 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);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องสืบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("investigate/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryInvestigate(Guid id)
|
||||
{
|
||||
var _data = await _context.DisciplineDisciplinarys
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
InvestigationDetail = x.InvestigationDetail,
|
||||
InvestigationDetailOther = x.InvestigationDetailOther,
|
||||
InvestigationDateStart = x.InvestigationDateStart,
|
||||
InvestigationDateEnd = x.InvestigationDateEnd,
|
||||
InvestigationDescription = x.InvestigationDescription,
|
||||
InvestigationStatusResult = x.InvestigationStatusResult,
|
||||
InvestigationCauseText = x.InvestigationCauseText,
|
||||
InvestigationExtendStatus = x.InvestigationExtendStatus,
|
||||
InvestigationDaysExtend = x.InvestigationDaysExtend,
|
||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
Result = x.Result,//ผลการตรวจสอบ
|
||||
Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(d => new
|
||||
{
|
||||
DirectorId = d.Id,
|
||||
Id = d.DisciplineDirector.Id,
|
||||
Prefix = d.DisciplineDirector.Prefix,
|
||||
FirstName = d.DisciplineDirector.FirstName,
|
||||
LastName = d.DisciplineDirector.LastName,
|
||||
Position = d.DisciplineDirector.Position,
|
||||
Email = d.DisciplineDirector.Email,
|
||||
Duty = "",
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
}).ToList(),
|
||||
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 }),
|
||||
})
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (_data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
// /// <summary>
|
||||
// /// get รายการวินัยเรื่องสืบสวน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("investigate/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryInvestigate(Guid id)
|
||||
// {
|
||||
// var _data = await _context.DisciplineDisciplinarys
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
// IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
// IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
// InvestigationDetail = x.InvestigationDetail,
|
||||
// InvestigationDetailOther = x.InvestigationDetailOther,
|
||||
// InvestigationDateStart = x.InvestigationDateStart,
|
||||
// InvestigationDateEnd = x.InvestigationDateEnd,
|
||||
// InvestigationDescription = x.InvestigationDescription,
|
||||
// InvestigationStatusResult = x.InvestigationStatusResult,
|
||||
// InvestigationCauseText = x.InvestigationCauseText,
|
||||
// InvestigationExtendStatus = x.InvestigationExtendStatus,
|
||||
// InvestigationDaysExtend = x.InvestigationDaysExtend,
|
||||
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
// Result = x.Result,//ผลการตรวจสอบ
|
||||
// Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(d => new
|
||||
// {
|
||||
// DirectorId = d.Id,
|
||||
// Id = d.DisciplineDirector.Id,
|
||||
// Prefix = d.DisciplineDirector.Prefix,
|
||||
// FirstName = d.DisciplineDirector.FirstName,
|
||||
// LastName = d.DisciplineDirector.LastName,
|
||||
// Position = d.DisciplineDirector.Position,
|
||||
// Email = d.DisciplineDirector.Email,
|
||||
// Duty = "",
|
||||
// Phone = d.DisciplineDirector.Phone,
|
||||
// // Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
// }).ToList(),
|
||||
// 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 }),
|
||||
// })
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (_data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
var disciplineDisciplinaryDocInvestigates = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineDisciplinaryDocInvestigates)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineDisciplinaryDocInvestigates.Add(_doc);
|
||||
}
|
||||
// var disciplineDisciplinaryDocInvestigates = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineDisciplinaryDocInvestigates)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineDisciplinaryDocInvestigates.Add(_doc);
|
||||
// }
|
||||
|
||||
var disciplineDisciplinaryDocInvestigateRelevants = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineDisciplinaryDocInvestigateRelevants)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineDisciplinaryDocInvestigateRelevants.Add(_doc);
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
_data.Id,
|
||||
_data.IdInvestigate,
|
||||
_data.IdComplaint,
|
||||
_data.InvestigationDetail,
|
||||
_data.InvestigationDetailOther,
|
||||
_data.InvestigationDateStart,
|
||||
_data.InvestigationDateEnd,
|
||||
_data.InvestigationDescription,
|
||||
_data.InvestigationStatusResult,
|
||||
_data.InvestigationCauseText,
|
||||
_data.InvestigationExtendStatus,
|
||||
_data.InvestigationDaysExtend,
|
||||
_data.Status,
|
||||
_data.Result,
|
||||
_data.Director,
|
||||
disciplineDisciplinaryDocInvestigates,
|
||||
disciplineDisciplinaryDocInvestigateRelevants,
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
// var disciplineDisciplinaryDocInvestigateRelevants = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineDisciplinaryDocInvestigateRelevants)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineDisciplinaryDocInvestigateRelevants.Add(_doc);
|
||||
// }
|
||||
// var data = new
|
||||
// {
|
||||
// _data.Id,
|
||||
// _data.IdInvestigate,
|
||||
// _data.IdComplaint,
|
||||
// _data.InvestigationDetail,
|
||||
// _data.InvestigationDetailOther,
|
||||
// _data.InvestigationDateStart,
|
||||
// _data.InvestigationDateEnd,
|
||||
// _data.InvestigationDescription,
|
||||
// _data.InvestigationStatusResult,
|
||||
// _data.InvestigationCauseText,
|
||||
// _data.InvestigationExtendStatus,
|
||||
// _data.InvestigationDaysExtend,
|
||||
// _data.Status,
|
||||
// _data.Result,
|
||||
// _data.Director,
|
||||
// disciplineDisciplinaryDocInvestigates,
|
||||
// disciplineDisciplinaryDocInvestigateRelevants,
|
||||
// };
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวินัยเรื่องสืบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("investigate/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryInvestigate([FromBody] DisciplineDisciplinaryInvestigateRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||
.ThenInclude(x => x.DisciplineDirector)
|
||||
.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);
|
||||
// /// <summary>
|
||||
// /// แก้ไขรายการวินัยเรื่องสืบสวน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("investigate/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryInvestigate([FromBody] DisciplineDisciplinaryInvestigateRequest req, Guid id)
|
||||
// {
|
||||
// var data = await _context.DisciplineDisciplinarys
|
||||
// .Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||
// .ThenInclude(x => x.DisciplineDirector)
|
||||
// .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.InvestigationDetail = req.investigationDetail.Trim().ToUpper();
|
||||
data.InvestigationDetailOther = req.investigationDetailOther;
|
||||
data.InvestigationDateStart = req.investigationDateStart;
|
||||
data.InvestigationDateEnd = req.investigationDateEnd;
|
||||
data.InvestigationDescription = req.investigationDescription;
|
||||
data.InvestigationStatusResult = req.investigationStatusResult.Trim().ToUpper();
|
||||
data.InvestigationCauseText = req.investigationCauseText.Trim().ToUpper();
|
||||
data.InvestigationExtendStatus = req.investigationExtendStatus;
|
||||
data.InvestigationDaysExtend = req.investigationDaysExtend;
|
||||
data.Result = req.result;
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
_context.DisciplineDisciplinary_DirectorInvestigates.RemoveRange(data.DisciplineDisciplinary_DirectorInvestigates);
|
||||
foreach (var item in req.directors)
|
||||
{
|
||||
var director = await _context.DisciplineDirectors.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == item);
|
||||
if (director != null)
|
||||
{
|
||||
data.DisciplineDisciplinary_DirectorInvestigates.Add(
|
||||
new DisciplineDisciplinary_DirectorInvestigate
|
||||
{
|
||||
DisciplineDirector = director,
|
||||
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);
|
||||
}
|
||||
// data.InvestigationDetail = req.investigationDetail.Trim().ToUpper();
|
||||
// data.InvestigationDetailOther = req.investigationDetailOther;
|
||||
// data.InvestigationDateStart = req.investigationDateStart;
|
||||
// data.InvestigationDateEnd = req.investigationDateEnd;
|
||||
// data.InvestigationDescription = req.investigationDescription;
|
||||
// data.InvestigationStatusResult = req.investigationStatusResult.Trim().ToUpper();
|
||||
// data.InvestigationCauseText = req.investigationCauseText.Trim().ToUpper();
|
||||
// data.InvestigationExtendStatus = req.investigationExtendStatus;
|
||||
// data.InvestigationDaysExtend = req.investigationDaysExtend;
|
||||
// data.Result = req.result;
|
||||
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// data.LastUpdateUserId = UserId ?? "";
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// _context.DisciplineDisciplinary_DirectorInvestigates.RemoveRange(data.DisciplineDisciplinary_DirectorInvestigates);
|
||||
// foreach (var item in req.directors)
|
||||
// {
|
||||
// var director = await _context.DisciplineDirectors.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == item);
|
||||
// if (director != null)
|
||||
// {
|
||||
// data.DisciplineDisciplinary_DirectorInvestigates.Add(
|
||||
// new DisciplineDisciplinary_DirectorInvestigate
|
||||
// {
|
||||
// DisciplineDirector = director,
|
||||
// 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);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องสอบสวน
|
||||
|
|
@ -439,7 +439,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
LastName = d.DisciplineDirector.LastName,
|
||||
Position = d.DisciplineDirector.Position,
|
||||
Email = d.DisciplineDirector.Email,
|
||||
Duty = "",
|
||||
Duty = d.Duty,
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
}).ToList(),
|
||||
|
|
|
|||
|
|
@ -79,151 +79,151 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("complaint/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineInvestigateComplaint(Guid id)
|
||||
{
|
||||
var _data = await _context.DisciplineInvestigates
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
IdComplaint = x.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineInvestigate_ProfileComplaints.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,
|
||||
IsSend = p.IsReport,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
Description = x.Description,//รายละเอียด
|
||||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
DisciplineInvestigateDocComplaints = x.DisciplineInvestigate_DocComplaints.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (_data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
// /// <summary>
|
||||
// /// get รายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("complaint/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByDisciplineInvestigateComplaint(Guid id)
|
||||
// {
|
||||
// var _data = await _context.DisciplineInvestigates
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
// IdComplaint = x.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
// RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
// Persons = x.DisciplineInvestigate_ProfileComplaints.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,
|
||||
// IsSend = p.IsReport,
|
||||
// }),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
// OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
// ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
// Title = x.Title,//ชื่อเรื่อง
|
||||
// Description = x.Description,//รายละเอียด
|
||||
// DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
// LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
// DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
// OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
// DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
// ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
// Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
// Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
// DisciplineInvestigateDocComplaints = x.DisciplineInvestigate_DocComplaints.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// })
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (_data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var disciplineInvestigateDocComplaints = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineInvestigateDocComplaints)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineInvestigateDocComplaints.Add(_doc);
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
_data.Id,
|
||||
_data.IdComplaint,
|
||||
_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.Result,
|
||||
_data.Status,
|
||||
disciplineInvestigateDocComplaints,
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
// var disciplineInvestigateDocComplaints = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineInvestigateDocComplaints)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineInvestigateDocComplaints.Add(_doc);
|
||||
// }
|
||||
// var data = new
|
||||
// {
|
||||
// _data.Id,
|
||||
// _data.IdComplaint,
|
||||
// _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.Result,
|
||||
// _data.Status,
|
||||
// disciplineInvestigateDocComplaints,
|
||||
// };
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("complaint/{id:guid}")]
|
||||
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();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
||||
// /// <summary>
|
||||
// /// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("complaint/{id:guid}")]
|
||||
// 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();
|
||||
// if (data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
||||
|
||||
data.Title = req.title;
|
||||
data.Description = req.description;
|
||||
data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
|
||||
_context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
|
||||
if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
{
|
||||
foreach (var item in req.persons)
|
||||
{
|
||||
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
data.DisciplineInvestigate_ProfileComplaints.Add(
|
||||
new DisciplineInvestigate_ProfileComplaint
|
||||
{
|
||||
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,
|
||||
IsReport = isReport == null ? false : isReport.IsReport,
|
||||
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);
|
||||
}
|
||||
// data.Title = req.title;
|
||||
// data.Description = req.description;
|
||||
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// data.LastUpdateUserId = UserId ?? "";
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
|
||||
// _context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
|
||||
// if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
// {
|
||||
// foreach (var item in req.persons)
|
||||
// {
|
||||
// var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
// data.DisciplineInvestigate_ProfileComplaints.Add(
|
||||
// new DisciplineInvestigate_ProfileComplaint
|
||||
// {
|
||||
// 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,
|
||||
// IsReport = isReport == null ? false : isReport.IsReport,
|
||||
// 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);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องสืบสวน
|
||||
|
|
@ -269,7 +269,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
LastName = d.DisciplineDirector.LastName,
|
||||
Position = d.DisciplineDirector.Position,
|
||||
Email = d.DisciplineDirector.Email,
|
||||
Duty = "",
|
||||
Duty = d.Duty,
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
// Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(),
|
||||
}).ToList(),
|
||||
|
|
|
|||
|
|
@ -12,5 +12,7 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
public DisciplineDirector DisciplineDirector { get; set; }
|
||||
[Required, Comment("อ้างอิงเรื่องสอบสวน")]
|
||||
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; }
|
||||
[Required, Comment("อ้างอิงเรื่องสืบสวน")]
|
||||
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")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Duty")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หน้าที่");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
|
|
@ -2075,6 +2080,11 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
b.Property<Guid>("DisciplineInvestigateId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Duty")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หน้าที่");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue