Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
kittapath 2024-11-04 13:29:41 +07:00
commit 8a2d5cce38
5 changed files with 267 additions and 180 deletions

View file

@ -1388,6 +1388,11 @@ export class CommandController extends Controller {
const command = await this.commandRepository.findOne({ const command = await this.commandRepository.findOne({
where: { id }, where: { id },
relations: ["commandSigns"], relations: ["commandSigns"],
order: {
commandSigns:{
createdAt: "ASC"
}
},
}); });
if (!command) { if (!command) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");

View file

@ -237,54 +237,59 @@ export class ProfileController extends Controller {
order: { lastUpdatedAt: "DESC" }, order: { lastUpdatedAt: "DESC" },
}); });
const Education = educations.map((item) => ({ const Education = educations.map((item) => ({
Institute: item.institute ? item.institute : "-", institute: item.institute ? item.institute : "-",
Date: date:
item.startDate && item.endDate item.startDate && item.endDate
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}` ? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
: "-", : "-",
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-", degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
})); }));
const mapData = { const mapData = {
Id: profile.id, // Id: profile.id,
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-", fullName: `${profile?.prefix}${profile?.firstName} ${profile?.lastName}`,
Prefix: profile.prefix != null ? profile.prefix : null, prefix: profile.prefix != null ? profile.prefix : null,
FirstName: profile.firstName != null ? profile.firstName : null, firstName: profile.firstName != null ? profile.firstName : null,
LastName: profile.lastName != null ? profile.lastName : null, lastName: profile.lastName != null ? profile.lastName : null,
DateOfBirth: citizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
dateOfBirth:
profile.birthDate != null profile.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
: "-", : "-",
DateRetire: dateRetire:
profile.dateRetire != null profile.dateRetire != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
: "-", : "-",
RegistrationAddress: Extension.ToThaiNumber( salaryAmount:
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
),
SalaryAmount:
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString()) ? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
: "-", : "-",
Education: Education, registrationAddress: Extension.ToThaiNumber(
AppointText: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
profile.dateAppoint != null ),
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint)) salaryDate:
: "-",
SalaryDate:
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
? Extension.ToThaiNumber( ? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date), Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
) )
: "-", : "-",
PositionName: profile.position != null ? profile.position : "-", positionName: profile.position != null ? profile.position : "-",
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`, appointText:
ImgUrl: ImgUrl profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
: "-",
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
educations: Education,
url: ImgUrl
? ImgUrl ? ImgUrl
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`, : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
}; };
return new HttpSuccess(mapData); return new HttpSuccess({
template: "kp7",
reportName: "docx-report",
data: mapData,
});
} }
/** /**

View file

@ -238,46 +238,51 @@ export class ProfileEmployeeController extends Controller {
})); }));
const mapData = { const mapData = {
Id: profile.id, // Id: profile.id,
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-", fullName: `${profile?.prefix}${profile?.firstName} ${profile?.lastName}`,
Prefix: profile.prefix != null ? profile.prefix : null, prefix: profile.prefix != null ? profile.prefix : null,
FirstName: profile.firstName != null ? profile.firstName : null, firstName: profile.firstName != null ? profile.firstName : null,
LastName: profile.lastName != null ? profile.lastName : null, lastName: profile.lastName != null ? profile.lastName : null,
DateOfBirth: citizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-",
dateOfBirth:
profile.birthDate != null profile.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
: "-", : "-",
DateRetire: dateRetire:
profile.dateRetire != null profile.dateRetire != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
: "-", : "-",
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`, salaryAmount:
SalaryAmount:
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString()) ? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
: "-", : "-",
Education: Education, registrationAddress: Extension.ToThaiNumber(
// profile.profileEducations.length > 0 && `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
// profile.profileEducations[profile.profileEducations.length - 1].institute != null ),
// ? profile.profileEducations[profile.profileEducations.length - 1].institute salaryDate:
// : "",
AppointText:
profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
: "-",
SalaryDate:
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
? Extension.ToThaiNumber( ? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(profile.profileSalarys[0].date), Extension.ToThaiShortDate_monthYear(profile.profileSalarys[0].date),
) )
: "-", : "-",
PositionName: profile.position != null ? profile.position : "-", positionName: profile.position != null ? profile.position : "-",
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`, appointText:
ImgUrl: ImgUrl profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
: "-",
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
educations: Education,
url: ImgUrl
? ImgUrl ? ImgUrl
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`, : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
}; };
return new HttpSuccess({
template: "kp7",
reportName: "docx-report",
data: mapData,
});
return new HttpSuccess(mapData); return new HttpSuccess(mapData);
} }
@ -435,108 +440,14 @@ export class ProfileEmployeeController extends Controller {
const _child3 = child3 ? `${child3.orgChild3Name}/` : ""; const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
const _child4 = child4 ? `${child4.orgChild4Name}/` : ""; const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
const Profile = { const cert_raw = await this.certificateRepository.find({
CitizenId:
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
Prefix: profiles?.prefix != null ? profiles.prefix : "",
FirstName: profiles?.firstName != null ? profiles.firstName : "",
LastName: profiles?.lastName != null ? profiles.lastName : "",
FullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
BirthDay: profiles?.birthDate
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
: null,
BirthDayText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate).toString())
: "",
BirthMonth: profiles?.birthDate
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
: null, // Months are zero-based
BirthYear: profiles?.birthDate
? Extension.ToThaiNumber(new Date(profiles.birthDate).getFullYear().toString())
: null,
BirthYearText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate).toString())
: "",
Address: "",
District: "",
Area: "",
Province: "",
Telephone:
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
CoupleFullName:
profileFamilyCouple?.couplePrefix ||
profileFamilyCouple?.coupleFirstName ||
profileFamilyCouple?.coupleLastNameOld
? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
: null,
FatherPrefix: profileFamilyFather?.fatherPrefix ?? "",
FatherFullName:
profileFamilyFather?.fatherPrefix ||
profileFamilyFather?.fatherFirstName ||
profileFamilyFather?.fatherLastName
? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
: null,
MotherPrefix: profileFamilyMother?.motherPrefix ?? "",
MotherFullName:
profileFamilyMother?.motherPrefix ||
profileFamilyMother?.motherFirstName ||
profileFamilyMother?.motherLastName
? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
: null,
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
Division: "",
Institute: "",
StartDate: profiles?.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateStart))
: "",
AppointDate: profiles?.dateAppoint
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
: "",
BirthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
: "",
RetireDate:
profiles.dateRetireLaw != null
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
: "",
CurrentAddress:
profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
CurrentSubDistrict:
profiles.currentSubDistrict != null
? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
: "",
CurrentDistrict:
profiles.currentDistrict != null
? Extension.ToThaiNumber(profiles.currentDistrict.name)
: "",
CurrentProvince:
profiles.currentProvince != null
? Extension.ToThaiNumber(profiles.currentProvince.name)
: "",
// AvatarId: profiles?.avatar ?? null,
ImgUrl: ImgUrl
? ImgUrl
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
ImgUrl1: _ImgUrl[0] ? _ImgUrl[0] : null,
ImgUrl2: _ImgUrl[1] ? _ImgUrl[1] : null,
ImgUrl3: _ImgUrl[2] ? _ImgUrl[2] : null,
ImgUrl4: _ImgUrl[3] ? _ImgUrl[3] : null,
ImgUrl5: _ImgUrl[4] ? _ImgUrl[4] : null,
ImgUrl6: _ImgUrl[5] ? _ImgUrl[5] : null,
ImgUrl7: _ImgUrl[6] ? _ImgUrl[6] : null,
};
const certs = await this.certificateRepository.find({
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
select: ["certificateType", "issuer", "certificateNo", "issueDate"], select: ["certificateType", "issuer", "certificateNo", "issueDate"],
order: { createdAt: "ASC" },
}); });
const Cert = const certs =
certs.length > 0 cert_raw.length > 0
? certs.map((item) => ({ ? cert_raw.slice(-2).map((item) => ({
CertificateType: item.certificateType ?? null, CertificateType: item.certificateType ?? null,
Issuer: item.issuer ?? null, Issuer: item.issuer ?? null,
CertificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null, CertificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null,
@ -550,13 +461,14 @@ export class ProfileEmployeeController extends Controller {
IssueDate: "-", IssueDate: "-",
}, },
]; ];
const trainings = await this.trainingRepository.find({ const training_raw = await this.trainingRepository.find({
select: ["startDate", "endDate", "place", "department"], select: ["startDate", "endDate", "place", "department"],
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
order: { createdAt: "ASC" },
}); });
const Training = const trainings =
trainings.length > 0 training_raw.length > 0
? trainings.map((item) => ({ ? training_raw.slice(-2).map((item) => ({
Institute: item.department ?? "", Institute: item.department ?? "",
Start: Start:
item.startDate == null item.startDate == null
@ -586,13 +498,14 @@ export class ProfileEmployeeController extends Controller {
}, },
]; ];
const disciplines = await this.disciplineRepository.find({ const discipline_raw = await this.disciplineRepository.find({
select: ["refCommandDate", "refCommandNo", "detail"], select: ["refCommandDate", "refCommandNo", "detail"],
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
order: { createdAt: "ASC" },
}); });
const Discipline = const disciplines =
disciplines.length > 0 discipline_raw.length > 0
? disciplines.map((item) => ({ ? discipline_raw.slice(-2).map((item) => ({
DisciplineYear: DisciplineYear:
Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ??
null, null,
@ -607,14 +520,15 @@ export class ProfileEmployeeController extends Controller {
}, },
]; ];
const educations = await this.educationRepository.find({ const education_raw = await this.educationRepository.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"], select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
order: { lastUpdatedAt: "DESC" }, // order: { lastUpdatedAt: "DESC" },
order: { createdAt: "ASC" },
}); });
const Education = const educations =
educations.length > 0 education_raw.length > 0
? educations.map((item) => ({ ? education_raw.slice(-2).map((item) => ({
Institute: item.institute, Institute: item.institute,
Start: Start:
item.startDate == null item.startDate == null
@ -643,7 +557,7 @@ export class ProfileEmployeeController extends Controller {
Field: "-", Field: "-",
}, },
]; ];
const salarys = await this.salaryRepository.find({ const salary_raw = await this.salaryRepository.find({
select: [ select: [
"date", "date",
"position", "position",
@ -659,9 +573,9 @@ export class ProfileEmployeeController extends Controller {
order: { order: "ASC" }, order: { order: "ASC" },
}); });
const Salary = const salarys =
salarys.length > 0 salary_raw.length > 0
? salarys.map((item) => ({ ? salary_raw.map((item) => ({
SalaryDate: item.date SalaryDate: item.date
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
: null, : null,
@ -697,7 +611,7 @@ export class ProfileEmployeeController extends Controller {
}, },
]; ];
const insignias = await this.profileInsigniaRepo.find({ const insignia_raw = await this.profileInsigniaRepo.find({
relations: { relations: {
insignia: { insignia: {
insigniaType: true, insigniaType: true,
@ -706,9 +620,9 @@ export class ProfileEmployeeController extends Controller {
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
order: { receiveDate: "ASC" }, order: { receiveDate: "ASC" },
}); });
const Insignia = const insignias =
insignias.length > 0 insignia_raw.length > 0
? insignias.map((item) => ({ ? insignia_raw.map((item) => ({
ReceiveDate: item.receiveDate ReceiveDate: item.receiveDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.receiveDate)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.receiveDate))
: "", : "",
@ -741,14 +655,14 @@ export class ProfileEmployeeController extends Controller {
}, },
]; ];
const leaves = await this.profileLeaveRepository.find({ const leave_raw = await this.profileLeaveRepository.find({
relations: { leaveType: true }, relations: { leaveType: true },
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
order: { dateLeaveStart: "ASC" }, order: { dateLeaveStart: "ASC" },
}); });
const Leave = const leaves =
leaves.length > 0 leave_raw.length > 0
? leaves.map((item) => ({ ? leave_raw.map((item) => ({
LeaveTypeName: item.leaveType.name, LeaveTypeName: item.leaveType.name,
DateLeaveStart: item.dateLeaveStart DateLeaveStart: item.dateLeaveStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart))
@ -763,16 +677,83 @@ export class ProfileEmployeeController extends Controller {
}, },
]; ];
return new HttpSuccess({ const data = {
Profile: [Profile], fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
Cert, prefix: profiles?.prefix != null ? profiles.prefix : "",
Training, firstName: profiles?.firstName != null ? profiles.firstName : "",
Discipline, lastName: profiles?.lastName != null ? profiles.lastName : "",
Education, ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
Salary, birthDate: profiles?.birthDate
Insignia, ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
Leave, : "",
}); retireDate:
profiles.dateRetireLaw != null
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
: "",
appointDate: profiles?.dateAppoint
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
: "",
citizenId:
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
fatherFullName:
profileFamilyFather?.fatherPrefix ||
profileFamilyFather?.fatherFirstName ||
profileFamilyFather?.fatherLastName
? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
: null,
motherFullName:
profileFamilyMother?.motherPrefix ||
profileFamilyMother?.motherFirstName ||
profileFamilyMother?.motherLastName
? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
: null,
coupleFullName:
profileFamilyCouple?.couplePrefix ||
profileFamilyCouple?.coupleFirstName ||
profileFamilyCouple?.coupleLastNameOld
? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastName ?? ""}`.trim()
: null,
coupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
currentAddress:
profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
currentSubDistrict:
profiles.currentSubDistrict != null
? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
: "",
currentDistrict:
profiles.currentDistrict != null
? Extension.ToThaiNumber(profiles.currentDistrict.name)
: "",
currentProvince:
profiles.currentProvince != null
? Extension.ToThaiNumber(profiles.currentProvince.name)
: "",
telephone:
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
url: ImgUrl
? ImgUrl
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
url2: _ImgUrl[1] ? _ImgUrl[1] : null,
url3: _ImgUrl[2] ? _ImgUrl[2] : null,
url4: _ImgUrl[3] ? _ImgUrl[3] : null,
url5: _ImgUrl[4] ? _ImgUrl[4] : null,
url6: _ImgUrl[5] ? _ImgUrl[5] : null,
url7: _ImgUrl[6] ? _ImgUrl[6] : null,
insignias,
leaves,
certs,
trainings,
disciplines,
educations,
salarys,
};
return new HttpSuccess({
template: "kk1-emp",
reportName: "docx-report",
data: data,
});
} }
/** /**

View file

@ -0,0 +1,45 @@
import { ViewColumn, ViewEntity } from "typeorm";
@ViewEntity({
expression: `SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullName\`
FROM
(((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`,
})
export class viewDirector {
@ViewColumn()
id: string;
@ViewColumn()
prefix: string;
@ViewColumn()
firstName: string;
@ViewColumn()
lastName: string;
@ViewColumn()
citizenId: string;
@ViewColumn()
position: string;
@ViewColumn()
posLevel: string;
@ViewColumn()
posType: string;
@ViewColumn()
isDirector: boolean;
@ViewColumn()
orgRootId: string;
@ViewColumn()
actFullName: string;
}

View file

@ -0,0 +1,51 @@
import { ViewColumn, ViewEntity } from "typeorm";
@ViewEntity({
expression: `SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`,
})
export class viewCommanderDirector {
@ViewColumn()
id: string;
@ViewColumn()
prefix: string;
@ViewColumn()
firstName: string;
@ViewColumn()
lastName: string;
@ViewColumn()
citizenId: string;
@ViewColumn()
position: string;
@ViewColumn()
posLevel: string;
@ViewColumn()
posType: string;
@ViewColumn()
isDirector: boolean;
@ViewColumn()
orgRootId: string;
@ViewColumn()
actFullName: string;
}