Skip to content

Commit

Permalink
POC-730: Internal movement form, add Patient type with options Antena…
Browse files Browse the repository at this point in the history
…tal and Postnatal care programs under PMTCT program and validate
  • Loading branch information
Alfred-Mutai committed May 16, 2024
1 parent 69e9cf5 commit 929f1ad
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 12 deletions.
16 changes: 15 additions & 1 deletion src/app/constants/program.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ const PMTCT_PROGRAM: Program = {
dept: 'HIV',
compatibleWithOtherDeptPrograms: false
};
const ANC_PROGRAM: Program = {
uuid: '52aeb285-fb18-455b-893e-3e53ccc77ceb',
name: 'ANTENATAL CARE PROGRAM',
dept: 'HIV',
compatibleWithOtherDeptPrograms: false
};
const PNC_PROGRAM: Program = {
uuid: 'd2552058-d7bd-47c6-aed1-480a4308027a',
name: 'POSTNATAL PROGRAM',
dept: 'HIV',
compatibleWithOtherDeptPrograms: false
};
const STANDARD_HIV_PROGRAM: Program = {
uuid: '781d85b0-1359-11df-a1f1-0026b9348838',
name: 'STANDARD HIV TREATMENT',
Expand Down Expand Up @@ -122,5 +134,7 @@ export const Programs = {
EXPRESS_CARE_PROGRAM,
DTG_PHARMACO_VIGILANCE_PROGRAM,
HIV_SOCIAL_WORK_PROGRAM,
NUTRITION_PROGRAM
NUTRITION_PROGRAM,
ANC_PROGRAM,
PNC_PROGRAM
};
6 changes: 5 additions & 1 deletion src/app/constants/referral-concepts.contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const PPP_REFERRAL_CONCEPT = '4e6d1c61-624c-4350-a604-374f835aa481';
const PATIENT_PREFERENCE_CONCEPT = '7e7d4555-362a-498a-b5ed-abcddcfce2a7';
const STANDARD_HIV_CARE_REFERRAL_CONCEPT =
'b412ae76-4ab4-4d00-800e-bd8d167769e1';
const ANC_CONCEPT = '375e6d4a-ba94-41ac-8ac3-5a56015c4d92';
const PNC_CONCEPT = 'c5789e91-2c76-450a-94f7-94fce32335d3';

export const ReferralConcepts = {
differentiatedCareConceptUuid,
Expand All @@ -27,5 +29,7 @@ export const ReferralConcepts = {
BACK_TO_CCC_REFERRAL_CONCEPT,
PPP_REFERRAL_CONCEPT,
PATIENT_PREFERENCE_CONCEPT,
STANDARD_HIV_CARE_REFERRAL_CONCEPT
STANDARD_HIV_CARE_REFERRAL_CONCEPT,
ANC_CONCEPT,
PNC_CONCEPT
};
1 change: 1 addition & 0 deletions src/app/interfaces/return-value.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface ReturnValue {
providerUuid: string;
locationUuid: string;
hivReferralLocationUuid: string;
pmtctProgrammeUuid: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import { FormUuids } from './../../../constants/forms.constants';

@Injectable()
export class FormentryReferralsHandlerService {
private PMTCT_PROGRAM: Program = Programs.PMTCT_PROGRAM;
private PNC_PROGRAM: Program = Programs.PNC_PROGRAM;
private ANC_PROGRAM: Program = Programs.ANC_PROGRAM;
private STANDARD_PROGRAM: Program = Programs.STANDARD_HIV_PROGRAM;

constructor(
Expand Down Expand Up @@ -217,7 +218,8 @@ export class FormentryReferralsHandlerService {
encounterDatetime: null,
providerUuid: '',
locationUuid: '',
hivReferralLocationUuid: ''
hivReferralLocationUuid: '',
pmtctProgrammeUuid: ''
};

const formUuid = form.schema.uuid ? form.schema.uuid : '';
Expand All @@ -226,6 +228,7 @@ export class FormentryReferralsHandlerService {
const referrals_1 = this.getQuestionValue(form, 'referrals');
const internalMvmentData = this.getQuestionValue(form, 'careType');
const interMovementQstnAns = this.getQuestionValue(form, 'internalMove');

// validating if selected option is DC care and referrals is blank. Adult and youth forms are different
const referrals =
referrals_1 === undefined
Expand Down Expand Up @@ -257,6 +260,8 @@ export class FormentryReferralsHandlerService {
// haS PMTCT referral
if (internalMvmentData === ReferralConcepts.MCH_PROGRAM_CONCEPT) {
returnValue.hasPmtctReferral = true;
const pmtctPatientType = this.getQuestionValue(form, 'pmtctType');
returnValue.pmtctProgrammeUuid = pmtctPatientType;
}

// has ACTG referral
Expand Down Expand Up @@ -319,8 +324,15 @@ export class FormentryReferralsHandlerService {
referralMetaData: referralObj
};
if (referralObj.hasPmtctReferral) {
refProgram.uuid = this.PMTCT_PROGRAM.uuid;
refProgram.name = this.PMTCT_PROGRAM.name;
if (referralObj.pmtctProgrammeUuid === ReferralConcepts.ANC_CONCEPT) {
refProgram.uuid = this.ANC_PROGRAM.uuid;
refProgram.name = this.ANC_PROGRAM.name;
} else if (
referralObj.pmtctProgrammeUuid === ReferralConcepts.PNC_CONCEPT
) {
refProgram.uuid = this.PNC_PROGRAM.uuid;
refProgram.name = this.PNC_PROGRAM.name;
}
} else {
refProgram.uuid = this.STANDARD_PROGRAM.uuid;
refProgram.name = this.STANDARD_PROGRAM.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,13 @@ export class HivReferralComponent implements OnInit, OnChanges, OnDestroy {
const enrollmentsPayload = hivPrograms.map(
(hivProgram: ProgramEnrollment) => {
if (
hivProgram.program.uuid === Programs.STANDARD_HIV_PROGRAM.uuid &&
this.referredHivProgram.uuid === Programs.PMTCT_PROGRAM.uuid
) {
} else if (
hivProgram.program.uuid === Programs.PMTCT_PROGRAM.uuid &&
this.referredHivProgram.uuid === Programs.STANDARD_HIV_PROGRAM.uuid
) {
referredToStandard = true;
} else if (
this.referredHivProgram.uuid === Programs.PNC_PROGRAM.uuid ||
this.referredHivProgram.uuid === Programs.ANC_PROGRAM.uuid
) {
} else {
return {
location: this.referredHivProgram.locationUuid,
Expand All @@ -224,6 +223,45 @@ export class HivReferralComponent implements OnInit, OnChanges, OnDestroy {
program: hivProgram.program.uuid
};
}

// if (
// hivProgram.program.uuid === Programs.STANDARD_HIV_PROGRAM.uuid &&
// this.referredHivProgram.uuid === Programs.ANC_PROGRAM.uuid
// ) {
// }
// if (
// hivProgram.program.uuid === Programs.STANDARD_HIV_PROGRAM.uuid &&
// this.referredHivProgram.uuid === Programs.PNC_PROGRAM.uuid
// ) {
// }
// if (
// hivProgram.program.uuid === Programs.PNC_PROGRAM.uuid &&
// this.referredHivProgram.uuid === Programs.ANC_PROGRAM.uuid
// ) {
// }
// if (
// hivProgram.program.uuid === Programs.ANC_PROGRAM.uuid &&
// this.referredHivProgram.uuid === Programs.PNC_PROGRAM.uuid
// ) {
// } else if (
// hivProgram.program.uuid === Programs.ANC_PROGRAM.uuid &&
// this.referredHivProgram.uuid === Programs.STANDARD_HIV_PROGRAM.uuid
// ) {
// referredToStandard = true;
// }
// else if (
// hivProgram.program.uuid === Programs.PNC_PROGRAM.uuid &&
// this.referredHivProgram.uuid === Programs.STANDARD_HIV_PROGRAM.uuid
// ) {
// referredToStandard = true;
// } else {
// return {
// location: this.referredHivProgram.locationUuid,
// patient: this.patient.uuid,
// dateEnrolled: moment().subtract(1, 'minutes').format(),
// program: hivProgram.program.uuid
// };
// }
}
);
// Add the referred program in payload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ export class HivReferralService {
let autoEnrollmentUuid = '';
if (programUuid === Programs.STANDARD_HIV_PROGRAM.uuid) {
autoEnrollmentUuid = this.STANDARD_HIV_AUTO_ENROLLMENT_ENCOUNTER;
} else if (programUuid === Programs.PMTCT_PROGRAM.uuid) {
} else if (
programUuid === Programs.ANC_PROGRAM.uuid ||
programUuid === Programs.PNC_PROGRAM.uuid
) {
autoEnrollmentUuid = this.PMTCT_AUTO_ENROLLMENT_ENCOUNTER;
}
return autoEnrollmentUuid;
Expand Down

0 comments on commit 929f1ad

Please sign in to comment.