แก้บรรจุ

This commit is contained in:
Kittapath 2024-05-16 17:00:47 +07:00
parent 7876063288
commit 94c43e5479
11 changed files with 18442 additions and 428 deletions

View file

@ -639,8 +639,8 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] PlacementProfileRequest req, Guid commandTypeId)
[HttpPut("report")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] PlacementProfileRequest req)
{
foreach (var item in req.Id)
{

View file

@ -625,8 +625,8 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] PlacementProfileRequest req, Guid commandTypeId)
[HttpPost("report")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] PlacementProfileRequest req)
{
foreach (var item in req.Id)
{

View file

@ -117,7 +117,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PersonalId = x.Id,
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
IdCard = x.CitizenId,
ExamNumber = x.ExamNumber,
posmasterId = x.posmasterId,
@ -227,11 +227,11 @@ namespace BMA.EHR.Placement.Service.Controllers
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
rootId = org.result.rootId == null?"":org.result.rootId;
child1Id = org.result.child1Id == null?"":org.result.child1Id;
child2Id = org.result.child2Id == null?"":org.result.child2Id;
child3Id = org.result.child3Id == null?"":org.result.child3Id;
child4Id = org.result.child4Id == null?"":org.result.child4Id;
rootId = org.result.rootId == null ? "" : org.result.rootId;
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
// return Success(new {rootId=rootId,child1Id=child1Id,child2Id=child2Id,child3Id=child3Id,child4Id=child4Id });
var data = await _context.PlacementProfiles
.Where(x => x.Placement.Id == examId)
@ -241,7 +241,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PersonalId = x.Id,
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
IdCard = x.CitizenId,
ExamNumber = x.ExamNumber,
posmasterId = x.posmasterId,
@ -360,9 +360,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PersonalId = x.Id,
IdCard = x.CitizenId,
Prefix = x.Prefix == null ? null : x.Prefix.Name,
PrefixId = x.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Prefix.Id,
FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
Prefix = x.Prefix,
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
Firstname = x.Firstname,
Lastname = x.Lastname,
Nationality = x.Nationality,
@ -373,19 +372,15 @@ namespace BMA.EHR.Placement.Service.Controllers
Telephone = x.Telephone,
PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
Gender = x.Gender == null ? null : x.Gender.Name,
GenderId = x.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Gender.Id,
Relationship = x.Relationship == null ? null : x.Relationship.Name,
RelationshipId = x.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Relationship.Id,
BloodGroup = x.BloodGroup == null ? null : x.BloodGroup.Name,
BloodGroupId = x.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.BloodGroup.Id,
Religion = x.Religion == null ? null : x.Religion.Name,
ReligionId = x.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Religion.Id,
Address = $"{x.RegistAddress}" +
(x.RegistSubDistrict == null ? null : " แขวง") + (x.RegistSubDistrict == null ? null : x.RegistSubDistrict.Name) +
(x.RegistDistrict == null ? null : " เขต") + (x.RegistDistrict == null ? null : x.RegistDistrict.Name) +
(x.RegistProvince == null ? null : " จังหวัด") + (x.RegistProvince == null ? null : x.RegistProvince.Name) +
(x.RegistSubDistrict == null ? null : " ") + (x.RegistSubDistrict == null ? null : x.RegistSubDistrict.ZipCode),
Gender = x.Gender,
Relationship = x.Relationship,
BloodGroup = x.BloodGroup,
Religion = x.Religion,
// Address = $"{x.RegistAddress}" +
// (x.RegistSubDistrict == null ? null : " แขวง") + (x.RegistSubDistrict == null ? null : x.RegistSubDistrict.Name) +
// (x.RegistDistrict == null ? null : " เขต") + (x.RegistDistrict == null ? null : x.RegistDistrict.Name) +
// (x.RegistProvince == null ? null : " จังหวัด") + (x.RegistProvince == null ? null : x.RegistProvince.Name) +
// (x.RegistSubDistrict == null ? null : " ") + (x.RegistSubDistrict == null ? null : x.RegistSubDistrict.ZipCode),
Education = x.PlacementEducations.Select(p => new
{
Id = p.Id,
@ -409,35 +404,26 @@ namespace BMA.EHR.Placement.Service.Controllers
IsEducation = p.IsEducation,
}),
RegistAddress = x.RegistAddress,
RegistSubDistrict = x.RegistSubDistrict == null ? null : x.RegistSubDistrict.Name,
RegistSubDistrictId = x.RegistSubDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistSubDistrict.Id,
RegistZipCode = x.RegistSubDistrict == null ? null : x.RegistSubDistrict.ZipCode,
RegistDistrict = x.RegistDistrict == null ? null : x.RegistDistrict.Name,
RegistDistrictId = x.RegistDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistDistrict.Id,
RegistProvince = x.RegistProvince == null ? null : x.RegistProvince.Name,
RegistProvinceId = x.RegistProvince == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistProvince.Id,
RegistSubDistrictId = x.RegistSubDistrictId,
RegistZipCode = x.RegistZipCode,
RegistDistrictId = x.RegistDistrictId,
RegistProvinceId = x.RegistProvinceId,
CurrentAddress = x.CurrentAddress,
CurrentSubDistrict = x.CurrentSubDistrict == null ? null : x.CurrentSubDistrict.Name,
CurrentSubDistrictId = x.CurrentSubDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.CurrentSubDistrict.Id,
CurrentZipCode = x.CurrentSubDistrict == null ? null : x.CurrentSubDistrict.ZipCode,
CurrentDistrict = x.CurrentDistrict == null ? null : x.CurrentDistrict.Name,
CurrentDistrictId = x.CurrentDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.CurrentDistrict.Id,
CurrentProvince = x.CurrentProvince == null ? null : x.CurrentProvince.Name,
CurrentProvinceId = x.CurrentProvince == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.CurrentProvince.Id,
CurrentSubDistrictId = x.CurrentSubDistrictId,
CurrentZipCode = x.CurrentZipCode,
CurrentDistrictId = x.CurrentDistrictId,
CurrentProvinceId = x.CurrentProvinceId,
RegistSame = x.RegistSame,
MarryPrefix = x.MarryPrefix == null ? null : x.MarryPrefix.Name,
MarryPrefixId = x.MarryPrefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.MarryPrefix.Id,
MarryPrefix = x.MarryPrefix,
Couple = x.Marry,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
FatherPrefix = x.FatherPrefix == null ? null : x.FatherPrefix.Name,
FatherPrefixId = x.FatherPrefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.FatherPrefix.Id,
FatherPrefix = x.FatherPrefix,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
MotherPrefix = x.MotherPrefix == null ? null : x.MotherPrefix.Name,
MotherPrefixId = x.MotherPrefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.MotherPrefix.Id,
MotherPrefix = x.MotherPrefix,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
@ -485,7 +471,6 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PersonalId,
data.IdCard,
data.Prefix,
data.PrefixId,
data.FullName,
data.Firstname,
data.Lastname,
@ -498,45 +483,32 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionCandidate,
data.PositionCandidateId,
data.Gender,
data.GenderId,
data.Relationship,
data.RelationshipId,
data.BloodGroup,
data.BloodGroupId,
data.Religion,
data.ReligionId,
data.Address,
// data.Address,
data.Education,
data.RegistAddress,
data.RegistSubDistrict,
data.RegistSubDistrictId,
data.RegistZipCode,
data.RegistDistrict,
data.RegistDistrictId,
data.RegistProvince,
data.RegistProvinceId,
data.CurrentAddress,
data.CurrentSubDistrict,
data.CurrentSubDistrictId,
data.CurrentZipCode,
data.CurrentDistrict,
data.CurrentDistrictId,
data.CurrentProvince,
data.CurrentProvinceId,
data.RegistSame,
data.MarryPrefix,
data.MarryPrefixId,
data.Couple,
data.MarryFirstName,
data.MarryLastName,
data.MarryOccupation,
data.FatherPrefix,
data.FatherPrefixId,
data.FatherFirstName,
data.FatherLastName,
data.FatherOccupation,
data.MotherPrefix,
data.MotherPrefixId,
data.MotherFirstName,
data.MotherLastName,
data.MotherOccupation,
@ -797,52 +769,11 @@ namespace BMA.EHR.Placement.Service.Controllers
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
if (req.PrefixId != null)
{
var save = await _context.Prefixes
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.PrefixId);
if (save == null)
return Error(GlobalMessages.PrefixNotFound, 404);
person.Prefix = save;
}
if (req.GenderId != null)
{
var save = await _context.Genders
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.GenderId);
if (save == null)
return Error(GlobalMessages.GenderNotFound, 404);
person.Gender = save;
}
if (req.RelationshipId != null)
{
var save = await _context.Relationships
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.RelationshipId);
if (save == null)
return Error(GlobalMessages.RelationshipNotFound, 404);
person.Relationship = save;
}
if (req.BloodGroupId != null)
{
var save = await _context.BloodGroups
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.BloodGroupId);
if (save == null)
return Error(GlobalMessages.BloodGroupNotFound, 404);
person.BloodGroup = save;
}
if (req.ReligionId != null)
{
var save = await _context.Religions
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.ReligionId);
if (save == null)
return Error(GlobalMessages.ReligionNotFound, 404);
person.Religion = save;
}
person.Prefix = req.Prefix;
person.Gender = req.Gender;
person.Relationship = req.Relationship;
person.BloodGroup = req.BloodGroup;
person.Religion = req.Religion;
person.CitizenId = req.CitizenId;
person.Firstname = req.FirstName;
person.Lastname = req.LastName;
@ -865,55 +796,14 @@ namespace BMA.EHR.Placement.Service.Controllers
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
if (req.RegistrationSubDistrictId != null)
{
var save = await _context.SubDistricts.FindAsync(req.RegistrationSubDistrictId);
if (save == null)
return Error(GlobalMessages.SubDistrictNotFound, 404);
person.RegistSubDistrict = save;
person.RegistZipCode = save.ZipCode;
}
if (req.RegistrationDistrictId != null)
{
var save = await _context.Districts.FindAsync(req.RegistrationDistrictId);
if (save == null)
return Error(GlobalMessages.DistrictNotFound, 404);
person.RegistDistrict = save;
}
if (req.RegistrationProvinceId != null)
{
var save = await _context.Provinces.FindAsync(req.RegistrationProvinceId);
if (save == null)
return Error(GlobalMessages.ProvinceNotFound, 404);
person.RegistProvince = save;
}
if (req.CurrentSubDistrictId != null)
{
var save = await _context.SubDistricts.FindAsync(req.CurrentSubDistrictId);
if (save == null)
return Error(GlobalMessages.SubDistrictNotFound, 404);
person.CurrentSubDistrict = save;
person.CurrentZipCode = save.ZipCode;
}
if (req.CurrentDistrictId != null)
{
var save = await _context.Districts.FindAsync(req.CurrentDistrictId);
if (save == null)
return Error(GlobalMessages.DistrictNotFound, 404);
person.CurrentDistrict = save;
}
if (req.CurrentProvinceId != null)
{
var save = await _context.Provinces.FindAsync(req.CurrentProvinceId);
if (save == null)
return Error(GlobalMessages.ProvinceNotFound, 404);
person.CurrentProvince = save;
}
person.RegistSubDistrictId = req.RegistrationSubDistrictId;
person.RegistZipCode = req.RegistrationZipCode;
person.RegistDistrictId = req.RegistrationDistrictId;
person.RegistProvinceId = req.RegistrationProvinceId;
person.CurrentSubDistrictId = req.CurrentSubDistrictId;
person.CurrentZipCode = req.CurrentZipCode;
person.CurrentDistrictId = req.CurrentDistrictId;
person.CurrentProvinceId = req.CurrentProvinceId;
person.CurrentAddress = req.CurrentAddress;
person.RegistAddress = req.RegistrationAddress;
person.RegistSame = req.RegistrationSame;
@ -932,36 +822,9 @@ namespace BMA.EHR.Placement.Service.Controllers
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
if (req.Couple == true && req.CouplePrefixId != null)
{
var save_prefix = await _context.Prefixes
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.CouplePrefixId);
if (save_prefix == null)
return Error(GlobalMessages.PrefixNotFound, 404);
person.MarryPrefix = save_prefix;
}
if (req.FatherPrefixId != null)
{
var save_prefix = await _context.Prefixes
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.FatherPrefixId);
if (save_prefix == null)
return Error(GlobalMessages.PrefixNotFound, 404);
person.FatherPrefix = save_prefix;
}
if (req.MotherPrefixId != null)
{
var save_prefix = await _context.Prefixes
.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == req.MotherPrefixId);
if (save_prefix == null)
return Error(GlobalMessages.PrefixNotFound, 404);
person.MotherPrefix = save_prefix;
}
person.MotherPrefix = req.MotherPrefix;
person.FatherPrefix = req.FatherPrefix;
person.MarryPrefix = req.CouplePrefix;
person.Marry = req.Couple;
person.MarryFirstName = req.CoupleFirstName;
person.MarryLastName = req.CoupleLastName;

