report 1-4 เำิม่หมายเหตุแนวนอน

This commit is contained in:
Kittapath 2023-10-08 12:41:53 +07:00
parent 5530c2f9e4
commit 2da120f958
32 changed files with 51300 additions and 13 deletions

View file

@ -260,6 +260,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Round = x.Round,
Total = x.Total,
TypeReport = x.TypeReport,
SignDate = x.SignDate,
Detail = x.Detail,
Json = true,
Document = x.Document == null ? false : true,
@ -282,6 +283,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Round = retire.Round,
Total = retire.RetirementProfiles.Count(),
TypeReport = retire.TypeReport,
SignDate = retire.SignDate,
Detail = retire.Detail,
Json = false,
Document = retire.Document == null ? false : true,
@ -439,6 +441,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
RetirementPeriod = retire,
Round = retire.Round,
TypeReport = retire.TypeReport,
SignDate = retire.SignDate,
Detail = retire.Detail,
Year = retire.Year,
Type = retire.Type,
@ -458,6 +461,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
retire.Document = null;
retire.Round = retire.Round + 1;
retire.TypeReport = req.Option.Trim().ToUpper();
retire.SignDate = null;
retire.CreatedUserId = UserId ?? "System Administrator";
retire.CreatedFullName = FullName ?? "";
retire.CreatedAt = DateTime.Now;
@ -597,7 +601,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
};
profile_news.Add(data);
}
return Success(new { retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_news });
return Success(new { retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.SignDate, retire.Detail, profile = profile_news });
}
/// <summary>
@ -632,7 +636,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var responseTask = client.GetAsync(url);
var results = responseTask.Result;
var filehis = profileHistorys.Document == null ? null : await _documentService.ImagesPath(profileHistorys.Document.Id);
return Success(new { Json = true, profileHistorys.Id, profileHistorys.CreatedAt, profileHistorys.Year, profileHistorys.Round, profileHistorys.Type, profileHistorys.TypeReport, profileHistorys.Detail, profile = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(results.Content.ReadAsStringAsync().Result), File = filehis });
return Success(new { Json = true, profileHistorys.Id, profileHistorys.CreatedAt, profileHistorys.Year, profileHistorys.Round, profileHistorys.Type, profileHistorys.TypeReport, profileHistorys.SignDate, profileHistorys.Detail, profile = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(results.Content.ReadAsStringAsync().Result), File = filehis });
}
}
var profile_new = await _context.RetirementProfiles
@ -692,7 +696,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
var file = retire.Document == null ? null : await _documentService.ImagesPath(retire.Document.Id);
return Success(new { Json = false, retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_news, File = file });
return Success(new { Json = false, retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.SignDate, retire.Detail, profile = profile_news, File = file });
}
/// <summary>
@ -919,6 +923,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var doc = await _documentService.UploadFileAsync(file, file.FileName);
var _doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
retire.SignDate = req.signDate;
retire.Document = _doc;
retire.LastUpdateFullName = FullName ?? "System Administrator";
retire.LastUpdateUserId = UserId ?? "";

View file

