Skip to content

Commit

Permalink
Merge pull request #570 from mozzy11/2.8
Browse files Browse the repository at this point in the history
improve cytology and pathology reports
  • Loading branch information
mozzy11 authored Oct 20, 2023
2 parents 0e7e5c5 + 5d1cc72 commit 5a31630
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import org.openelisglobal.program.valueholder.cytology.CytologyCaseViewDisplayItem;
import org.openelisglobal.program.valueholder.cytology.CytologyDisplayItem;
import org.openelisglobal.program.valueholder.cytology.CytologySample;

public interface CytologyDisplayService {

CytologyCaseViewDisplayItem convertToCaseDisplayItem(Integer cytologySampleId);

CytologyDisplayItem convertToDisplayItem(Integer cytologySampleId);

CytologySample getCytologySampleWithLoadedAttributes(Integer cytologySampleId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,13 @@ public CytologyDisplayItem convertToDisplayItem(Integer cytologySampleId) {
displayItem.setPathologySampleId(cytologySample.getId());
return displayItem;
}

@Override
@Transactional
public CytologySample getCytologySampleWithLoadedAttributes(Integer cytologySampleId) {
CytologySample cytologySample = cytologySampleService.get(cytologySampleId);
cytologySample.getDiagnosis().getDiagnosisResultsMaps().size();
return cytologySample;
}

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

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

import org.openelisglobal.program.service.cytology.CytologySampleService;
import org.apache.commons.lang3.StringUtils;
import org.openelisglobal.internationalization.MessageUtil;
import org.openelisglobal.program.service.cytology.CytologyDisplayService;
import org.openelisglobal.program.valueholder.cytology.CytologyDiagnosis;
import org.openelisglobal.program.valueholder.cytology.CytologyDiagnosis.CytologyDiagnosisResultType;
import org.openelisglobal.program.valueholder.cytology.CytologySample;
import org.openelisglobal.program.valueholder.cytology.CytologySpecimenAdequacy.SpecimenAdequancySatisfaction;
import org.openelisglobal.reports.form.ReportForm;
import org.openelisglobal.spring.util.SpringContext;

public class PatientCytologyReport extends PatientProgramReport {

protected CytologySampleService cytologySampleService = SpringContext.getBean(CytologySampleService.class);

protected CytologyDisplayService cytologySampleService = SpringContext.getBean(CytologyDisplayService.class);

private CytologySample cytologySample;

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

@Override
protected void setAdditionalReportItems() {
data.setSpecimenAdequacy("Dummy specimenn");
data.setDiagnosis("NEGATIVE DIAGNOSIS");

List<String> stringList = new ArrayList<>();
stringList.add("dummy diagnosis");
stringList.add("sample diagnosis");
stringList.add("example diagnosis");

data.setEpithelialCellAbnomalities(stringList);
data.setReactiveCellularChanges(stringList);
data.setOrganisms(stringList);
data.setOtherDiagnoses(stringList);
if (cytologySample.getSpecimenAdequacy() != null) {
data.setSpecimenAdequacy(cytologySample.getSpecimenAdequacy().getSatisfaction()
.equals(SpecimenAdequancySatisfaction.SATISFACTORY_FOR_EVALUATION)
? MessageUtil.getMessage("cytology.label.satisfactory")
: MessageUtil.getMessage("cytology.label.unsatisfactory"));

}
if (cytologySample.getDiagnosis() != null) {
if (cytologySample.getDiagnosis().getNegativeDiagnosis()) {
data.setDiagnosis(MessageUtil.getMessage("cytology.label.negative"));

} else {
CytologyDiagnosis cytoDiagnosis = cytologySample.getDiagnosis();
if (cytoDiagnosis.getDiagnosisResultsMaps() != null) {
cytoDiagnosis.getDiagnosisResultsMaps().forEach(diagnosisResult -> {
List<String> diagnoses = new ArrayList<>();

if (diagnosisResult.getResultType().equals(CytologyDiagnosisResultType.DICTIONARY)) {
diagnoses.addAll(diagnosisResult.getResults().stream().filter(e -> StringUtils.isNotBlank(e))
.map(e -> dictionaryService.get(e).getLocalizedName()).collect(Collectors.toList()));
} else {
diagnoses.add(diagnosisResult.getResults().get(0));
}
switch (diagnosisResult.getCategory()) {
case EPITHELIAL_CELL_ABNORMALITY: {
data.setEpithelialCellAbnomalities(diagnoses);
break;
}
case NON_NEOPLASTIC_CELLULAR_VARIATIONS: {
data.setNonNeoplasticCellularVariations(diagnoses);
break;
}
case ORGANISMS: {
data.setOrganisms(diagnoses);
break;
}
case REACTIVE_CELLULAR_CHANGES: {
data.setReactiveCellularChanges(diagnoses);
break;
}
case OTHER: {
data.setOtherDiagnoses(diagnoses);
break;
}
}
});
}

}

}

}

@Override
protected void innitializeSample(ReportForm form) {
cytologySample = cytologySampleService.get(Integer.valueOf(form.getProgramSampleId()));
cytologySample = cytologySampleService
.getCytologySampleWithLoadedAttributes(Integer.valueOf(form.getProgramSampleId()));
sample = cytologySample.getSample();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ protected void setAdditionalReportItems() {
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);
data.setCodedConclusion(codedConclusions);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public final class ProgramSampleReportData {

private String microExam;

private String codedConclusion;
private List<String> codedConclusion;

private String textConclusion;

Expand Down Expand Up @@ -571,11 +571,11 @@ public void setMicroExam(String microExam) {
this.microExam = microExam;
}

public String getCodedConclusion() {
public List<String> getCodedConclusion() {
return codedConclusion;
}

public void setCodedConclusion(String codedConclusion) {
public void setCodedConclusion(List<String> codedConclusion) {
this.codedConclusion = codedConclusion;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/languages/message_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7823,4 +7823,8 @@ cytology.label.organisms = Organisms
cytology.label.otherResult = Other Diagnosis Result
cytology.label.diagnosis = Diagnosis/Impression
cytology.label.papsmear = PAP SMEAR REPORT
cytology.label.negative = Negative For Intraepithelial Lesion or Malignancy
cytology.label.satisfactory = Satisfactory for evaluation
cytology.label.unsatisfactory = Unsatisfactory for evaluation


5 changes: 4 additions & 1 deletion src/main/resources/languages/message_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6770,7 +6770,7 @@ test.validation.total.percent = H\
matologie \
Totale %

test.antimicrobialResistance = Résistance aux antimicrobiens
test.antimicrobialResistance = R�sistance aux antimicrobiens

testSection.Biochemistry = Biochimie
testSection.EID = Virologie DNA PCR
Expand Down Expand Up @@ -7322,3 +7322,6 @@ cytology.label.organisms = Organismes
cytology.label.otherResult = Autre résultat de diagnostic
cytology.label.diagnosis = Diagnostic/Impression
cytology.label.papsmear = Rapport du frottis de PAP
cytology.label.negative=Négatif pour lésion intraépithéliale ou malignité
cytology.label.satisfactory=Satisfaisant pour l'évaluation
cytology.label.unsatisfactory=Insatisfaisant pour l'évaluation
Binary file modified src/main/resources/reports/PatientCytologyReport.jasper
Binary file not shown.
Loading

0 comments on commit 5a31630

Please sign in to comment.