Skip to content

Commit 2658ab9

Browse files
siddh1004sagarwal
andauthored
1 parent 5c15a5c commit 2658ab9

File tree

29 files changed

+7
-645
lines changed

29 files changed

+7
-645
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
### Changes
3535

3636
- Hide next button when registration is going
37+
- Remove hypertension and diabetes questions from medical history screen
3738

3839
## 2025.09.09
3940

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryEffect.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,4 @@ sealed class NewMedicalHistoryViewEffect : NewMedicalHistoryEffect()
1717

1818
data class OpenPatientSummaryScreen(val patientUuid: UUID) : NewMedicalHistoryViewEffect()
1919

20-
data object ShowOngoingHypertensionTreatmentError : NewMedicalHistoryViewEffect()
21-
22-
data object ShowDiagnosisRequiredError : NewMedicalHistoryViewEffect()
23-
24-
data object ShowHypertensionDiagnosisRequiredError : NewMedicalHistoryViewEffect()
25-
26-
data object ShowChangeDiagnosisErrorDialog : NewMedicalHistoryViewEffect()
27-
28-
data object ShowOngoingDiabetesTreatmentErrorDialog : NewMedicalHistoryViewEffect()
29-
3020
data object GoBack : NewMedicalHistoryViewEffect()

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryEvent.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ data class CurrentFacilityLoaded(val facility: Facility) : NewMedicalHistoryEven
2929

3030
data class SyncTriggered(val registeredPatientUuid: UUID) : NewMedicalHistoryEvent()
3131

