Package systole.domain.persons

Source Code of systole.domain.persons.ClinicalHistoryProxy

/**
*
*/
package systole.domain.persons;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import systole.domain.clinicalInformation.ClinicalInformation;
import systole.domain.clinicalInformation.FamilyPatientBackground;
import systole.domain.clinicalInformation.MedicinePatient;
import systole.domain.clinicalInformation.PathologyPatient;
import systole.domain.clinicalInformation.SportPatient;
import systole.domain.clinicalInformation.SurgeryPatient;

/**
* @author jmj
*
*/
public class ClinicalHistoryProxy {

    private static final String NOT_FOUND = "No Disponible";
    private Patient patient;
    private List<ClinicalInformation> clinicalInfo = null;
    private List<FamilyPatientBackground> background = null;
    private List<MedicinePatient> medicines = null;
    private List<PathologyPatient> pathologies = null;
    private List<SportPatient> sports = null;
    private List<SurgeryPatient> surgeries = null;

    /**
     * @param patient
     *
     */
    public ClinicalHistoryProxy(Patient patient) {
        super();
        this.patient = patient;
    }

    /**
     * @return the clinicalInfo
     */
    private List<ClinicalInformation> getClinicalInfo() {
        if (this.clinicalInfo == null) {
            this.clinicalInfo = new Vector<ClinicalInformation>(this.patient.getClinicalInformation());
        }
        return clinicalInfo;
    }

    /**
     * @return the familyBackground
     */
    private List<FamilyPatientBackground> getBackground() {
        if (this.background == null) {
            this.background = new Vector<FamilyPatientBackground>(this.patient.getFamilyPatientBackgrounds());
        }
        return background;
    }

    /**
     * @return the medicines
     */
    private List<MedicinePatient> getMedicines() {
        if (this.medicines == null) {
            this.medicines = new Vector<MedicinePatient>(this.patient.getMedicinesPatient());
        }
        return medicines;
    }

    /**
     * @return the pathologies
     */
    private List<PathologyPatient> getPathologies() {
        if (this.pathologies == null) {
            this.pathologies = new Vector<PathologyPatient>(this.patient.getPathologiesPatient());
        }
        return pathologies;
    }

    /**
     * @return the sports
     */
    private List<SportPatient> getSports() {
        if (this.sports == null) {
            this.sports = new Vector<SportPatient>(this.patient.getSportsPatient());
        }
        return sports;
    }

    /**
     * @return the surgeries
     */
    private List<SurgeryPatient> getSurgeries() {
        if (this.surgeries == null) {
            this.surgeries = new Vector<SurgeryPatient>(this.patient.getSurgeriesPatient());
        }
        return surgeries;
    }

    /**
     * @return the getBackgroundByFamily
     */
    public List<String> getFamilyBackground() {
        return this.getFamilyBackground(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return the getBackgroundByFamily
     */
    public List<String> getFamilyBackground(int maxAmount) {
        Iterator<FamilyPatientBackground> it = this.getBackground().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getFamilyBackground().size());

        while ((it.hasNext()) && (amount > 0)) {
            FamilyPatientBackground backgorund = it.next();
            if (backgorund.hasAnyBackground()) {
                result.add(backgorund.toString());
                amount--;
            }
        }
        return result;
    }

    /**
     * @return complete background by family as string
     */
    public List<String> getCompleteFamilyBackground() {
        return this.getCompleteFamilyBackground(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return complete background by family as string
     */
    public List<String> getCompleteFamilyBackground(int maxAmount) {
        Iterator<FamilyPatientBackground> it = this.getBackground().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getFamilyBackground().size());

        while ((it.hasNext()) && (amount > 0)) {
            FamilyPatientBackground backgorund = it.next();
            result.add(backgorund.toString());
            amount--;
        }
        return result;
    }

    /**
     * @return complete patient medicines as string
     */
    public List<String> getPatientMedicines() {
        return this.getPatientMedicines(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return complete patient medicines as string
     */
    public List<String> getPatientMedicines(int maxAmount) {
        Iterator<MedicinePatient> it = this.getMedicines().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getMedicines().size());

        while ((it.hasNext()) && (amount > 0)) {
            MedicinePatient medicine = it.next();
            result.add(medicine.toString());
            amount--;
        }
        return result;
    }

    /**
     * @return complete patient sports as string
     */
    public List<String> getPatientSports() {
        return this.getPatientSports(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return complete patient sports as string
     */
    public List<String> getPatientSports(int maxAmount) {
        Iterator<SportPatient> it = this.getSports().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getSports().size());

        while ((it.hasNext()) && (amount > 0)) {
            SportPatient sport = it.next();
            result.add(sport.toString());
            amount--;
        }
        return result;
    }

    /**
     * @return complete patient pathologies as string
     */
    public List<String> getPatientPathologies() {
        return this.getPatientPathologies(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return complete patient pathologies as string
     */
    public List<String> getPatientPathologies(int maxAmount) {
        Iterator<PathologyPatient> it = this.getPathologies().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getPathologies().size());

        while ((it.hasNext()) && (amount > 0)) {
            PathologyPatient pathology = it.next();
            result.add(pathology.toString());
            amount--;
        }
        return result;
    }

    /**
     * @return complete patient Surgeries as string
     */
    public List<String> getPatientSurgeries() {
        return this.getPatientSurgeries(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return complete patient Surgeries as string
     */
    public List<String> getPatientSurgeries(int maxAmount) {
        Iterator<SurgeryPatient> it = this.getSurgeries().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getSurgeries().size());

        while ((it.hasNext()) && (amount > 0)) {
            SurgeryPatient surgery = it.next();
            result.add(surgery.toString());
            amount--;
        }
        return result;
    }

    /**
     * @return complete patient clinical info as string
     */
    public List<String> getPatientClinicalInfo() {
        return this.getPatientClinicalInfo(0);
    }

    /**
     * @param maxAmount
     *            maximum amount of items
     * @return complete patient clinical info as string
     */
    public List<String> getPatientClinicalInfo(int maxAmount) {
        Iterator<ClinicalInformation> it = this.getClinicalInfo().iterator();
        Vector<String> result = new Vector<String>();

        int amount = (maxAmount > 0 ? maxAmount : this.getClinicalInfo().size());

        while ((it.hasNext()) && (amount > 0)) {
            ClinicalInformation clinicalInfoItem = it.next();
            result.add(clinicalInfoItem.toString());
            amount--;
        }
        return result;
    }

    /**
     * @return if patient is smoker
     */
    public String getIsSmoker() {
        return ((this.patient.getHabitPatient() != null)
                ? (this.patient.getHabitPatient().getSmoking() != null
                ? (this.patient.getHabitPatient().getSmoking() ? "Si" : "No") :"")
                : "");
    }
  
}
TOP

Related Classes of systole.domain.persons.ClinicalHistoryProxy

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.