Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patient report should only return validated tests with onlyresults #1280

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@
public class PatientCILNSPClinical_vreduit extends PatientReport implements IReportCreator, IReportParameterSetter {

private static Set<Integer> analysisStatusIds;
private static Set<Integer> validatedAnalysisStatusIds;
protected List<ClinicalPatientData> clinicalReportItems;
private ImageService imageService = SpringContext.getBean(ImageService.class);
private SiteInformationService siteInformationService = SpringContext.getBean(SiteInformationService.class);

static {
analysisStatusIds = new HashSet<>();
validatedAnalysisStatusIds = new HashSet<>();
analysisStatusIds.add(Integer
.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.BiologistRejected)));
analysisStatusIds.add(
Expand All @@ -71,6 +73,8 @@ public class PatientCILNSPClinical_vreduit extends PatientReport implements IRep
Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Canceled)));
analysisStatusIds.add(Integer
.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalRejected)));
validatedAnalysisStatusIds.add(
Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Finalized)));
}

static final String configName = ConfigurationProperties.getInstance().getPropertyValue(Property.configurationName);
Expand Down Expand Up @@ -125,6 +129,10 @@ protected void createReportItems() {
boolean isConfirmationSample = sampleService.isConfirmationSample(currentSample);
List<Analysis> analysisList = analysisService
.getAnalysesBySampleIdAndStatusId(sampleService.getId(currentSample), analysisStatusIds);
if (onlyResultsForReportBySite) {
analysisList = analysisService.getAnalysesBySampleIdAndStatusId(sampleService.getId(currentSample),
validatedAnalysisStatusIds);
}

List<Analysis> filteredAnalysisList = userService.filterAnalysesByLabUnitRoles(systemUserId, analysisList,
Constants.ROLE_REPORTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public abstract class PatientReport extends Report {
protected String completionDate;
protected Sample currentSample;
protected Patient currentPatient;
protected Boolean onlyResultsForReportBySite = false;

protected static final NoteType[] FILTER = { NoteType.EXTERNAL, NoteType.REJECTION_REASON,
NoteType.NON_CONFORMITY };
Expand Down Expand Up @@ -249,6 +250,7 @@ public void initializeReport(ReportForm form) {
}
if (!GenericValidator.isBlankOrNull(form.getUpperDateRange())
&& !GenericValidator.isBlankOrNull(form.getLowerDateRange())) {
onlyResultsForReportBySite = form.isOnlyResults();
reportSampleList = findReportSamplesForSite(form.getReferringSiteId(),
form.getReferringSiteDepartmentId(), form.isOnlyResults(), form.getDateType(),
form.getLowerDateRange(), form.getUpperDateRange());
Expand Down Expand Up @@ -315,14 +317,6 @@ private List<Sample> findReportSamplesForSite(String referringSiteId, String ref
Set<Integer> analysisStatusIds = new HashSet<>();
analysisStatusIds.add(Integer
.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Finalized)));
/**
* analysisStatusIds.add(Integer.parseInt(
* SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.BiologistRejected)));
* analysisStatusIds.add(Integer.parseInt(
* SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalAcceptance)));
* analysisStatusIds.add(Integer.parseInt(
* SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalRejected)));
**/
sampleList = sampleList.stream().filter(
e -> (analysisService.getAnalysesBySampleIdAndStatusId(e.getId(), analysisStatusIds).size() > 0))
.collect(Collectors.toList());
Expand Down
Loading