diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/patient/profile/PatientProfileViewModel.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/patient/profile/PatientProfileViewModel.kt index 2fa72a935f..8fbaf89da0 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/patient/profile/PatientProfileViewModel.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/patient/profile/PatientProfileViewModel.kt @@ -106,7 +106,9 @@ constructor( Pair( R.id.add_to_family_planning, profileData?.let { - !(it.tasks.none { it.action.matches(Regex(ACTIVE_ANC_REGEX)) } && (it.dob?.yearsPassed() in 15..48)) + !(it.tasks.none { it.action.matches(Regex(ACTIVE_ANC_REGEX)) } && + it.conditions.none { it.code.text.equals("Family Planning") } && + (it.dob?.yearsPassed() in 15..48)) } ?: false ) diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/shared/models/PatientProfileViewData.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/shared/models/PatientProfileViewData.kt index 26cc46b922..2f21996b92 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/shared/models/PatientProfileViewData.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/shared/models/PatientProfileViewData.kt @@ -19,6 +19,7 @@ package org.smartregister.fhircore.quest.ui.shared.models import java.util.Date import org.smartregister.fhircore.engine.domain.model.ActionableButtonData import org.smartregister.fhircore.quest.ui.family.profile.model.FamilyMemberViewState +import org.hl7.fhir.r4.model.Condition sealed class ProfileViewData( open val logicalId: String = "", @@ -39,6 +40,7 @@ sealed class ProfileViewData( val medicalHistoryData: List = emptyList(), val upcomingServices: List = emptyList(), val ancCardData: List = emptyList(), + val conditions: List = listOf(), ) : ProfileViewData(name = name, logicalId = logicalId, identifier = identifier) data class FamilyProfileViewData( diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/util/mappers/ProfileViewDataMapper.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/util/mappers/ProfileViewDataMapper.kt index 8ca38be7dc..0b8fb631cf 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/util/mappers/ProfileViewDataMapper.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/util/mappers/ProfileViewDataMapper.kt @@ -82,6 +82,7 @@ class ProfileViewDataMapper @Inject constructor(@ApplicationContext val context: age = inputModel.age, sex = inputModel.gender.translateGender(context), dob = inputModel.birthdate, + conditions = inputModel.conditions, tasks = inputModel.tasks.take(DEFAULT_TASKS_COUNT).map { ActionableButtonData(