View file

@ -7,14 +7,14 @@ namespace BMA.EHR.Placement.Service.Requests
{
public bool? RegistrationSame { get; set; }
public string? RegistrationAddress { get; set; }
public Guid? RegistrationSubDistrictId { get; set; }
public Guid? RegistrationDistrictId { get; set; }
public Guid? RegistrationProvinceId { get; set; }
public string? RegistrationSubDistrictId { get; set; }
public string? RegistrationDistrictId { get; set; }
public string? RegistrationProvinceId { get; set; }
public string? RegistrationZipCode { get; set; }
public string? CurrentAddress { get; set; }
public Guid? CurrentSubDistrictId { get; set; }
public Guid? CurrentDistrictId { get; set; }
public Guid? CurrentProvinceId { get; set; }
public string? CurrentSubDistrictId { get; set; }
public string? CurrentDistrictId { get; set; }
public string? CurrentProvinceId { get; set; }
public string? CurrentZipCode { get; set; }
}
}

View file

@ -6,7 +6,7 @@ namespace BMA.EHR.Placement.Service.Requests
public class PersonFamilyRequest
{
public bool? Couple { get; set; }
public Guid? CouplePrefixId { get; set; }
public string? CouplePrefix { get; set; }
public string? CoupleFirstName { get; set; }
public string? CoupleLastName { get; set; }
public string? CoupleLastNameOld { get; set; }
@ -14,14 +14,14 @@ namespace BMA.EHR.Placement.Service.Requests
// public string? CoupleCitizenId { get; set; }
// public bool CoupleLive { get; set; }
public Guid? FatherPrefixId { get; set; }
public string? FatherPrefix { get; set; }
public string? FatherFirstName { get; set; }
public string? FatherLastName { get; set; }
public string? FatherCareer { get; set; }
// public string? FatherCitizenId { get; set; }
// public bool FatherLive { get; set; }
public Guid? MotherPrefixId { get; set; }
public string? MotherPrefix { get; set; }
public string? MotherFirstName { get; set; }
public string? MotherLastName { get; set; }
public string? MotherCareer { get; set; }

View file

@ -6,16 +6,16 @@ namespace BMA.EHR.Placement.Service.Requests
public class PersonInformationRequest
{
public string? CitizenId { get; set; }
public Guid? PrefixId { get; set; }
public string? Prefix { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public Guid? GenderId { get; set; }
public string? Gender { get; set; }
public string? Nationality { get; set; }
public string? Race { get; set; }
public Guid? ReligionId { get; set; }
public string? Religion { get; set; }
public DateTime? BirthDate { get; set; }
public Guid? BloodGroupId { get; set; }
public Guid? RelationshipId { get; set; }
public string? BloodGroup { get; set; }
public string? Relationship { get; set; }
public string? TelephoneNumber { get; set; }
}
}