Skip to content

Commit 266efbf

Browse files
To fetch patient document attachment in diagnostic report
1 parent 3291916 commit 266efbf

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

api/src/main/java/org/bahmni/module/hip/api/dao/impl/OPConsultDaoImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ public List<Obs> getMedicalHistoryDiagnosisForProgram(String programName, Date f
213213
}
214214

215215
public Map<Encounter, List<Obs>> getPatientDocumentsForVisit(Visit visit){
216-
List<Obs> patientObs = encounterDao.GetAllObsForVisit(visit, Config.PATIENT_DOCUMENT.getValue(), Config.DOCUMENT_TYPE.getValue());
216+
List<Obs> patientObs = encounterDao.GetAllObsForVisit(visit, Config.PATIENT_DOCUMENT.getValue(),null)
217+
.stream().filter(o -> !o.getConcept().getName().getName().equals(Config.DOCUMENT_TYPE.getValue()) ).collect(Collectors.toList());
217218
patientObs.addAll(encounterDao.GetAllObsForVisit(visit, Config.CONSULTATION.getValue(), Config.IMAGE.getValue()));
218219
patientObs.addAll(encounterDao.GetAllObsForVisit(visit, Config.CONSULTATION.getValue(), Config.PATIENT_VIDEO.getValue()));
219220
HashMap<Encounter, List<Obs>> encounterListMap = new HashMap<>();

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,13 @@ private List<Attachment> getAttachments(Obs obs) throws IOException {
185185
List<Attachment> attachments = new ArrayList<>();
186186
Attachment attachment = new Attachment();
187187
StringBuilder valueText = new StringBuilder();
188+
Set<Obs> obsList = obs.getGroupMembers();
188189
StringBuilder contentType = new StringBuilder();
189-
if(obs.getConcept().getName().getName().equals(Config.DOCUMENT_TYPE.getValue())){
190-
valueText.append(obs.getValueText());
191-
contentType.append(FHIRUtils.getTypeOfTheObsDocument(obs.getValueText()));
190+
for(Obs obs1 : obsList) {
191+
if (obs1.getConcept().getName().getName().equals(Config.DOCUMENT_TYPE.getValue())) {
192+
valueText.append(obs1.getValueText());
193+
contentType.append(FHIRUtils.getTypeOfTheObsDocument(obs1.getValueText()));
194+
}
192195
}
193196
if(obs.getConcept().getName().getName().equals(Config.IMAGE.getValue()) || obs.getConcept().getName().getName().equals(Config.PATIENT_VIDEO.getValue())){
194197
valueText.append(obs.getValueComplex());

0 commit comments

Comments
 (0)