diff --git a/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayService.java b/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayService.java index 5e21bfd896..5c497a4a49 100644 --- a/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayService.java +++ b/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayService.java @@ -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); } diff --git a/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java b/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java index 21f0582d86..4c862d7a21 100644 --- a/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java +++ b/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java @@ -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; + } } diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientCytologyReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientCytologyReport.java index 0b55c75348..7d440b03e1 100644 --- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientCytologyReport.java +++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientCytologyReport.java @@ -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 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 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(); } diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientPathologyReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientPathologyReport.java index 7dbf44f298..52f3791d08 100644 --- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientPathologyReport.java +++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientPathologyReport.java @@ -33,8 +33,7 @@ protected void setAdditionalReportItems() { List 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 diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/reportBeans/ProgramSampleReportData.java b/src/main/java/org/openelisglobal/reports/action/implementation/reportBeans/ProgramSampleReportData.java index f7e3fefae9..87efa26129 100644 --- a/src/main/java/org/openelisglobal/reports/action/implementation/reportBeans/ProgramSampleReportData.java +++ b/src/main/java/org/openelisglobal/reports/action/implementation/reportBeans/ProgramSampleReportData.java @@ -101,7 +101,7 @@ public final class ProgramSampleReportData { private String microExam; - private String codedConclusion; + private List codedConclusion; private String textConclusion; @@ -571,11 +571,11 @@ public void setMicroExam(String microExam) { this.microExam = microExam; } - public String getCodedConclusion() { + public List getCodedConclusion() { return codedConclusion; } - public void setCodedConclusion(String codedConclusion) { + public void setCodedConclusion(List codedConclusion) { this.codedConclusion = codedConclusion; } diff --git a/src/main/resources/languages/message_en.properties b/src/main/resources/languages/message_en.properties index af9b307438..dd6f7c5ab5 100644 --- a/src/main/resources/languages/message_en.properties +++ b/src/main/resources/languages/message_en.properties @@ -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 + diff --git a/src/main/resources/languages/message_fr.properties b/src/main/resources/languages/message_fr.properties index e3c98f716b..f07be22a43 100644 --- a/src/main/resources/languages/message_fr.properties +++ b/src/main/resources/languages/message_fr.properties @@ -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 @@ -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 diff --git a/src/main/resources/reports/PatientCytologyReport.jasper b/src/main/resources/reports/PatientCytologyReport.jasper index 9afc24c68b..36557f1036 100644 Binary files a/src/main/resources/reports/PatientCytologyReport.jasper and b/src/main/resources/reports/PatientCytologyReport.jasper differ diff --git a/src/main/resources/reports/PatientCytologyReport.jrxml b/src/main/resources/reports/PatientCytologyReport.jrxml index 3a5e8d5ac1..2026f09ca5 100644 --- a/src/main/resources/reports/PatientCytologyReport.jrxml +++ b/src/main/resources/reports/PatientCytologyReport.jrxml @@ -6,9 +6,9 @@ - + @@ -68,10 +68,6 @@ - @@ -847,7 +843,7 @@ - + @@ -856,116 +852,161 @@ + + + + + + - + + + + + + + - " + $R{cytology.label.specimen} + ""]]> + - + - + + + + + + + - " + $R{cytology.label.diagnosis} + ""]]> + - + - + + + + + + + - " + $R{cytology.label.neoplastic} + ""]]> + - - + + - "• " + s).collect(java.util.stream.Collectors.joining("\n"))]]> + "• " + s).collect(java.util.stream.Collectors.joining(" "))]]> - + + + + + + + - " + $R{cytology.label.reactive}+ ""]]> + - - + + - "• " + s).collect(java.util.stream.Collectors.joining("\n"))]]> + "• " + s).collect(java.util.stream.Collectors.joining(" "))]]> - - + + + + + + + - " + $R{cytology.label.organisms}+ ""]]> + - - + + - "• " + s).collect(java.util.stream.Collectors.joining("\n"))]]> + "• " + s).collect(java.util.stream.Collectors.joining(" "))]]> - - + + + + + + + - " + $R{cytology.label.cellabnomality}+ ""]]> + - - + + - "• " + s).collect(java.util.stream.Collectors.joining("\n"))]]> + "• " + s).collect(java.util.stream.Collectors.joining(" "))]]> - - + + + + + + + - " + $R{cytology.label.otherResult}+ ""]]> + - - + + - "• " + s).collect(java.util.stream.Collectors.joining("\n"))]]> + "• " + s).collect(java.util.stream.Collectors.joining(" "))]]> - + diff --git a/src/main/resources/reports/PatientPathologyReport.jasper b/src/main/resources/reports/PatientPathologyReport.jasper index b8e357eaff..c3898fa545 100644 Binary files a/src/main/resources/reports/PatientPathologyReport.jasper and b/src/main/resources/reports/PatientPathologyReport.jasper differ diff --git a/src/main/resources/reports/PatientPathologyReport.jrxml b/src/main/resources/reports/PatientPathologyReport.jrxml index 24a811027a..fce3d4dab9 100644 --- a/src/main/resources/reports/PatientPathologyReport.jrxml +++ b/src/main/resources/reports/PatientPathologyReport.jrxml @@ -70,7 +70,7 @@ - + @@ -848,58 +848,89 @@ - + + + + + + + - + + + + + + + - " + $R{pathology.label.grossexam} + ""]]> + - + - + + + + + + + - " + $R{pathology.label.microexam} + ""]]> + - + - + + + + + + + - " + $R{pathology.label.conclusion} + ""]]> + - - + + + - + "• " + s).collect(java.util.stream.Collectors.joining(" "))]]> - + + + + + + + - " + $R{pathology.label.textconclusion}+ ""]]> + - +