Skip to content

Commit

Permalink
add Generate Pathology report
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 committed Oct 18, 2023
1 parent 2f75005 commit 927d2c1
Show file tree
Hide file tree
Showing 15 changed files with 2,148 additions and 5 deletions.
20 changes: 18 additions & 2 deletions frontend/src/components/pathology/PathologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ function PathologyCaseView() {
}}
/>
</Column>
<Column lg={4}>
<Column lg={2}>
<FormattedMessage id="pathology.label.report" />
</Column>
<Column lg={2} md={1} sm={2}>
Expand All @@ -546,7 +546,23 @@ function PathologyCaseView() {
</>
)}
</Column>
<Column lg={3} md={5} sm={3} />
<Column lg={1} md={2} sm={2}/>
<Column lg={3} md={2} sm={2}>
<Button
onClick={(e) => {
window.open(
config.serverBaseUrl +
"/rest/ReportPrint?report=PatientPathologyReport&programSampleId=" +
pathologySampleId,
"_blank",
);
}}
>
{" "}
<FormattedMessage id="button.label.genarateReport" />
</Button>
</Column>
<Column lg={3} md={2} sm={2}/>
<Column lg={16} md={8} sm={4}>
<div> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</Column>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
"label.button.remove.report": "Remove Report",
"pathology.label.block.number": "Block number",
"pathology.label.block.add.number": "Number of Blocks to add",
"pathology.label.slide.add.number": "Number of Slides to add"
"pathology.label.slide.add.number": "Number of Slides to add",
"button.label.genarateReport" : "Generate Report"

}
3 changes: 2 additions & 1 deletion frontend/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,6 @@
"label.button.remove.slide": "Supprimer la Diapositive",
"label.button.remove.block": "Supprimer le Bloc",
"label.button.remove.report": "Supprimer le Rapport",
"pathology.label.block.number": "Numéro du Bloc"
"pathology.label.block.number": "Numéro du Bloc" ,
"button.label.genarateReport" : "Générer un rapport"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import org.openelisglobal.program.valueholder.pathology.PathologyCaseViewDisplayItem;
import org.openelisglobal.program.valueholder.pathology.PathologyDisplayItem;
import org.openelisglobal.program.valueholder.pathology.PathologySample;

public interface PathologyDisplayService {

PathologyCaseViewDisplayItem convertToCaseDisplayItem(Integer pathologySampleId);

PathologyDisplayItem convertToDisplayItem(Integer pathologySampleId);

PathologySample getPathologySampleWithLoadedAtttributes(Integer pathologySampleId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,14 @@ public PathologyCaseViewDisplayItem convertToCaseDisplayItem(Integer pathologySa
return displayItem;
}

@Override
@Transactional
public PathologySample getPathologySampleWithLoadedAtttributes(Integer pathologySampleId) {
PathologySample pathologySample = pathologySampleService.get(pathologySampleId);
pathologySample.getBlocks().size();
pathologySample.getSlides().size();
pathologySample.getConclusions().size();
return pathologySample;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.openelisglobal.reports.action.implementation;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import org.openelisglobal.program.service.PathologyDisplayService;
import org.openelisglobal.program.valueholder.pathology.PathologyConclusion;
import org.openelisglobal.program.valueholder.pathology.PathologyConclusion.ConclusionType;
import org.openelisglobal.program.valueholder.pathology.PathologySample;
import org.openelisglobal.reports.form.ReportForm;
import org.openelisglobal.spring.util.SpringContext;

public class PatientPathologyReport extends PatientProgramReport{
protected PathologyDisplayService pathologyDisplayService = SpringContext.getBean(PathologyDisplayService.class);

private PathologySample pathologySample;

@Override
protected String getReportName() {
return "PatientPathologyReport";
}

@Override
protected void setAdditionalReportItems() {
data.setGrossExam(pathologySample.getGrossExam());
data.setMicroExam(pathologySample.getMicroscopyExam());
pathologySample.getConclusions().size();
Optional<PathologyConclusion> conclusion = pathologySample.getConclusions().stream()
.filter(e -> e.getType() == ConclusionType.TEXT).findFirst();
data.setTextConclusion(conclusion.get().getValue());

List<String> codedConclusions = pathologySample.getConclusions().stream().filter(e -> e.getType() == ConclusionType.DICTIONARY)
.map(e -> dictionaryService.get(e.getValue()).getLocalizedName())
.collect(Collectors.toList());
String commaSeparatedString = String.join(", ", codedConclusions);
data.setCodedConclusion(commaSeparatedString);
}

@Override
protected void innitializeSample(ReportForm form) {
pathologySample = pathologyDisplayService.getPathologySampleWithLoadedAtttributes(Integer.valueOf(form.getProgramSampleId()));
sample = pathologySample.getSample();
}

}
Loading

0 comments on commit 927d2c1

Please sign in to comment.