2024-11-04 12:03:09 +07:00
import { ViewColumn , ViewEntity } from "typeorm" ;
@ViewEntity ( {
expression : ` SELECT
\ ` profileChild \` . \` id \` AS \` Id \` ,
\ ` profileChild \` . \` prefix \` AS \` prefix \` ,
\ ` profileChild \` . \` firstName \` AS \` firstName \` ,
\ ` profileChild \` . \` lastName \` AS \` lastName \` ,
\ ` profileChild \` . \` citizenId \` AS \` citizenId \` ,
\ ` profileChild \` . \` position \` AS \` position \` ,
2024-11-05 10:46:26 +07:00
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 \` ,
2024-11-04 12:03:09 +07:00
\ ` 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 \` ,
2024-11-05 10:46:26 +07:00
\ ` bma_ehr_organization_demo \` . \` profile \` . \` id \` AS \` actFullNameId \` ,
2024-11-04 12:03:09 +07:00
CONCAT ( \ ` bma_ehr_organization_demo \` . \` profile \` . \` prefix \` ,
\ ` bma_ehr_organization_demo \` . \` profile \` . \` firstName \` ,
' ' ,
\ ` bma_ehr_organization_demo \` . \` profile \` . \` lastName \` ) AS \` actFullName \`
FROM
2024-11-05 10:46:26 +07:00
( ( ( ( ( ( ( ( ( ( ( \ ` bma_ehr_organization_demo \` . \` posMasterAct \`
2024-11-04 12:03:09 +07:00
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 \` )))
2024-11-05 10:46:26 +07:00
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 \` )))
2024-11-04 12:03:09 +07:00
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 \` ))) ` ,
} )
2024-11-04 16:09:05 +07:00
export class viewDirectorActing {
2024-11-04 12:03:09 +07:00
@ViewColumn ( )
id : string ;
@ViewColumn ( )
prefix : string ;
@ViewColumn ( )
firstName : string ;
@ViewColumn ( )
lastName : string ;
@ViewColumn ( )
citizenId : string ;
@ViewColumn ( )
position : string ;
@ViewColumn ( )
2024-11-05 10:46:26 +07:00
posNo : string ;
@ViewColumn ( )
2024-11-04 12:03:09 +07:00
posLevel : string ;
@ViewColumn ( )
posType : string ;
@ViewColumn ( )
isDirector : boolean ;
@ViewColumn ( )
orgRootId : string ;
@ViewColumn ( )
2024-11-05 10:46:26 +07:00
actFullNameId : string ;
@ViewColumn ( )
2024-11-04 12:03:09 +07:00
actFullName : string ;
}