Package systole.view.wizard.analysis

Source Code of systole.view.wizard.analysis.WizardAnalysisResult

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package systole.view.wizard.analysis;

import java.util.Date;
import java.util.Iterator;
import systole.domain.analysis.Analysis;
import systole.domain.clinicalInformation.ClinicalInformation;
import systole.domain.persons.Medic;
import systole.domain.persons.Patient;
import systole.domain.report.Report;
import systole.domain.signals.RawSignal;
import systole.domain.signals.SignalFrequency;
import systole.view.messages.EntityDescriptions;
import systole.view.wizard.WizardResult;

/**
*
* @author jmj
*/
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;
    }

    @Override
    public String[] generateSummary() {
        String[] items = new String[3];
        items[0] = "<html><b>" + EntityDescriptions.PATIENT + ":</b><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + this.results.get("patient").toString() + "</html>";
        items[1] = "<html><b>" + EntityDescriptions.MEDIC + ":</b><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + this.results.get("medic").toString() + "</html>";
        items[2] = "<html><b>Tren de Pulso:</b><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + (this.results.get("signal")) + "</html>";
        return items;
    }
}
TOP

Related Classes of systole.view.wizard.analysis.WizardAnalysisResult

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.