From d8cab96371283e17e90849e8446b515092ca1790 Mon Sep 17 00:00:00 2001 From: Alfred Mutai <124869802+Alfred-Mutai@users.noreply.github.com> Date: Tue, 28 May 2024 17:04:42 +0300 Subject: [PATCH] =?UTF-8?q?POC-730:=20Internal=20movement=20form,=20add=20?= =?UTF-8?q?Patient=20type=20with=20options=20Antena=E2=80=A6=20(#1740)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * POC-730: Internal movement form, add Patient type with options Antenatal and Postnatal care programs under PMTCT program and validate * POC-730: Internal movement form, add Patient type with options Antenatal and Postnatal care programs under PMTCT program and validate --- src/app/constants/program.constants.ts | 16 ++++++++++++++- .../constants/referral-concepts.contants.ts | 6 +++++- src/app/interfaces/return-value.interface.ts | 1 + .../formentry-referrals-handler.service.ts | 20 +++++++++++++++---- .../hiv-referrals/hiv-referral.component.ts | 9 ++++----- .../hiv-referrals/hiv-referral.service.ts | 5 ++++- 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/app/constants/program.constants.ts b/src/app/constants/program.constants.ts index 3dee969d2..32931f6a8 100644 --- a/src/app/constants/program.constants.ts +++ b/src/app/constants/program.constants.ts @@ -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', @@ -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 }; diff --git a/src/app/constants/referral-concepts.contants.ts b/src/app/constants/referral-concepts.contants.ts index d36c21306..1f9062369 100644 --- a/src/app/constants/referral-concepts.contants.ts +++ b/src/app/constants/referral-concepts.contants.ts @@ -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, @@ -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 }; diff --git a/src/app/interfaces/return-value.interface.ts b/src/app/interfaces/return-value.interface.ts index c4c7381dc..c985522df 100644 --- a/src/app/interfaces/return-value.interface.ts +++ b/src/app/interfaces/return-value.interface.ts @@ -16,4 +16,5 @@ export interface ReturnValue { providerUuid: string; locationUuid: string; hivReferralLocationUuid: string; + pmtctProgrammeUuid: string; } diff --git a/src/app/patient-dashboard/common/formentry/formentry-referrals-handler.service.ts b/src/app/patient-dashboard/common/formentry/formentry-referrals-handler.service.ts index b01362f96..25e9b525c 100644 --- a/src/app/patient-dashboard/common/formentry/formentry-referrals-handler.service.ts +++ b/src/app/patient-dashboard/common/formentry/formentry-referrals-handler.service.ts @@ -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( @@ -217,7 +218,8 @@ export class FormentryReferralsHandlerService { encounterDatetime: null, providerUuid: '', locationUuid: '', - hivReferralLocationUuid: '' + hivReferralLocationUuid: '', + pmtctProgrammeUuid: '' }; const formUuid = form.schema.uuid ? form.schema.uuid : ''; @@ -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 @@ -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 @@ -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; diff --git a/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.component.ts b/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.component.ts index 25b823e9a..68507b90b 100644 --- a/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.component.ts +++ b/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.component.ts @@ -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, diff --git a/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.service.ts b/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.service.ts index 15684f514..f7b60ab98 100644 --- a/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.service.ts +++ b/src/app/patient-dashboard/common/patient-referrals/hiv-referrals/hiv-referral.service.ts @@ -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;