Merge branch 'develop' into adiDev
# Conflicts: # src/controllers/CommandController.ts # src/controllers/ProfileController.ts
This commit is contained in:
commit
41c8b8263b
17 changed files with 1015 additions and 175 deletions
|
|
@ -2527,6 +2527,7 @@ export class CommandController extends Controller {
|
||||||
date: item.date,
|
date: item.date,
|
||||||
refCommandNo: item.refCommandNo,
|
refCommandNo: item.refCommandNo,
|
||||||
templateDoc: item.salaryRef,
|
templateDoc: item.salaryRef,
|
||||||
|
commandId: item.commandId,
|
||||||
position: profile.position,
|
position: profile.position,
|
||||||
positionType: profile.posType.posTypeName,
|
positionType: profile.posType.posTypeName,
|
||||||
positionLevel: profile.posLevel.posLevelName,
|
positionLevel: profile.posLevel.posLevelName,
|
||||||
|
|
@ -2559,7 +2560,18 @@ export class CommandController extends Controller {
|
||||||
await this.salaryHistoryRepo.save(history);
|
await this.salaryHistoryRepo.save(history);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
const checkCommandType = await this.commandRepository.findOne({
|
||||||
|
where: { id: (body.data.length > 0 ? body.data[0].commandId?.toString() : "") },
|
||||||
|
relations: ["commandType"]
|
||||||
|
});
|
||||||
|
if(checkCommandType?.commandType.code == "C-PM-11") {
|
||||||
|
const profile = await this.profileRepository.find({ where: { id: In(body.data.map(x => x.profileId)) } });
|
||||||
|
const data = profile.map((x) => ({
|
||||||
|
...x,
|
||||||
|
isProbation: false,
|
||||||
|
}));
|
||||||
|
await this.profileRepository.save(data);
|
||||||
|
}
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3254,14 +3266,14 @@ export class CommandController extends Controller {
|
||||||
no: Extension.ToThaiNumber((i + 1).toString()),
|
no: Extension.ToThaiNumber((i + 1).toString()),
|
||||||
fullName: `${item.Prefix ?? ""}${item.FirstName ?? ""} ${item.LastName ?? ""}`,
|
fullName: `${item.Prefix ?? ""}${item.FirstName ?? ""} ${item.LastName ?? ""}`,
|
||||||
oc:
|
oc:
|
||||||
(posMasterAct.posMasterChild?.current_holder?.position ?? "-") +
|
/*(posMasterAct.posMasterChild?.current_holder?.position ?? "-") +
|
||||||
"/" +
|
"/" +*/
|
||||||
(_organization ?? "-"),
|
(_organization ?? "-"),
|
||||||
postype: posMasterAct.posMasterChild?.current_holder?.posType?.posTypeName ?? "-",
|
postype: posMasterAct.posMasterChild?.current_holder?.posType?.posTypeName ?? "-",
|
||||||
poslevel: posMasterAct.posMasterChild?.current_holder?.posLevel?.posLevelName ?? "-",
|
poslevel: posMasterAct.posMasterChild?.current_holder?.posLevel?.posLevelName ?? "-",
|
||||||
organizationNew:
|
organizationNew:
|
||||||
(posMasterAct.posMaster?.current_holder?.position ?? "-") +
|
/*(posMasterAct.posMaster?.current_holder?.position ?? "-") +
|
||||||
"/" +
|
"/" +*/
|
||||||
(_organizationNew ?? "-"),
|
(_organizationNew ?? "-"),
|
||||||
// date: Extension.ToThaiShortDate_noPrefix(new Date()),
|
// date: Extension.ToThaiShortDate_noPrefix(new Date()),
|
||||||
dateStart: "-",
|
dateStart: "-",
|
||||||
|
|
|
||||||
|
|
@ -1351,7 +1351,13 @@ export class ProfileController extends Controller {
|
||||||
async getProfileCommanderDirector(
|
async getProfileCommanderDirector(
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
@Body()
|
@Body()
|
||||||
body: { isAct: boolean; isDirector: boolean; keyword: string; page: number; pageSize: number },
|
body: {
|
||||||
|
isAct: boolean;
|
||||||
|
isDirector: boolean;
|
||||||
|
keyword: string;
|
||||||
|
page: number;
|
||||||
|
pageSize: number;
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
if (body.isAct == true) {
|
if (body.isAct == true) {
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
|
|
@ -1365,12 +1371,12 @@ export class ProfileController extends Controller {
|
||||||
let condition: any = {
|
let condition: any = {
|
||||||
orgRootId: posMaster.orgRootId || "",
|
orgRootId: posMaster.orgRootId || "",
|
||||||
};
|
};
|
||||||
if (body.isDirector == true) {
|
// if (body.isDirector == true) {
|
||||||
condition = {
|
condition = {
|
||||||
orgRootId: posMaster.orgRootId || "",
|
orgRootId: posMaster.orgRootId || "",
|
||||||
isDirector: true,
|
isDirector: true,
|
||||||
};
|
};
|
||||||
}
|
// }
|
||||||
const [lists, total] = await AppDataSource.getRepository(viewDirectorActing)
|
const [lists, total] = await AppDataSource.getRepository(viewDirectorActing)
|
||||||
.createQueryBuilder("viewDirectorActing")
|
.createQueryBuilder("viewDirectorActing")
|
||||||
.andWhere(condition)
|
.andWhere(condition)
|
||||||
|
|
@ -4219,6 +4225,7 @@ export class ProfileController extends Controller {
|
||||||
position: `%${requestBody.position}%`,
|
position: `%${requestBody.position}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
.andWhere("profile.isLeave IS FALSE")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(
|
||||||
|
|
@ -4399,7 +4406,164 @@ export class ProfileController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
const profile = await this.profileEmpRepo.findOne({
|
||||||
|
where: { keycloak: request.user.sub },
|
||||||
|
relations: [
|
||||||
|
"posLevel",
|
||||||
|
"posType",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"profileSalarys",
|
||||||
|
],
|
||||||
|
order: {
|
||||||
|
profileSalarys: {
|
||||||
|
order: "DESC",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||||
|
}
|
||||||
|
|
||||||
|
let orgRevisionPublish: any = await this.orgRevisionRepo
|
||||||
|
.createQueryBuilder("orgRevision")
|
||||||
|
.where("orgRevision.orgRevisionIsDraft = false")
|
||||||
|
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
||||||
|
.getOne();
|
||||||
|
if (!orgRevisionPublish) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (revisionId) {
|
||||||
|
orgRevisionPublish = await this.orgRevisionRepo
|
||||||
|
.createQueryBuilder("orgRevision")
|
||||||
|
.where("orgRevision.id = :revisionId", { revisionId })
|
||||||
|
.getOne();
|
||||||
|
if (!orgRevisionPublish) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const posMaster =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.length == 0 ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
||||||
|
|
||||||
|
const root =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
|
||||||
|
const child1 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
||||||
|
?.orgChild1;
|
||||||
|
const child2 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
||||||
|
?.orgChild2;
|
||||||
|
const child3 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
||||||
|
?.orgChild3;
|
||||||
|
const child4 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
||||||
|
?.orgChild4;
|
||||||
|
|
||||||
|
const position = await this.positionRepository.findOne({
|
||||||
|
relations: ["posExecutive"],
|
||||||
|
where: {
|
||||||
|
posMasterId: posMaster?.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const _profile: any = {
|
||||||
|
profileId: profile.id,
|
||||||
|
prefix: profile.prefix,
|
||||||
|
rank: profile.rank,
|
||||||
|
avatar: profile.avatar,
|
||||||
|
isProbation: profile.isProbation,
|
||||||
|
avatarName: profile.avatarName,
|
||||||
|
firstName: profile.firstName,
|
||||||
|
lastName: profile.lastName,
|
||||||
|
citizenId: profile.citizenId,
|
||||||
|
birthDate: profile.birthDate,
|
||||||
|
position: profile.position,
|
||||||
|
leaveDate: profile.dateLeave,
|
||||||
|
dateStart: profile.dateStart,
|
||||||
|
dateRetireLaw: profile.dateRetireLaw,
|
||||||
|
posMaster: posMaster == null ? null : posMaster.posMasterNo,
|
||||||
|
posMasterNo: posMaster == null ? null : posMaster.posMasterNo,
|
||||||
|
posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName,
|
||||||
|
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
|
||||||
|
posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
|
||||||
|
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||||
|
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||||
|
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||||
|
posExecutiveName:
|
||||||
|
position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.posExecutiveName,
|
||||||
|
posExecutivePriority:
|
||||||
|
position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.posExecutivePriority,
|
||||||
|
posExecutiveId:
|
||||||
|
position == null || position.posExecutive == null ? null : position.posExecutive.id,
|
||||||
|
rootId: root == null ? null : root.id,
|
||||||
|
root: root == null ? null : root.orgRootName,
|
||||||
|
rootShortName: root == null ? null : root.orgRootShortName,
|
||||||
|
child1Id: child1 == null ? null : child1.id,
|
||||||
|
child1: child1 == null ? null : child1.orgChild1Name,
|
||||||
|
child1ShortName: child1 == null ? null : child1.orgChild1ShortName,
|
||||||
|
child2Id: child2 == null ? null : child2.id,
|
||||||
|
child2: child2 == null ? null : child2.orgChild2Name,
|
||||||
|
child2ShortName: child2 == null ? null : child2.orgChild2ShortName,
|
||||||
|
child3Id: child3 == null ? null : child3.id,
|
||||||
|
child3: child3 == null ? null : child3.orgChild3Name,
|
||||||
|
child3ShortName: child3 == null ? null : child3.orgChild3ShortName,
|
||||||
|
child4Id: child4 == null ? null : child4.id,
|
||||||
|
child4: child4 == null ? null : child4.orgChild4Name,
|
||||||
|
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
|
||||||
|
node: null,
|
||||||
|
nodeId: null,
|
||||||
|
type: profile.employeeClass,
|
||||||
|
salary:
|
||||||
|
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
|
||||||
|
};
|
||||||
|
if (_profile.child4Id != null) {
|
||||||
|
_profile.node = 4;
|
||||||
|
_profile.nodeId = _profile.child4Id;
|
||||||
|
} else if (_profile.child3Id != null) {
|
||||||
|
_profile.node = 3;
|
||||||
|
_profile.nodeId = _profile.child3Id;
|
||||||
|
} else if (_profile.child2Id != null) {
|
||||||
|
_profile.node = 2;
|
||||||
|
_profile.nodeId = _profile.child2Id;
|
||||||
|
} else if (_profile.child1Id != null) {
|
||||||
|
_profile.node = 1;
|
||||||
|
_profile.nodeId = _profile.child1Id;
|
||||||
|
} else if (_profile.rootId != null) {
|
||||||
|
_profile.node = 0;
|
||||||
|
_profile.nodeId = _profile.rootId;
|
||||||
|
}
|
||||||
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
let orgRevisionPublish: any = await this.orgRevisionRepo
|
let orgRevisionPublish: any = await this.orgRevisionRepo
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ import { ProfileInsignia } from "../entities/ProfileInsignia";
|
||||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { Position } from "../entities/Position";
|
||||||
@Route("api/v1/org/profile-employee")
|
@Route("api/v1/org/profile-employee")
|
||||||
@Tags("ProfileEmployee")
|
@Tags("ProfileEmployee")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -107,6 +108,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
private profileEducationRepository = AppDataSource.getRepository(ProfileEducation);
|
private profileEducationRepository = AppDataSource.getRepository(ProfileEducation);
|
||||||
private profileInsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
private profileInsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||||
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
|
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
|
||||||
|
private positionRepository = AppDataSource.getRepository(Position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* report ประวัติแบบย่อ ลูกจ้าง
|
* report ประวัติแบบย่อ ลูกจ้าง
|
||||||
*
|
*
|
||||||
|
|
@ -257,7 +260,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
||||||
: "-",
|
: "-",
|
||||||
registrationAddress: Extension.ToThaiNumber(
|
registrationAddress: Extension.ToThaiNumber(
|
||||||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||||
),
|
),
|
||||||
salaryDate:
|
salaryDate:
|
||||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
||||||
|
|
@ -272,9 +275,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
: "-",
|
: "-",
|
||||||
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
educations: Education,
|
educations: Education,
|
||||||
url: ImgUrl
|
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||||
? ImgUrl
|
|
||||||
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
|
|
@ -447,7 +448,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
const certs =
|
const certs =
|
||||||
cert_raw.length > 0
|
cert_raw.length > 0
|
||||||
? cert_raw.slice(-2).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,
|
||||||
|
|
@ -677,90 +678,102 @@ export class ProfileEmployeeController extends Controller {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||||
prefix: profiles?.prefix != null ? profiles.prefix : "",
|
prefix: profiles?.prefix != null ? profiles.prefix : "",
|
||||||
firstName: profiles?.firstName != null ? profiles.firstName : "",
|
firstName: profiles?.firstName != null ? profiles.firstName : "",
|
||||||
lastName: profiles?.lastName != null ? profiles.lastName : "",
|
lastName: profiles?.lastName != null ? profiles.lastName : "",
|
||||||
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
birthDate: profiles?.birthDate
|
birthDate: profiles?.birthDate
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
|
||||||
: "",
|
: "",
|
||||||
retireDate:
|
retireDate:
|
||||||
profiles.dateRetireLaw != null
|
profiles.dateRetireLaw != null
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
|
||||||
: "",
|
: "",
|
||||||
appointDate: profiles?.dateAppoint
|
appointDate: profiles?.dateAppoint
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
|
||||||
: "",
|
: "",
|
||||||
citizenId:
|
citizenId:
|
||||||
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
||||||
fatherFullName:
|
fatherFullName:
|
||||||
profileFamilyFather?.fatherPrefix ||
|
profileFamilyFather?.fatherPrefix ||
|
||||||
profileFamilyFather?.fatherFirstName ||
|
profileFamilyFather?.fatherFirstName ||
|
||||||
profileFamilyFather?.fatherLastName
|
profileFamilyFather?.fatherLastName
|
||||||
? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||||
: null,
|
: null,
|
||||||
motherFullName:
|
motherFullName:
|
||||||
profileFamilyMother?.motherPrefix ||
|
profileFamilyMother?.motherPrefix ||
|
||||||
profileFamilyMother?.motherFirstName ||
|
profileFamilyMother?.motherFirstName ||
|
||||||
profileFamilyMother?.motherLastName
|
profileFamilyMother?.motherLastName
|
||||||
? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
||||||
: null,
|
: null,
|
||||||
coupleFullName:
|
coupleFullName:
|
||||||
profileFamilyCouple?.couplePrefix ||
|
profileFamilyCouple?.couplePrefix ||
|
||||||
profileFamilyCouple?.coupleFirstName ||
|
profileFamilyCouple?.coupleFirstName ||
|
||||||
profileFamilyCouple?.coupleLastNameOld
|
profileFamilyCouple?.coupleLastNameOld
|
||||||
? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastName ?? ""}`.trim()
|
? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastName ?? ""}`.trim()
|
||||||
: null,
|
: null,
|
||||||
coupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
coupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||||
currentAddress:
|
currentAddress:
|
||||||
profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
|
profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
|
||||||
currentSubDistrict:
|
currentSubDistrict:
|
||||||
profiles.currentSubDistrict != null
|
profiles.currentSubDistrict != null
|
||||||
? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
|
? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
|
||||||
: "",
|
: "",
|
||||||
currentDistrict:
|
currentDistrict:
|
||||||
profiles.currentDistrict != null
|
profiles.currentDistrict != null
|
||||||
? Extension.ToThaiNumber(profiles.currentDistrict.name)
|
? Extension.ToThaiNumber(profiles.currentDistrict.name)
|
||||||
: "",
|
: "",
|
||||||
currentProvince:
|
currentProvince:
|
||||||
profiles.currentProvince != null
|
profiles.currentProvince != null
|
||||||
? Extension.ToThaiNumber(profiles.currentProvince.name)
|
? Extension.ToThaiNumber(profiles.currentProvince.name)
|
||||||
: "",
|
: "",
|
||||||
telephone:
|
telephone:
|
||||||
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
||||||
url: ImgUrl
|
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||||
? ImgUrl
|
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
||||||
: `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
yearUpload1: profiles.profileAvatars[0]
|
||||||
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
||||||
yearUpload1: profiles.profileAvatars[0] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt)) : null,
|
: null,
|
||||||
url2: _ImgUrl[1] ? _ImgUrl[1] : null,
|
url2: _ImgUrl[1] ? _ImgUrl[1] : null,
|
||||||
yearUpload2: profiles.profileAvatars[1] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt)) : null,
|
yearUpload2: profiles.profileAvatars[1]
|
||||||
url3: _ImgUrl[2] ? _ImgUrl[2] : null,
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt))
|
||||||
yearUpload3: profiles.profileAvatars[2] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt)) : null,
|
: null,
|
||||||
url4: _ImgUrl[3] ? _ImgUrl[3] : null,
|
url3: _ImgUrl[2] ? _ImgUrl[2] : null,
|
||||||
yearUpload4: profiles.profileAvatars[3] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt)) : null,
|
yearUpload3: profiles.profileAvatars[2]
|
||||||
url5: _ImgUrl[4] ? _ImgUrl[4] : null,
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt))
|
||||||
yearUpload5: profiles.profileAvatars[4] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt)) : null,
|
: null,
|
||||||
url6: _ImgUrl[5] ? _ImgUrl[5] : null,
|
url4: _ImgUrl[3] ? _ImgUrl[3] : null,
|
||||||
yearUpload6: profiles.profileAvatars[5] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt)) : null,
|
yearUpload4: profiles.profileAvatars[3]
|
||||||
url7: _ImgUrl[6] ? _ImgUrl[6] : null,
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt))
|
||||||
yearUpload7: profiles.profileAvatars[6] ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt)) : null,
|
: null,
|
||||||
insignias,
|
url5: _ImgUrl[4] ? _ImgUrl[4] : null,
|
||||||
leaves,
|
yearUpload5: profiles.profileAvatars[4]
|
||||||
certs,
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt))
|
||||||
trainings,
|
: null,
|
||||||
disciplines,
|
url6: _ImgUrl[5] ? _ImgUrl[5] : null,
|
||||||
educations,
|
yearUpload6: profiles.profileAvatars[5]
|
||||||
salarys,
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt))
|
||||||
};
|
: null,
|
||||||
|
url7: _ImgUrl[6] ? _ImgUrl[6] : null,
|
||||||
return new HttpSuccess({
|
yearUpload7: profiles.profileAvatars[6]
|
||||||
template: "kk1-emp",
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt))
|
||||||
reportName: "docx-report",
|
: null,
|
||||||
data: data,
|
insignias,
|
||||||
});
|
leaves,
|
||||||
|
certs,
|
||||||
|
trainings,
|
||||||
|
disciplines,
|
||||||
|
educations,
|
||||||
|
salarys,
|
||||||
|
};
|
||||||
|
|
||||||
|
return new HttpSuccess({
|
||||||
|
template: "kk1-emp",
|
||||||
|
reportName: "docx-report",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1668,6 +1681,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
position: `%${requestBody.position}%`,
|
position: `%${requestBody.position}%`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
.andWhere("profileEmployee.isLeave IS FALSE")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(
|
||||||
|
|
@ -1861,98 +1875,106 @@ export class ProfileEmployeeController extends Controller {
|
||||||
orgRevisionPublish = await this.orgRevisionRepo
|
orgRevisionPublish = await this.orgRevisionRepo
|
||||||
.createQueryBuilder("orgRevision")
|
.createQueryBuilder("orgRevision")
|
||||||
.where("orgRevision.id = :revisionId", { revisionId })
|
.where("orgRevision.id = :revisionId", { revisionId })
|
||||||
// .andWhere("orgRevision.orgRevisionIsDraft = false")
|
|
||||||
// .andWhere("orgRevision.orgRevisionIsCurrent = true")
|
|
||||||
.getOne();
|
.getOne();
|
||||||
if (!orgRevisionPublish) {
|
if (!orgRevisionPublish) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const posMaster =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.length == 0 ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
||||||
|
|
||||||
|
const root =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
|
||||||
|
const child1 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1;
|
||||||
|
const child2 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2;
|
||||||
|
const child3 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3;
|
||||||
|
const child4 =
|
||||||
|
profile.current_holders == null ||
|
||||||
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
||||||
|
null
|
||||||
|
? null
|
||||||
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
|
||||||
|
|
||||||
|
const position = await this.positionRepository.findOne({
|
||||||
|
relations: ["posExecutive"],
|
||||||
|
where: {
|
||||||
|
posMasterId: posMaster?.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const _profile = {
|
const _profile = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
rank: profile.rank,
|
|
||||||
prefix: profile.prefix,
|
prefix: profile.prefix,
|
||||||
|
rank: profile.rank,
|
||||||
|
avatar: profile.avatar,
|
||||||
|
isProbation: profile.isProbation,
|
||||||
|
avatarName: profile.avatarName,
|
||||||
firstName: profile.firstName,
|
firstName: profile.firstName,
|
||||||
lastName: profile.lastName,
|
lastName: profile.lastName,
|
||||||
citizenId: profile.citizenId,
|
citizenId: profile.citizenId,
|
||||||
|
birthDate: profile.birthDate,
|
||||||
position: profile.position,
|
position: profile.position,
|
||||||
|
leaveDate: profile.dateLeave,
|
||||||
|
dateStart: profile.dateStart,
|
||||||
|
dateRetireLaw: profile.dateRetireLaw,
|
||||||
|
posMaster: posMaster == null ? null : posMaster.posMasterNo,
|
||||||
|
posMasterNo: posMaster == null ? null : posMaster.posMasterNo,
|
||||||
posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName,
|
posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName,
|
||||||
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
|
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
|
||||||
posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
|
posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
|
||||||
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||||
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||||
posTypeId: profile.posType == null ? null : profile.posType.id,
|
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||||
rootId:
|
posExecutiveName:
|
||||||
profile.current_holders == null ||
|
position == null || position.posExecutive == null
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
|
||||||
null
|
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
: position.posExecutive.posExecutiveName,
|
||||||
?.orgRootId,
|
posExecutivePriority:
|
||||||
root:
|
position == null || position.posExecutive == null
|
||||||
profile.current_holders == null ||
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
|
||||||
null
|
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot
|
: position.posExecutive.posExecutivePriority,
|
||||||
.orgRootName,
|
posExecutiveId:
|
||||||
child1Id:
|
position == null || position.posExecutive == null ? null : position.posExecutive.id,
|
||||||
profile.current_holders == null ||
|
rootId: root == null ? null : root.id,
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
root: root == null ? null : root.orgRootName,
|
||||||
null
|
rootShortName: root == null ? null : root.orgRootShortName,
|
||||||
? null
|
child1Id: child1 == null ? null : child1.id,
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
child1: child1 == null ? null : child1.orgChild1Name,
|
||||||
?.orgChild1Id,
|
child1ShortName: child1 == null ? null : child1.orgChild1ShortName,
|
||||||
child1:
|
child2Id: child2 == null ? null : child2.id,
|
||||||
profile.current_holders == null ||
|
child2: child2 == null ? null : child2.orgChild2Name,
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
child2ShortName: child2 == null ? null : child2.orgChild2ShortName,
|
||||||
null
|
child3Id: child3 == null ? null : child3.id,
|
||||||
? null
|
child3: child3 == null ? null : child3.orgChild3Name,
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1
|
child3ShortName: child3 == null ? null : child3.orgChild3ShortName,
|
||||||
.orgChild1Name,
|
child4Id: child4 == null ? null : child4.id,
|
||||||
child2Id:
|
child4: child4 == null ? null : child4.orgChild4Name,
|
||||||
profile.current_holders == null ||
|
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
node: null,
|
||||||
null
|
nodeId: null,
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild2Id,
|
|
||||||
child2:
|
|
||||||
profile.current_holders == null ||
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
|
||||||
null
|
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2
|
|
||||||
.orgChild2Name,
|
|
||||||
child3Id:
|
|
||||||
profile.current_holders == null ||
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
|
||||||
null
|
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild3Id,
|
|
||||||
child3:
|
|
||||||
profile.current_holders == null ||
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
|
||||||
null
|
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3
|
|
||||||
.orgChild3Name,
|
|
||||||
child4Id:
|
|
||||||
profile.current_holders == null ||
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
|
||||||
null
|
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
|
|
||||||
?.orgChild4Id,
|
|
||||||
child4:
|
|
||||||
profile.current_holders == null ||
|
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
|
||||||
null
|
|
||||||
? null
|
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4
|
|
||||||
.orgChild4Name,
|
|
||||||
salary:
|
salary:
|
||||||
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
|
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ export class ProfileFamilyMotherController extends Controller {
|
||||||
motherPrefix: y.motherPrefix,
|
motherPrefix: y.motherPrefix,
|
||||||
motherFirstName: y.motherFirstName,
|
motherFirstName: y.motherFirstName,
|
||||||
motherLastName: y.motherLastName,
|
motherLastName: y.motherLastName,
|
||||||
|
motherLastNameOld: y.motherLastNameOld,
|
||||||
motherCareer: y.motherCareer,
|
motherCareer: y.motherCareer,
|
||||||
motherCitizenId: y.motherCitizenId,
|
motherCitizenId: y.motherCitizenId,
|
||||||
motherLive: y.motherLive,
|
motherLive: y.motherLive,
|
||||||
|
|
@ -127,6 +128,7 @@ export class ProfileFamilyMotherController extends Controller {
|
||||||
motherPrefix: y.motherPrefix,
|
motherPrefix: y.motherPrefix,
|
||||||
motherFirstName: y.motherFirstName,
|
motherFirstName: y.motherFirstName,
|
||||||
motherLastName: y.motherLastName,
|
motherLastName: y.motherLastName,
|
||||||
|
motherLastNameOld: y.motherLastNameOld,
|
||||||
motherCareer: y.motherCareer,
|
motherCareer: y.motherCareer,
|
||||||
motherCitizenId: y.motherCitizenId,
|
motherCitizenId: y.motherCitizenId,
|
||||||
motherLive: y.motherLive,
|
motherLive: y.motherLive,
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
|
||||||
motherPrefix: y.motherPrefix,
|
motherPrefix: y.motherPrefix,
|
||||||
motherFirstName: y.motherFirstName,
|
motherFirstName: y.motherFirstName,
|
||||||
motherLastName: y.motherLastName,
|
motherLastName: y.motherLastName,
|
||||||
|
motherLastNameOld: y.motherLastNameOld,
|
||||||
motherCareer: y.motherCareer,
|
motherCareer: y.motherCareer,
|
||||||
motherCitizenId: y.motherCitizenId,
|
motherCitizenId: y.motherCitizenId,
|
||||||
motherLive: y.motherLive,
|
motherLive: y.motherLive,
|
||||||
|
|
@ -130,6 +131,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
|
||||||
motherPrefix: y.motherPrefix,
|
motherPrefix: y.motherPrefix,
|
||||||
motherFirstName: y.motherFirstName,
|
motherFirstName: y.motherFirstName,
|
||||||
motherLastName: y.motherLastName,
|
motherLastName: y.motherLastName,
|
||||||
|
motherLastNameOld: y.motherLastNameOld,
|
||||||
motherCareer: y.motherCareer,
|
motherCareer: y.motherCareer,
|
||||||
motherCitizenId: y.motherCitizenId,
|
motherCitizenId: y.motherCitizenId,
|
||||||
motherLive: y.motherLive,
|
motherLive: y.motherLive,
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
||||||
motherPrefix: y.motherPrefix,
|
motherPrefix: y.motherPrefix,
|
||||||
motherFirstName: y.motherFirstName,
|
motherFirstName: y.motherFirstName,
|
||||||
motherLastName: y.motherLastName,
|
motherLastName: y.motherLastName,
|
||||||
|
motherLastNameOld: y.motherLastNameOld,
|
||||||
motherCareer: y.motherCareer,
|
motherCareer: y.motherCareer,
|
||||||
motherCitizenId: y.motherCitizenId,
|
motherCitizenId: y.motherCitizenId,
|
||||||
motherLive: y.motherLive,
|
motherLive: y.motherLive,
|
||||||
|
|
@ -129,6 +130,7 @@ export class ProfileFamilyMotherEmployeeTempController extends Controller {
|
||||||
motherPrefix: y.motherPrefix,
|
motherPrefix: y.motherPrefix,
|
||||||
motherFirstName: y.motherFirstName,
|
motherFirstName: y.motherFirstName,
|
||||||
motherLastName: y.motherLastName,
|
motherLastName: y.motherLastName,
|
||||||
|
motherLastNameOld: y.motherLastNameOld,
|
||||||
motherCareer: y.motherCareer,
|
motherCareer: y.motherCareer,
|
||||||
motherCitizenId: y.motherCitizenId,
|
motherCitizenId: y.motherCitizenId,
|
||||||
motherLive: y.motherLive,
|
motherLive: y.motherLive,
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,11 @@ export class ViewWorkFlowController extends Controller {
|
||||||
select: ["id", "name", "sysName", "posTypeName", "posLevelName"],
|
select: ["id", "name", "sysName", "posTypeName", "posLevelName"],
|
||||||
where: { sysName: sysName, posTypeName: posTypeName, posLevelName: posLevelName },
|
where: { sysName: sysName, posTypeName: posTypeName, posLevelName: posLevelName },
|
||||||
relations: ["metaStates", "metaStates.metaStateOperators"],
|
relations: ["metaStates", "metaStates.metaStateOperators"],
|
||||||
|
order: {
|
||||||
|
metaStates: {
|
||||||
|
order: "ASC",
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new HttpSuccess(lists);
|
return new HttpSuccess(lists);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { CommandSend } from "./CommandSend";
|
||||||
export class CommandSendCC extends EntityBase {
|
export class CommandSendCC extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "เพศ",
|
comment: "ชื่อ",
|
||||||
length: 255,
|
length: 255,
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,13 @@ export class ProfileFamilyMother extends EntityBase {
|
||||||
})
|
})
|
||||||
motherLastName: string;
|
motherLastName: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
comment: "นามสกุลมารดาเดิม",
|
||||||
|
})
|
||||||
|
motherLastNameOld: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
default: null,
|
default: null,
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,13 @@ export class ProfileFamilyMotherHistory extends EntityBase {
|
||||||
})
|
})
|
||||||
motherLastName: string;
|
motherLastName: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
comment: "นามสกุลมารดาเดิม",
|
||||||
|
})
|
||||||
|
motherLastNameOld: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
default: null,
|
default: null,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
||||||
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
|
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
|
||||||
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
|
||||||
|
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\`) AS \`key\`,
|
||||||
NULL AS \`actFullNameId\`,
|
NULL AS \`actFullNameId\`,
|
||||||
NULL AS \`actFullName\`
|
NULL AS \`actFullName\`
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -60,4 +62,6 @@ export class viewDirector {
|
||||||
actFullNameId: string;
|
actFullNameId: string;
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
actFullName: string;
|
actFullName: string;
|
||||||
|
@ViewColumn()
|
||||||
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,13 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
||||||
END),
|
END),
|
||||||
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
|
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
|
||||||
|
\`posMaster\`.\`isDirector\` AS \`isDirector\`,
|
||||||
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
|
||||||
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
|
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
|
||||||
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
|
||||||
|
CONCAT(\`posMaster\`.\`id\`,
|
||||||
|
\`profileChild\`.\`id\`) AS \`key\`,
|
||||||
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
|
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
|
||||||
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
|
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
|
||||||
|
|
@ -61,9 +64,13 @@ export class viewDirectorActing {
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
isDirector: boolean;
|
isDirector: boolean;
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
|
isDirectorChild: boolean;
|
||||||
|
@ViewColumn()
|
||||||
orgRootId: string;
|
orgRootId: string;
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
actFullNameId: string;
|
actFullNameId: string;
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
actFullName: string;
|
actFullName: string;
|
||||||
|
@ViewColumn()
|
||||||
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableAppointDirectorAddPosNo11730885124771 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableAppointDirectorAddPosNo11730885124771'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandSendCC\` CHANGE \`name\` \`name\` varchar(255) NULL COMMENT 'ชื่อ'`);
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
|
||||||
|
\`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\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`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 \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandSendCC\` CHANGE \`name\` \`name\` varchar(255) NULL COMMENT 'เพศ'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableAppointDirectorAddPosNo21730887635521 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableAppointDirectorAddPosNo21730887635521'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
|
||||||
|
\`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\`,
|
||||||
|
CONCAT(\`posMasterChild\`.\`id\`,
|
||||||
|
\`profileChild\`.\`id\`) AS \`key\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`posMasterChild`.`id`,\n `profileChild`.`id`) AS `key`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`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\`,
|
||||||
|
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\`) AS \`key\`,
|
||||||
|
NULL AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`posMaster`.`id`,\n `bma_ehr_organization_demo`.`profile`.`id`) AS `key`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableAppointDirectorAddPosNo31730947807718 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableAppointDirectorAddPosNo31730947807718'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
|
||||||
|
\`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\`,
|
||||||
|
CONCAT(\`posMaster\`.\`id\`,
|
||||||
|
\`profileChild\`.\`id\`) AS \`key\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`posMaster`.`id`,\n `profileChild`.`id`) AS `key`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`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\`,
|
||||||
|
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\`) AS \`key\`,
|
||||||
|
NULL AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`posMaster`.`id`,\n `bma_ehr_organization_demo`.`profile`.`id`) AS `key`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,244 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableProfilefamAddMotherLastNameOld1730950041973 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableProfilefamAddMotherLastNameOld1730950041973'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileFamilyMotherHistory\` ADD \`motherLastNameOld\` varchar(255) NULL COMMENT 'นามสกุลมารดาเดิม'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` ADD \`motherLastNameOld\` varchar(255) NULL COMMENT 'นามสกุลมารดาเดิม'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` DROP COLUMN \`motherLastNameOld\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileFamilyMotherHistory\` DROP COLUMN \`motherLastNameOld\``);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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\`,
|
||||||
|
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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 \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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\`,
|
||||||
|
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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 \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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\`,
|
||||||
|
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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 \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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\`,
|
||||||
|
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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 \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
// NULL AS \`posNo\`,
|
||||||
|
// \`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\`,
|
||||||
|
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
// 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\`)))`);
|
||||||
|
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableProfilefamAddMotherLastNameOld11730954162083 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableProfilefamAddMotherLastNameOld11730954162083'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
|
||||||
|
\`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\`,
|
||||||
|
CONCAT(\`posMaster\`.\`id\`,
|
||||||
|
\`profileChild\`.\`id\`) AS \`key\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`posMaster`.`id`,\n `profileChild`.`id`) AS `key`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
|
||||||
|
await queryRunner.query(`CREATE VIEW \`view_director\` AS 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\`,
|
||||||
|
CONCAT((CASE
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
|
||||||
|
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
|
||||||
|
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
|
||||||
|
END),
|
||||||
|
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
|
||||||
|
\`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\`,
|
||||||
|
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
|
||||||
|
\`bma_ehr_organization_demo\`.\`profile\`.\`id\`) AS \`key\`,
|
||||||
|
NULL AS \`actFullNameId\`,
|
||||||
|
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\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
|
||||||
|
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`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\`)))`);
|
||||||
|
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`posMaster`.`id`,\n `bma_ehr_organization_demo`.`profile`.`id`) AS `key`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director\``);
|
||||||
|
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
|
||||||
|
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue