Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
1c550a2f0c
1 changed files with 33 additions and 6 deletions
|
|
@ -703,7 +703,8 @@ export class OrganizationController extends Controller {
|
||||||
.getMany()
|
.getMany()
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const formattedData = orgRootData.map((orgRoot) => {
|
// const formattedData = orgRootData.map((orgRoot) => {
|
||||||
|
const formattedData = await Promise.all(orgRootData.map(async (orgRoot) => {
|
||||||
return {
|
return {
|
||||||
orgTreeId: orgRoot.id,
|
orgTreeId: orgRoot.id,
|
||||||
orgLevel: 0,
|
orgLevel: 0,
|
||||||
|
|
@ -719,9 +720,15 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgRoot.orgRootFax,
|
orgTreeFax: orgRoot.orgRootFax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
totalPosition: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id }}),
|
||||||
|
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdCurrentHolder: IsNull() && "" }}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdNextHolder: IsNull() && "" }}),
|
||||||
|
|
||||||
children: orgChild1Data
|
children: orgChild1Data
|
||||||
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
|
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
|
||||||
.map((orgChild1) => ({
|
.map(async (orgChild1) => ({
|
||||||
orgTreeId: orgChild1.id,
|
orgTreeId: orgChild1.id,
|
||||||
orgRootId: orgRoot.id,
|
orgRootId: orgRoot.id,
|
||||||
orgLevel: 1,
|
orgLevel: 1,
|
||||||
|
|
@ -738,9 +745,14 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild1.orgChild1Fax,
|
orgTreeFax: orgChild1.orgChild1Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
totalPosition: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id }}),
|
||||||
|
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdCurrentHolder: IsNull() && "" }}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdNextHolder: IsNull() && "" }}),
|
||||||
children: orgChild2Data
|
children: orgChild2Data
|
||||||
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
|
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
|
||||||
.map((orgChild2) => ({
|
.map(async (orgChild2) => ({
|
||||||
orgTreeId: orgChild2.id,
|
orgTreeId: orgChild2.id,
|
||||||
orgRootId: orgChild1.id,
|
orgRootId: orgChild1.id,
|
||||||
orgLevel: 2,
|
orgLevel: 2,
|
||||||
|
|
@ -757,9 +769,14 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild2.orgChild2Fax,
|
orgTreeFax: orgChild2.orgChild2Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
totalPosition: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id }}),
|
||||||
|
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdCurrentHolder: IsNull() && "" }}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdNextHolder: IsNull() && "" }}),
|
||||||
children: orgChild3Data
|
children: orgChild3Data
|
||||||
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
|
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
|
||||||
.map((orgChild3) => ({
|
.map(async (orgChild3) => ({
|
||||||
orgTreeId: orgChild3.id,
|
orgTreeId: orgChild3.id,
|
||||||
orgRootId: orgChild2.id,
|
orgRootId: orgChild2.id,
|
||||||
orgLevel: 3,
|
orgLevel: 3,
|
||||||
|
|
@ -776,9 +793,14 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild3.orgChild3Fax,
|
orgTreeFax: orgChild3.orgChild3Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
totalPosition: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id }}),
|
||||||
|
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdCurrentHolder: IsNull() && "" }}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdNextHolder: IsNull() && "" }}),
|
||||||
children: orgChild4Data
|
children: orgChild4Data
|
||||||
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
|
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
|
||||||
.map((orgChild4) => ({
|
.map(async (orgChild4) => ({
|
||||||
orgTreeId: orgChild4.id,
|
orgTreeId: orgChild4.id,
|
||||||
orgRootId: orgChild3.id,
|
orgRootId: orgChild3.id,
|
||||||
orgLevel: 4,
|
orgLevel: 4,
|
||||||
|
|
@ -795,12 +817,17 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild4.orgChild4Fax,
|
orgTreeFax: orgChild4.orgChild4Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
totalPosition: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id }}),
|
||||||
|
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdCurrentHolder: IsNull() && "" }}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdNextHolder: IsNull() && "" }}),
|
||||||
})),
|
})),
|
||||||
})),
|
})),
|
||||||
})),
|
})),
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
});
|
}));
|
||||||
|
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue