|
24 | 24 | import org.hl7.fhir.r4.model.Enumerations; |
25 | 25 | import org.hl7.fhir.r4.model.Annotation; |
26 | 26 | import org.hl7.fhir.r4.model.MarkdownType; |
| 27 | +import org.hl7.fhir.r4.model.StringType; |
27 | 28 |
|
28 | 29 | import org.openmrs.DrugOrder; |
29 | 30 | import org.openmrs.EncounterProvider; |
@@ -230,12 +231,19 @@ public Condition mapToCondition(OpenMrsCondition openMrsCondition, Patient patie |
230 | 231 | public Observation mapToObs(Obs obs) { |
231 | 232 | Concept concept = initializeEntityAndUnproxy(obs.getConcept()); |
232 | 233 | obs.setConcept(concept); |
233 | | -// 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()); |
237 | | -// } |
238 | 234 | Observation observation = observationTranslator.toFhirResource(obs); |
| 235 | + if (obs.getGroupMembers().size() > 0 && Config.CONCEPT_DETAILS_CONCEPT_CLASS.getValue().equals(obs.getConcept().getConceptClass().getName()) && obs.getFormFieldNamespace() != null) { |
| 236 | + String chiefComplaintCoded = null, signOrSymptomDuration = null, chiefComplaintDuration = null; |
| 237 | + for (Obs childObs : obs.getGroupMembers()) { |
| 238 | + if(childObs.getConcept().getName().getName().equals(Config.CHIEF_COMPLAINT_CODED.getValue())) |
| 239 | + chiefComplaintCoded = childObs.getValueCoded().getDisplayString(); |
| 240 | + if(childObs.getConcept().getName().getName().equals(Config.SIGN_SYMPTOM_DURATION.getValue())) |
| 241 | + signOrSymptomDuration = childObs.getValueNumeric().toString(); |
| 242 | + if(childObs.getConcept().getName().getName().equals(Config.CHIEF_COMPLAINT_DURATION.getValue())) |
| 243 | + chiefComplaintDuration = childObs.getValueCoded().getDisplayString(); |
| 244 | + } |
| 245 | + observation.setValue(new StringType(chiefComplaintCoded + " " + "since" + " " + signOrSymptomDuration + " " + chiefComplaintDuration)); |
| 246 | + } |
239 | 247 | observation.addNote(new Annotation(new MarkdownType(obs.getComment()))); |
240 | 248 | return observation; |
241 | 249 | } |
|
0 commit comments