Skip to content

Commit 0f732ee

Browse files
Merge pull request #86 from BahmniIndiaDistro/BAH-2433-fix
BAH-2433 | Fix. display custom message for chief complaint data
2 parents b2b5dd9 + 19ef139 commit 0f732ee

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

api/src/main/java/org/bahmni/module/hip/Config.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public enum Config {
3232
IMAGE("Image"),
3333
PATIENT_VIDEO("Patient Video"),
3434
CONCEPT_DETAILS_CONCEPT_CLASS("Concept Details"),
35+
CHIEF_COMPLAINT_CODED("Chief Complaint Coded"),
36+
SIGN_SYMPTOM_DURATION("Sign/symptom duration"),
37+
CHIEF_COMPLAINT_DURATION("Chief Complaint Duration"),
3538

3639
//Physical_Examination_Ignoring_Form_List
3740
Forms_To_Ignore_In_Physical_Examination("Discharge Summary, Death Note, Delivery Note, Opioid Substitution Therapy - Intake, Opportunistic Infection, " +

omod/src/main/java/org/bahmni/module/hip/web/service/FHIRResourceMapper.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.hl7.fhir.r4.model.Enumerations;
2525
import org.hl7.fhir.r4.model.Annotation;
2626
import org.hl7.fhir.r4.model.MarkdownType;
27+
import org.hl7.fhir.r4.model.StringType;
2728

2829
import org.openmrs.DrugOrder;
2930
import org.openmrs.EncounterProvider;
@@ -230,12 +231,10 @@ public Condition mapToCondition(OpenMrsCondition openMrsCondition, Patient patie
230231
public Observation mapToObs(Obs obs) {
231232
Concept concept = initializeEntityAndUnproxy(obs.getConcept());
232233
obs.setConcept(concept);
234+
Observation observation = observationTranslator.toFhirResource(obs);
233235
if (obs.getGroupMembers().size() > 0 && Config.CONCEPT_DETAILS_CONCEPT_CLASS.getValue().equals(obs.getConcept().getConceptClass().getName()) && obs.getFormFieldNamespace() != null) {
234-
Obs[] groupMembersArray = new Obs[obs.getGroupMembers().size()];
235-
groupMembersArray = obs.getGroupMembers().toArray(groupMembersArray);
236-
obs.setValueText(groupMembersArray[0].getValueCoded().getDisplayString() + " " + "since" + " " + groupMembersArray[2].getValueNumeric() + " " + groupMembersArray[1].getValueCoded().getDisplayString());
236+
observation.setValue(new StringType(getCustomDisplayStringForChiefComplaint(obs.getGroupMembers())));
237237
}
238-
Observation observation = observationTranslator.toFhirResource(obs);
239238
observation.addNote(new Annotation(new MarkdownType(obs.getComment())));
240239
return observation;
241240
}
@@ -298,4 +297,17 @@ public static <T> T initializeEntityAndUnproxy(T entity) {
298297
}
299298
return entity;
300299
}
300+
301+
public String getCustomDisplayStringForChiefComplaint(Set<Obs> groupMembers) {
302+
String chiefComplaintCoded = null, signOrSymptomDuration = null, chiefComplaintDuration = null;
303+
for (Obs childObs : groupMembers) {
304+
if(childObs.getConcept().getName().getName().equals(Config.CHIEF_COMPLAINT_CODED.getValue()))
305+
chiefComplaintCoded = childObs.getValueCoded().getDisplayString();
306+
if(childObs.getConcept().getName().getName().equals(Config.SIGN_SYMPTOM_DURATION.getValue()))
307+
signOrSymptomDuration = childObs.getValueNumeric().toString();
308+
if(childObs.getConcept().getName().getName().equals(Config.CHIEF_COMPLAINT_DURATION.getValue()))
309+
chiefComplaintDuration = childObs.getValueCoded().getDisplayString();
310+
}
311+
return (chiefComplaintCoded + " " + "since" + " " + signOrSymptomDuration + " " + chiefComplaintDuration);
312+
}
301313
}

0 commit comments

Comments
 (0)