protected RejectionReportBean createIdentityRejectionBean( RejectionReportBean item, boolean blankCollectionDate) { RejectionReportBean filler = new RejectionReportBean(); filler.setAccessionNumber(item.getAccessionNumber()); filler.setReceivedDate(item.getReceivedDate()); filler.setCollectionDate(blankCollectionDate ? " " : item.getCollectionDate()); filler.setPatientOrTestName(item.getNonPrintingPatient()); return filler; }
protected RejectionReportBean createRejectionReportBean( String noteText, Analysis analysis, boolean useTestName) { RejectionReportBean item = new RejectionReportBean(); AnalysisService analysisService = new AnalysisService(analysis); SampleService sampleService = new SampleService(analysisService.getAnalysis().getSampleItem().getSample()); PatientService patientService = new PatientService(sampleService.getSample()); List<Result> results = analysisService.getResults(); for (Result result : results) { String signature = new ResultService(result).getSignature(); if (!GenericValidator.isBlankOrNull(signature)) { item.setTechnician(signature); break; } } item.setAccessionNumber(sampleService.getAccessionNumber().substring(PREFIX_LENGTH)); item.setReceivedDate(sampleService.getTwoYearReceivedDateForDisplay()); item.setCollectionDate( DateUtil.convertTimestampToTwoYearStringDate( analysisService.getAnalysis().getSampleItem().getCollectionDate())); item.setRejectionReason(noteText); StringBuilder nameBuilder = new StringBuilder(patientService.getLastName().toUpperCase()); if (!GenericValidator.isBlankOrNull(patientService.getNationalId())) { if (nameBuilder.length() > 0) { nameBuilder.append(" / "); } nameBuilder.append(patientService.getNationalId()); } if (useTestName) { item.setPatientOrTestName(analysisService.getTest().getLocalizedName()); item.setNonPrintingPatient(nameBuilder.toString()); } else { item.setPatientOrTestName(nameBuilder.toString()); } return item; }