@ -10,6 +10,7 @@ using BMA.EHR.Retirement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
using System.Security.Cryptography;
@ -173,6 +174,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.RemarkHorizontal,
p.ApproveReason,
p.RejectReason,
p.IsActive,
@ -227,6 +229,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.CommanderApproveReason,
p.CommanderRejectReason,
p.CommanderRejectDate,
p.RemarkHorizontal,
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})
@ -274,6 +277,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.CommanderApproveReason,
data.CommanderRejectReason,
data.CommanderRejectDate,
data.RemarkHorizontal,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = retirementResignDocs,
};
@ -385,6 +389,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
updated.PositionLevelOld = req.PositionLevelOld;
updated.PositionNumberOld = req.PositionNumberOld;
@ -755,6 +760,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdatedAt = p.LastUpdatedAt,
OrganizationPositionOld = p.RetirementResign.OrganizationPositionOld,
CreatedAt = p.CreatedAt,
Score1 = p.Score1,
Score2 = p.Score2,
Score3 = p.Score3,
Score4 = p.Score4,
Score5 = p.Score5,
Score6 = p.Score6,
Score7 = p.Score7,
Score8 = p.Score8,
Score9 = p.Score9,
Score10 = p.Score10,
ScoreTotal = p.ScoreTotal,
Comment = p.Comment,
})
.FirstOrDefaultAsync();
if (data == null)
@ -789,6 +807,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.OrganizationPositionOld,
data.LastUpdatedAt,
data.CreatedAt,
data.Score1,
data.Score2,
data.Score3,
data.Score4,
data.Score5,
data.Score6,
data.Score7,
data.Score8,
data.Score9,
data.Score10,
data.ScoreTotal,
data.Comment,
};
return Success(_data);
@ -914,6 +944,44 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
/// <summary>
/// แก้ไขคะแนนแบบสอบถามหลังลาออก
/// </summary>
/// <param name="id">Id แบบสอบถามหลังลาออก</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("questionnaire/comment/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> PutQuestionComment([FromBody] RetirementQuestionCommentRequest req, Guid id)
{
var uppdated = await _context.RetirementQuestions.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.RetirementQuestionNotFound);
uppdated.Score1 = req.Score1;
uppdated.Score2 = req.Score2;
uppdated.Score3 = req.Score3;
uppdated.Score4 = req.Score4;
uppdated.Score5 = req.Score5;
uppdated.Score6 = req.Score6;
uppdated.Score7 = req.Score7;
uppdated.Score8 = req.Score8;
uppdated.Score9 = req.Score9;
uppdated.Score10 = req.Score10;
uppdated.ScoreTotal = req.ScoreTotal;
uppdated.Comment = req.Comment;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// แก้ไขกําหนดวันนัดหมายเพื่อทําการสัมภาษณ์การลาออก
/// </summary>
@ -949,5 +1017,112 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
/// <summary>
/// list คำถาม
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("questionnaire/question")]
public async Task<ActionResult<ResponseObject>> GetQuestionnaireQuestion()
{
var retirementQuestionnaireQuestion = await _context.RetirementQuestionnaireQuestions.AsQueryable()
.Select(x => new
{
Question1Desc = x.Question1Desc,
Question1Score = x.Question1Score,
Question1Answer = x.Question1Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question1Answer),
Question2Desc = x.Question2Desc,
Question2Score = x.Question2Score,
Question2Answer = x.Question2Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question2Answer),
Question3Desc = x.Question3Desc,
Question3Score = x.Question3Score,
Question3Answer = x.Question3Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question3Answer),
Question4Desc = x.Question4Desc,
Question4Score = x.Question4Score,
Question4Answer = x.Question4Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question4Answer),
Question5Desc = x.Question5Desc,
Question5Score = x.Question5Score,
Question5Answer = x.Question5Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question5Answer),
Question6Desc = x.Question6Desc,
Question6Score = x.Question6Score,
Question6Answer = x.Question6Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question6Answer),
Question7Desc = x.Question7Desc,
Question7Score = x.Question7Score,
Question7Answer = x.Question7Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question7Answer),
Question8Desc = x.Question8Desc,
Question8Score = x.Question8Score,
Question8Answer = x.Question8Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question8Answer),
Question9Desc = x.Question9Desc,
Question9Score = x.Question9Score,
Question9Answer = x.Question9Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question9Answer),
Question10Desc = x.Question10Desc,
Question10Score = x.Question10Score,
Question10Answer = x.Question10Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question10Answer),
})
.FirstOrDefaultAsync();
if (retirementQuestionnaireQuestion == null)
return Error(GlobalMessages.RetirementQuestionNotFound);
return Success(retirementQuestionnaireQuestion);
}
/// <summary>
/// update คำถาม
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("questionnaire/question")]
public async Task<ActionResult<ResponseObject>> UpdateQuestionnaireQuestion([FromBody] RetirementQuestionnaireQuestionRequest req)
{
var uppdated = await _context.RetirementQuestionnaireQuestions.AsQueryable()
.FirstOrDefaultAsync();
if (uppdated == null)
return Error(GlobalMessages.RetirementQuestionnaireQuestionNotFound);
uppdated.Question1Desc = req.Question1Desc;
uppdated.Question1Score = req.Question1Score;
uppdated.Question1Answer = JsonConvert.SerializeObject(req.Question1Answer);
uppdated.Question2Desc = req.Question2Desc;
uppdated.Question2Score = req.Question2Score;
uppdated.Question2Answer = JsonConvert.SerializeObject(req.Question2Answer);
uppdated.Question3Desc = req.Question3Desc;
uppdated.Question3Score = req.Question3Score;
uppdated.Question3Answer = JsonConvert.SerializeObject(req.Question3Answer);
uppdated.Question4Desc = req.Question4Desc;
uppdated.Question4Score = req.Question4Score;
uppdated.Question4Answer = JsonConvert.SerializeObject(req.Question4Answer);
uppdated.Question5Desc = req.Question5Desc;
uppdated.Question5Score = req.Question5Score;
uppdated.Question5Answer = JsonConvert.SerializeObject(req.Question5Answer);
uppdated.Question6Desc = req.Question6Desc;
uppdated.Question6Score = req.Question6Score;
uppdated.Question6Answer = JsonConvert.SerializeObject(req.Question6Answer);
uppdated.Question7Desc = req.Question7Desc;
uppdated.Question7Score = req.Question7Score;
uppdated.Question7Answer = JsonConvert.SerializeObject(req.Question7Answer);
uppdated.Question8Desc = req.Question8Desc;
uppdated.Question8Score = req.Question8Score;
uppdated.Question8Answer = JsonConvert.SerializeObject(req.Question8Answer);
uppdated.Question9Desc = req.Question9Desc;
uppdated.Question9Score = req.Question9Score;
uppdated.Question9Answer = JsonConvert.SerializeObject(req.Question9Answer);
uppdated.Question10Desc = req.Question10Desc;
uppdated.Question10Score = req.Question10Score;
uppdated.Question10Answer = JsonConvert.SerializeObject(req.Question10Answer);
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -6,5 +6,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public class RetirementFileRequest
{
public List<FormFile>? File { get; set; }
public DateTime? signDate { get; set; }
}
}

