Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
69d1d797a4
2 changed files with 48 additions and 32 deletions
|
|
@ -245,17 +245,17 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
|
||||
const profileFamilyCouple = await this.profileFamilyCoupleRepository.findOne({
|
||||
where: { id },
|
||||
where: { profileId: id },
|
||||
select: ["couplePrefix", "coupleFirstName", "coupleLastNameOld"],
|
||||
});
|
||||
|
||||
const profileFamilyMother = await this.profileFamilyMotherRepository.findOne({
|
||||
where: { id },
|
||||
where: { profileId: id },
|
||||
select: ["motherPrefix", "motherFirstName", "motherLastName"],
|
||||
});
|
||||
|
||||
const profileFamilyFather = await this.profileFamilyFatherRepository.findOne({
|
||||
where: { id },
|
||||
where: { profileId: id },
|
||||
select: ["fatherPrefix", "fatherFirstName", "fatherLastName"],
|
||||
});
|
||||
|
||||
|
|
@ -310,13 +310,13 @@ export class ProfileController extends Controller {
|
|||
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate() : null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profiles.birthDate))
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based
|
||||
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profiles.birthDate))
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: "",
|
||||
Address: "",
|
||||
District: "",
|
||||
|
|
@ -324,21 +324,24 @@ export class ProfileController extends Controller {
|
|||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? null,
|
||||
CouplePrefix:
|
||||
profileFamilyCouple?.couplePrefix != null ? profileFamilyCouple.couplePrefix : "",
|
||||
CoupleFullName:
|
||||
profileFamilyCouple?.couplePrefix ||
|
||||
profileFamilyCouple?.coupleFirstName ||
|
||||
profileFamilyCouple?.coupleLastNameOld
|
||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||
: null,
|
||||
FatherPrefix: profileFamilyFather?.fatherPrefix ?? null,
|
||||
FatherPrefix:
|
||||
profileFamilyFather?.fatherPrefix != null ? profileFamilyFather.fatherPrefix : "",
|
||||
FatherFullName:
|
||||
profileFamilyFather?.fatherPrefix ||
|
||||
profileFamilyFather?.fatherFirstName ||
|
||||
profileFamilyFather?.fatherLastName
|
||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
MotherPrefix: profileFamilyMother?.motherPrefix ?? null,
|
||||
MotherPrefix:
|
||||
profileFamilyMother?.motherPrefix != null ? profileFamilyMother.motherPrefix : "",
|
||||
MotherFullName:
|
||||
profileFamilyMother?.motherPrefix ||
|
||||
profileFamilyMother?.motherFirstName ||
|
||||
|
|
@ -363,7 +366,7 @@ export class ProfileController extends Controller {
|
|||
CertificateType: item.certificateType ?? null,
|
||||
Issuer: item.issuer ?? null,
|
||||
CertificateNo: item.certificateNo ?? null,
|
||||
IssueDate: item.issueDate ?? null,
|
||||
IssueDate: Extension.ToThaiShortDate(item.issueDate) ?? null,
|
||||
}));
|
||||
const trainings = await this.trainingRepository.find({
|
||||
select: ["startDate", "endDate", "place", "department"],
|
||||
|
|
@ -371,8 +374,8 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
const training = trainings.map((item) => ({
|
||||
institute: item.department ?? null,
|
||||
start: item.startDate ?? null,
|
||||
end: item.endDate ?? null,
|
||||
start: Extension.ToThaiShortDate(item.startDate) ?? null,
|
||||
end: Extension.ToThaiShortDate(item.endDate) ?? null,
|
||||
level: "",
|
||||
degree: "",
|
||||
field: item.place ?? null,
|
||||
|
|
@ -383,7 +386,7 @@ export class ProfileController extends Controller {
|
|||
where: { profileId: id },
|
||||
});
|
||||
const discipline = disciplines.map((item) => ({
|
||||
DisciplineYear: item.refCommandDate ?? null,
|
||||
DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null,
|
||||
DisciplineDetail: item.detail ?? null,
|
||||
RefNo: item.refCommandNo ?? null,
|
||||
}));
|
||||
|
|
@ -394,8 +397,8 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
const education = educations.map((item) => ({
|
||||
Institute: item.institute ?? null,
|
||||
Start: item.startDate ?? null,
|
||||
End: item.endDate ?? null,
|
||||
Start: new Date(item.startDate).getFullYear() ?? null,
|
||||
End: new Date(item.endDate).getFullYear() ?? null,
|
||||
Level: item.educationLevel ?? null,
|
||||
Degree: item.degree ?? null,
|
||||
Field: item.field ?? null,
|
||||
|
|
@ -414,7 +417,7 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
|
||||
const salary = salarys.map((item) => ({
|
||||
SalaryDate: item.date ?? null,
|
||||
SalaryDate: Extension.ToThaiShortDate(item.date) ?? null,
|
||||
Position: item.position ?? null,
|
||||
PosNo: item.posNo ?? null,
|
||||
Salary: "",
|
||||
|
|
@ -425,7 +428,14 @@ export class ProfileController extends Controller {
|
|||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
}));
|
||||
return new HttpSuccess({ profile, cert, training, discipline, education, salary });
|
||||
return new HttpSuccess({
|
||||
profile,
|
||||
cert,
|
||||
training,
|
||||
discipline,
|
||||
education,
|
||||
salary,
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
|
@ -1979,6 +1989,9 @@ export class ProfileController extends Controller {
|
|||
const child4Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild4;
|
||||
const posMasterNo = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.posMasterNo;
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
|
|
@ -2012,7 +2025,7 @@ export class ProfileController extends Controller {
|
|||
child3ShortName: child3Holder?.orgChild3ShortName ?? null,
|
||||
child4: child4Holder?.orgChild4Name ?? null,
|
||||
child4Id: child4Holder?.id ?? null,
|
||||
child4ShortName: child4Holder?.orgChild4ShortName ?? null,
|
||||
// posMasterNo: posMasterNo,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -247,17 +247,17 @@ export class ProfileEmployeeController extends Controller {
|
|||
});
|
||||
|
||||
const profileFamilyCouple = await this.profileFamilyCoupleRepository.findOne({
|
||||
where: { id },
|
||||
where: { profileEmployeeId: id },
|
||||
select: ["couplePrefix", "coupleFirstName", "coupleLastNameOld"],
|
||||
});
|
||||
|
||||
const profileFamilyMother = await this.profileFamilyMotherRepository.findOne({
|
||||
where: { id },
|
||||
where: { profileEmployeeId: id },
|
||||
select: ["motherPrefix", "motherFirstName", "motherLastName"],
|
||||
});
|
||||
|
||||
const profileFamilyFather = await this.profileFamilyFatherRepository.findOne({
|
||||
where: { id },
|
||||
where: { profileEmployeeId: id },
|
||||
select: ["fatherPrefix", "fatherFirstName", "fatherLastName"],
|
||||
});
|
||||
|
||||
|
|
@ -323,13 +323,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate() : null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profiles.birthDate))
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based
|
||||
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profiles.birthDate))
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
: "",
|
||||
Address: "",
|
||||
District: "",
|
||||
|
|
@ -337,21 +337,24 @@ export class ProfileEmployeeController extends Controller {
|
|||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? null,
|
||||
CouplePrefix:
|
||||
profileFamilyCouple?.couplePrefix != null ? profileFamilyCouple.couplePrefix : "",
|
||||
CoupleFullName:
|
||||
profileFamilyCouple?.couplePrefix ||
|
||||
profileFamilyCouple?.coupleFirstName ||
|
||||
profileFamilyCouple?.coupleLastNameOld
|
||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||
: null,
|
||||
FatherPrefix: profileFamilyFather?.fatherPrefix ?? null,
|
||||
FatherPrefix:
|
||||
profileFamilyFather?.fatherPrefix != null ? profileFamilyFather.fatherPrefix : "",
|
||||
FatherFullName:
|
||||
profileFamilyFather?.fatherPrefix ||
|
||||
profileFamilyFather?.fatherFirstName ||
|
||||
profileFamilyFather?.fatherLastName
|
||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||
: null,
|
||||
MotherPrefix: profileFamilyMother?.motherPrefix ?? null,
|
||||
MotherPrefix:
|
||||
profileFamilyMother?.motherPrefix != null ? profileFamilyMother.motherPrefix : "",
|
||||
MotherFullName:
|
||||
profileFamilyMother?.motherPrefix ||
|
||||
profileFamilyMother?.motherFirstName ||
|
||||
|
|
@ -376,7 +379,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
CertificateType: item.certificateType ?? null,
|
||||
Issuer: item.issuer ?? null,
|
||||
CertificateNo: item.certificateNo ?? null,
|
||||
IssueDate: item.issueDate ?? null,
|
||||
IssueDate: Extension.ToThaiShortDate(item.issueDate) ?? null,
|
||||
}));
|
||||
const trainings = await this.trainingRepository.find({
|
||||
select: ["startDate", "endDate", "place", "department"],
|
||||
|
|
@ -384,8 +387,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
});
|
||||
const training = trainings.map((item) => ({
|
||||
institute: item.department ?? null,
|
||||
start: item.startDate ?? null,
|
||||
end: item.endDate ?? null,
|
||||
start: Extension.ToThaiShortDate(item.startDate) ?? null,
|
||||
end: Extension.ToThaiShortDate(item.endDate) ?? null,
|
||||
level: "",
|
||||
degree: "",
|
||||
field: item.place ?? null,
|
||||
|
|
@ -396,7 +399,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { profileEmployeeId: id },
|
||||
});
|
||||
const discipline = disciplines.map((item) => ({
|
||||
DisciplineYear: item.refCommandDate ?? null,
|
||||
DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null,
|
||||
DisciplineDetail: item.detail ?? null,
|
||||
RefNo: item.refCommandNo ?? null,
|
||||
}));
|
||||
|
|
@ -407,8 +410,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
});
|
||||
const education = educations.map((item) => ({
|
||||
Institute: item.institute ?? null,
|
||||
Start: item.startDate ?? null,
|
||||
End: item.endDate ?? null,
|
||||
Start: new Date(item.startDate).getFullYear() ?? null,
|
||||
End: new Date(item.endDate).getFullYear() ?? null,
|
||||
Level: item.educationLevel ?? null,
|
||||
Degree: item.degree ?? null,
|
||||
Field: item.field ?? null,
|
||||
|
|
@ -427,7 +430,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
});
|
||||
|
||||
const salary = salarys.map((item) => ({
|
||||
SalaryDate: item.date ?? null,
|
||||
SalaryDate: Extension.ToThaiShortDate(item.date) ?? null,
|
||||
Position: item.position ?? null,
|
||||
PosNo: item.posNo ?? null,
|
||||
Salary: "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue