*/
public class WizardAnalysisResult extends WizardResult {
@Override
public Object generateResult() {
Analysis analisys = new Analysis();
analisys.setMedic((Medic) this.results.get("medic"));
RawSignal rawSignal = (RawSignal) this.results.get("rawSignal");
rawSignal.setInverted((Boolean) this.results.get("inverted"));
analisys.setRawSignal(rawSignal);
analisys.setCreationDay((Date) this.results.get("date"));
analisys.setFilePath((String) this.results.get("signal"));
analisys.setSignalFrequency((SignalFrequency) this.results.get("period"));
analisys.setFileName((String) this.results.get("filename"));
Patient patient = (Patient) this.results.get("patient");
patient.getRawsignals().add(rawSignal);
ClinicalInformation clinicalInformation = (ClinicalInformation) this.results.get("clinicalInfo");
clinicalInformation.setPatient(patient);
analisys.setPatient(patient);
analisys.setClinicalInformation(clinicalInformation);
Iterator<String> familyList = patient.getClinicalHistoryProxy().getFamilyBackground(2).iterator();
Iterator<String> medicinesList = patient.getClinicalHistoryProxy().getPatientMedicines(2).iterator();
Iterator<String> pathologiesList = patient.getClinicalHistoryProxy().getPatientPathologies(2).iterator();
Iterator<String> surgeriesList = patient.getClinicalHistoryProxy().getPatientSurgeries(2).iterator();
Report report = new Report();
String family = "";
while (familyList.hasNext()) {
family = family.concat((family.isEmpty() ? "" : ". ") + familyList.next());
}
report.setBackgroundFamily(family.isEmpty() ? "" : "Antecendentes Familiares: " + family);
String medicine = "";
while (medicinesList.hasNext()) {
medicine = medicine.concat((medicine.isEmpty() ? "" : ". ") + medicinesList.next());
}
report.setBackgroundMedicines(medicine.isEmpty() ? "" : "Medicamentos: " + medicine);
String pathology = "";
while (pathologiesList.hasNext()) {
pathology = pathology.concat((pathology.isEmpty() ? "" : ". ") + pathologiesList.next());
}
report.setBackgroundPathologies(pathology.isEmpty() ? "" : EntityDescriptions.PATHOLOGIES + ": " + pathology);
String surgeries = "";
while (surgeriesList.hasNext()) {
surgeries = surgeries.concat((surgeries.isEmpty() ? "" : ". ") + surgeriesList.next());
}
report.setBackgroundSurgeries(surgeries.isEmpty()?"":EntityDescriptions.SURGERIES + ": " +surgeries);
analisys.setReport(report);
return analisys;
}