View file

@ -0,0 +1,21 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class RetirementQuestionCommentRequest
{
public int? Score1 { get; set; }
public int? Score2 { get; set; }
public int? Score3 { get; set; }
public int? Score4 { get; set; }
public int? Score5 { get; set; }
public int? Score6 { get; set; }
public int? Score7 { get; set; }
public int? Score8 { get; set; }
public int? Score9 { get; set; }
public int? Score10 { get; set; }
public int? ScoreTotal { get; set; }
public string? Comment { get; set; }
}
}

View file

@ -0,0 +1,39 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class RetirementQuestionnaireQuestionRequest
{
public string? Question1Desc { get; set; }
public string? Question1Score { get; set; }
public string[] Question1Answer { get; set; }
public string? Question2Desc { get; set; }
public string? Question2Score { get; set; }
public string[] Question2Answer { get; set; }
public string? Question3Desc { get; set; }
public string? Question3Score { get; set; }
public string[] Question3Answer { get; set; }
public string? Question4Desc { get; set; }
public string? Question4Score { get; set; }
public string[] Question4Answer { get; set; }
public string? Question5Desc { get; set; }
public string? Question5Score { get; set; }
public string[] Question5Answer { get; set; }
public string? Question6Desc { get; set; }
public string? Question6Score { get; set; }
public string[] Question6Answer { get; set; }
public string? Question7Desc { get; set; }
public string? Question7Score { get; set; }
public string[] Question7Answer { get; set; }
public string? Question8Desc { get; set; }
public string? Question8Score { get; set; }
public string[] Question8Answer { get; set; }
public string? Question9Desc { get; set; }
public string? Question9Score { get; set; }
public string[] Question9Answer { get; set; }
public string? Question10Desc { get; set; }
public string? Question10Score { get; set; }
public string[] Question10Answer { get; set; }
}
}

View file

@ -13,6 +13,7 @@ namespace BMA.EHR.Retirement.Service.Requests
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }
public string? PositionNumberOld { get; set; }
public string? RemarkHorizontal { get; set; }
public double? AmountOld { get; set; }
public List<FormFile>? File { get; set; }
}