32-
data object ChangeDiagnosisNotNowClicked : NewMedicalHistoryEvent() {
33-
override val analyticsName = "New Medical History:Change Diagnosis:Not Now Clicked"
34-
}
35-
3632
data object BackClicked : NewMedicalHistoryEvent() {
3733
override val analyticsName: String = "New Medical History:Back Clicked"
3834
}

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryModel.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ data class NewMedicalHistoryModel(
1919
val ongoingMedicalHistoryEntry: OngoingMedicalHistoryEntry,
2020
val currentFacility: Facility?,
2121
val nextButtonState: ButtonState?,
22-
val hasShownChangeDiagnosisError: Boolean,
2322
val showIsSmokingQuestion: Boolean,
2423
val showSmokelessTobaccoQuestion: Boolean,
2524
) : Parcelable {
@@ -36,12 +35,6 @@ data class NewMedicalHistoryModel(
3635
val facilityDiabetesManagementEnabled: Boolean
3736
get() = currentFacility!!.config.diabetesManagementEnabled
3837

39-
val hasAnsweredBothDiagnosisQuestions: Boolean
40-
get() = !(ongoingMedicalHistoryEntry.diagnosedWithHypertension == Unanswered || ongoingMedicalHistoryEntry.hasDiabetes == Unanswered)
41-
42-
val hasAnsweredHypertensionDiagnosis: Boolean
43-
get() = ongoingMedicalHistoryEntry.diagnosedWithHypertension != Unanswered
44-
4538
val registeringPatient: Boolean
4639
get() = nextButtonState == ButtonState.SAVING
4740

@@ -51,27 +44,12 @@ data class NewMedicalHistoryModel(
5144
val diagnosedWithDiabetes: Boolean
5245
get() = ongoingMedicalHistoryEntry.hasDiabetes == Yes
5346

54-
val answeredIsOnHypertensionTreatment: Boolean
55-
get() = ongoingMedicalHistoryEntry.isOnHypertensionTreatment != Unanswered
56-
57-
val answeredIsOnDiabetesTreatment: Boolean
58-
get() = ongoingMedicalHistoryEntry.isOnDiabetesTreatment != Unanswered
59-
6047
val showOngoingHypertensionTreatment: Boolean
6148
get() = diagnosedWithHypertension && (country.isoCountryCode == Country.INDIA || country.isoCountryCode == Country.SRI_LANKA)
6249

6350
val showOngoingDiabetesTreatment: Boolean
6451
get() = facilityDiabetesManagementEnabled && diagnosedWithDiabetes && country.isoCountryCode == Country.INDIA
6552

66-
private val hasNoHypertension: Boolean
67-
get() = ongoingMedicalHistoryEntry.diagnosedWithHypertension == No
68-
69-
private val hasNoDiabetes: Boolean
70-
get() = ongoingMedicalHistoryEntry.hasDiabetes == No
71-
72-
val showChangeDiagnosisError: Boolean
73-
get() = facilityDiabetesManagementEnabled && !hasShownChangeDiagnosisError && hasNoHypertension && hasNoDiabetes
74-
7553
companion object {
7654
fun default(
7755
country: Country,
@@ -83,7 +61,6 @@ data class NewMedicalHistoryModel(
8361
ongoingMedicalHistoryEntry = OngoingMedicalHistoryEntry(),
8462
currentFacility = null,
8563
nextButtonState = null,
86-
hasShownChangeDiagnosisError = false,
8764
showIsSmokingQuestion = showIsSmokingQuestion,
8865
showSmokelessTobaccoQuestion = showSmokelessTobaccoQuestion
8966
)
@@ -108,8 +85,4 @@ data class NewMedicalHistoryModel(
10885
fun patientRegistered(): NewMedicalHistoryModel {
10986
return copy(nextButtonState = ButtonState.SAVED)
11087
}
111-
112-
fun changeDiagnosisErrorShown(): NewMedicalHistoryModel {
113-
return copy(hasShownChangeDiagnosisError = true)
114-
}
11588
}

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryScreen.kt

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -100,41 +100,10 @@ class NewMedicalHistoryScreen : Fragment(), NewMedicalHistoryUiActions, HandlesB
100100
router.push(PatientSummaryScreenKey(patientUuid, OpenIntention.ViewNewPatient, Instant.now(utcClock)))
101101
}
102102

103-
override fun showOngoingHypertensionTreatmentErrorDialog() {
104-
SelectOngoingHypertensionTreatmentErrorDialog.show(fragmentManager = activity.supportFragmentManager)
105-
}
106-
107-
override fun showOngoingDiabetesTreatmentErrorDialog() {
108-
SelectOngoingDiabetesTreatmentErrorDialog.show(fragmentManager = activity.supportFragmentManager)
109-
}
110-
111103
override fun goBack() {
112104
router.pop()
113105
}
114106

115-
override fun showDiagnosisRequiredErrorDialog() {
116-
SelectDiagnosisErrorDialog.show(activity.supportFragmentManager)
117-
}
118-
119-
override fun showHypertensionDiagnosisRequiredErrorDialog() {
120-
MaterialAlertDialogBuilder(requireContext())
121-
.setTitle(getString(R.string.select_diagnosis_error_diagnosis_required))
122-
.setMessage(getString(R.string.select_diagnosis_error_enter_diagnosis_hypertension))
123-
.setPositiveButton(getString(R.string.select_diagnosis_error_ok), null)
124-
.show()
125-
}
126-
127-
override fun showChangeDiagnosisErrorDialog() {
128-
MaterialAlertDialogBuilder(requireContext())
129-
.setTitle(getString(R.string.change_diagnosis_title))
130-
.setMessage(getString(R.string.change_diagnosis_message))
131-
.setPositiveButton(getString(R.string.change_diagnosis_positive), null)
132-
.setNegativeButton(getString(R.string.change_diagnosis_negative)) { _, _ ->
133-
viewModel.dispatch(ChangeDiagnosisNotNowClicked)
134-
}
135-
.show()
136-
}
137-
138107
override fun onBackPressed(): Boolean {
139108
viewModel.dispatch(BackClicked)
140109
return true

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryUiActions.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@ import java.util.UUID
44

55
interface NewMedicalHistoryUiActions {
66
fun openPatientSummaryScreen(patientUuid: UUID)
7-
fun showOngoingHypertensionTreatmentErrorDialog()
8-
fun showDiagnosisRequiredErrorDialog()
9-
fun showHypertensionDiagnosisRequiredErrorDialog()
10-
fun showChangeDiagnosisErrorDialog()
11-
fun showOngoingDiabetesTreatmentErrorDialog()
12-
137
fun goBack()
148
}

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryUpdate.kt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,15 @@ class NewMedicalHistoryUpdate : Update<NewMedicalHistoryModel, NewMedicalHistory
1616
): Next<NewMedicalHistoryModel, NewMedicalHistoryEffect> {
1717
return when (event) {
1818
is NewMedicalHistoryAnswerToggled -> answerToggled(model, event.question, event.answer)
19-
is SaveMedicalHistoryClicked -> saveClicked(model)
19+
is SaveMedicalHistoryClicked -> registerPatient(model)
2020
is PatientRegistered -> next(model.patientRegistered(), TriggerSync(event.patientUuid))
2121
is OngoingPatientEntryLoaded -> next(model.ongoingPatientEntryLoaded(event.ongoingNewPatientEntry))
2222
is CurrentFacilityLoaded -> currentFacilityLoaded(event, model)
2323
is SyncTriggered -> dispatch(OpenPatientSummaryScreen(event.registeredPatientUuid))
24-
is ChangeDiagnosisNotNowClicked -> registerPatient(model)
2524
is BackClicked -> dispatch(GoBack)
2625
}
2726
}
2827

29-
private fun saveClicked(model: NewMedicalHistoryModel): Next<NewMedicalHistoryModel, NewMedicalHistoryEffect> {
30-
return when {
31-
model.showChangeDiagnosisError -> {
32-
next(model.changeDiagnosisErrorShown(), ShowChangeDiagnosisErrorDialog)
33-
}
34-
model.facilityDiabetesManagementEnabled && !model.hasAnsweredBothDiagnosisQuestions -> {
35-
dispatch(ShowDiagnosisRequiredError)
36-
}
37-
!model.facilityDiabetesManagementEnabled && !model.hasAnsweredHypertensionDiagnosis -> {
38-
dispatch(ShowHypertensionDiagnosisRequiredError)
39-
}
40-
model.showOngoingHypertensionTreatment && !model.answeredIsOnHypertensionTreatment -> {
41-
dispatch(ShowOngoingHypertensionTreatmentError)
42-
}
43-
model.showOngoingDiabetesTreatment && !model.answeredIsOnDiabetesTreatment -> {
44-
dispatch(ShowOngoingDiabetesTreatmentErrorDialog)
45-
}
46-
else -> registerPatient(model)
47-
}
48-
}
49-
5028
private fun registerPatient(model: NewMedicalHistoryModel): Next<NewMedicalHistoryModel, NewMedicalHistoryEffect> {
5129
return if (model.registeringPatient) {
5230
noChange()

app/src/main/java/org/simple/clinic/medicalhistory/newentry/NewMedicalHistoryViewEffectHandler.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ class NewMedicalHistoryViewEffectHandler(
1010
override fun handle(viewEffect: NewMedicalHistoryViewEffect) {
1111
when (viewEffect) {
1212
is OpenPatientSummaryScreen -> uiActions.openPatientSummaryScreen(viewEffect.patientUuid)
13-
ShowOngoingHypertensionTreatmentError -> uiActions.showOngoingHypertensionTreatmentErrorDialog()
14-
ShowDiagnosisRequiredError -> uiActions.showDiagnosisRequiredErrorDialog()
15-
ShowHypertensionDiagnosisRequiredError -> uiActions.showHypertensionDiagnosisRequiredErrorDialog()
16-
ShowChangeDiagnosisErrorDialog -> uiActions.showChangeDiagnosisErrorDialog()
17-
ShowOngoingDiabetesTreatmentErrorDialog -> uiActions.showOngoingDiabetesTreatmentErrorDialog()
1813
GoBack -> uiActions.goBack()
1914
}.exhaustive()
2015
}

app/src/main/java/org/simple/clinic/medicalhistory/ui/MedicalHistoryDiagnosisWithTreatment.kt

Lines changed: 0 additions & 122 deletions
This file was deleted.

app/src/main/java/org/simple/clinic/medicalhistory/ui/NewMedicalHistoryUi.kt

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ import org.simple.clinic.common.ui.components.TopAppBar
2727
import org.simple.clinic.common.ui.theme.SimpleTheme
2828
import org.simple.clinic.medicalhistory.Answer
2929
import org.simple.clinic.medicalhistory.MedicalHistoryQuestion
30-
import org.simple.clinic.medicalhistory.MedicalHistoryQuestion.DiagnosedWithDiabetes
31-
import org.simple.clinic.medicalhistory.MedicalHistoryQuestion.DiagnosedWithHypertension
32-
import org.simple.clinic.medicalhistory.MedicalHistoryQuestion.IsOnDiabetesTreatment
33-
import org.simple.clinic.medicalhistory.MedicalHistoryQuestion.IsOnHypertensionTreatment
3430
import org.simple.clinic.medicalhistory.OngoingMedicalHistoryEntry
3531
import org.simple.clinic.medicalhistory.newentry.NewMedicalHistoryModel
3632

@@ -80,33 +76,13 @@ fun NewMedicalHistoryUi(
8076
val scrollState = rememberScrollState()
8177
Column(
8278
modifier = Modifier
83-
.fillMaxWidth()
84-
.verticalScroll(scrollState)
85-
.padding(paddingValues)
86-
.padding(dimensionResource(R.dimen.spacing_8)),
79+
.fillMaxWidth()
80+
.verticalScroll(scrollState)
81+
.padding(paddingValues)
82+
.padding(dimensionResource(R.dimen.spacing_8)),
8783
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.spacing_8))
8884
) {
8985
val showDiabetesDiagnosis = model.hasLoadedCurrentFacility && model.facilityDiabetesManagementEnabled
90-
MedicalHistoryDiagnosisWithTreatment(
91-
diagnosisLabel = stringResource(R.string.medicalhistory_diagnosis_hypertension_required),
92-
diagnosisQuestion = DiagnosedWithHypertension,
93-
diagnosisAnswer = model.ongoingMedicalHistoryEntry.diagnosedWithHypertension,
94-
treatmentQuestion = IsOnHypertensionTreatment(model.country.isoCountryCode),
95-
treatmentAnswer = model.ongoingMedicalHistoryEntry.isOnHypertensionTreatment,
96-
showTreatmentQuestion = model.showOngoingHypertensionTreatment,
97-
onSelectionChange = onSelectionChange
98-
)
99-
if (showDiabetesDiagnosis) {
100-
MedicalHistoryDiagnosisWithTreatment(
101-
diagnosisLabel = stringResource(R.string.medicalhistory_diagnosis_diabetes_required),
102-
diagnosisQuestion = DiagnosedWithDiabetes,
103-
diagnosisAnswer = model.ongoingMedicalHistoryEntry.hasDiabetes,
104-
treatmentQuestion = IsOnDiabetesTreatment,
105-
treatmentAnswer = model.ongoingMedicalHistoryEntry.isOnDiabetesTreatment,
106-
showTreatmentQuestion = model.showOngoingDiabetesTreatment,
107-
onSelectionChange = onSelectionChange
108-
)
109-
}
11086
HistoryContainer(
11187
heartAttackAnswer = model.ongoingMedicalHistoryEntry.hasHadHeartAttack,
11288
strokeAnswer = model.ongoingMedicalHistoryEntry.hasHadStroke,
@@ -139,7 +115,6 @@ private val previewMedicalHistoryModel = NewMedicalHistoryModel(
139115
ongoingMedicalHistoryEntry = OngoingMedicalHistoryEntry(),
140116
currentFacility = null,
141117
nextButtonState = null,
142-
hasShownChangeDiagnosisError = true,
143118
showIsSmokingQuestion = true,
144119
showSmokelessTobaccoQuestion = true
145120
)
@@ -151,7 +126,7 @@ private fun NewMedicalHistoryUiPreview() {
151126
model = previewMedicalHistoryModel,
152127
navigationIconClick = {},
153128
onNextClick = {}
154-
) { question, answer ->
129+
) { _, _ ->
155130
//do nothing
156131
}
157132
}

0 commit comments

Comments
 (0)