Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
# Conflicts: # src/controllers/PositionController.ts
This commit is contained in:
commit
e329157cda
2 changed files with 84 additions and 0 deletions
|
|
@ -718,6 +718,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgRoot.orgRootFax,
|
orgTreeFax: orgRoot.orgRootFax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
labelName: orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" +" "+ orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: { orgRevisionId: orgRoot.orgRevisionId, orgRootId: orgRoot.id },
|
where: { orgRevisionId: orgRoot.orgRevisionId, orgRootId: orgRoot.id },
|
||||||
}),
|
}),
|
||||||
|
|
@ -824,6 +825,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild1.orgChild1Fax,
|
orgTreeFax: orgChild1.orgChild1Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
labelName: orgChild1.orgChild1Name + " " + orgRoot.orgRootCode +orgChild1.orgChild1Code +" "+ orgChild1.orgChild1ShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
||||||
}),
|
}),
|
||||||
|
|
@ -930,6 +932,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild2.orgChild2Fax,
|
orgTreeFax: orgChild2.orgChild2Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
labelName: orgChild2.orgChild2Name + " " + orgRoot.orgRootCode +orgChild2.orgChild2Code +" "+ orgChild2.orgChild2ShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -1039,6 +1042,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild3.orgChild3Fax,
|
orgTreeFax: orgChild3.orgChild3Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
labelName: orgChild3.orgChild3Name + " " + orgRoot.orgRootCode +orgChild3.orgChild3Code +" "+ orgChild3.orgChild3ShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -1148,6 +1152,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild4.orgChild4Fax,
|
orgTreeFax: orgChild4.orgChild4Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
labelName: orgChild4.orgChild4Name + " " + orgRoot.orgRootCode +orgChild4.orgChild4Code +" "+ orgChild4.orgChild4ShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
|
||||||
|
|
@ -944,6 +944,7 @@ export class PositionController extends Controller {
|
||||||
let checkChildConditions: any = {};
|
let checkChildConditions: any = {};
|
||||||
let keywordAsInt: any;
|
let keywordAsInt: any;
|
||||||
let searchShortName = "";
|
let searchShortName = "";
|
||||||
|
let labelName = "";
|
||||||
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
|
||||||
|
|
@ -1082,6 +1083,21 @@ export class PositionController extends Controller {
|
||||||
.andWhere(revisionCondition);
|
.andWhere(revisionCondition);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
.orWhere(
|
||||||
|
new Brackets((qb) => {
|
||||||
|
qb.andWhere(
|
||||||
|
body.keyword != null && body.keyword != ""
|
||||||
|
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
|
||||||
|
: "1=1",
|
||||||
|
{
|
||||||
|
keyword: `%${body.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.andWhere(checkChildConditions)
|
||||||
|
.andWhere(typeCondition)
|
||||||
|
.andWhere(revisionCondition);
|
||||||
|
}),
|
||||||
|
)
|
||||||
.orWhere(
|
.orWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.andWhere(
|
qb.andWhere(
|
||||||
|
|
@ -1499,6 +1515,69 @@ export class PositionController extends Controller {
|
||||||
posMaster.orgRevisionId = org.orgRevisionId;
|
posMaster.orgRevisionId = org.orgRevisionId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const type0LastPosMasterNo =
|
||||||
|
requestBody.type == 0
|
||||||
|
? await this.posMasterRepository.find({
|
||||||
|
where: {
|
||||||
|
orgRootId: requestBody.id,
|
||||||
|
orgChild1Id: IsNull(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const type1LastPosMasterNo =
|
||||||
|
requestBody.type == 1
|
||||||
|
? await this.posMasterRepository.find({
|
||||||
|
where: {
|
||||||
|
orgChild1Id: requestBody.id,
|
||||||
|
orgChild2Id: IsNull(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const type2LastPosMasterNo =
|
||||||
|
requestBody.type == 2
|
||||||
|
? await this.posMasterRepository.find({
|
||||||
|
where: {
|
||||||
|
orgChild2Id: requestBody.id,
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const type3LastPosMasterNo =
|
||||||
|
requestBody.type == 3
|
||||||
|
? await this.posMasterRepository.find({
|
||||||
|
where: {
|
||||||
|
orgChild3Id: requestBody.id,
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const type4LastPosMasterNo =
|
||||||
|
requestBody.type == 4
|
||||||
|
? await this.posMasterRepository.find({
|
||||||
|
where: {
|
||||||
|
orgChild4Id: requestBody.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const allLastPosMasterNo = [
|
||||||
|
...type0LastPosMasterNo,
|
||||||
|
...type1LastPosMasterNo,
|
||||||
|
...type2LastPosMasterNo,
|
||||||
|
...type3LastPosMasterNo,
|
||||||
|
...type4LastPosMasterNo,
|
||||||
|
];
|
||||||
|
|
||||||
|
const maxPosMasterNo = Math.max(...allLastPosMasterNo.map((pos) => pos.posMasterNo), 0);
|
||||||
|
|
||||||
|
const maxPosMasterOrder = Math.max(...allLastPosMasterNo.map((pos) => pos.posMasterOrder), 0);
|
||||||
|
|
||||||
|
posMaster.posMasterNo = maxPosMasterNo + 1;
|
||||||
|
posMaster.posMasterOrder = maxPosMasterOrder + 1;
|
||||||
posMaster.createdUserId = request.user.sub;
|
posMaster.createdUserId = request.user.sub;
|
||||||
posMaster.createdFullName = request.user.name;
|
posMaster.createdFullName = request.user.name;
|
||||||
posMaster.lastUpdateUserId = request.user.sub;
|
posMaster.lastUpdateUserId = request.user.sub;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue