package open.dolphin.infomodel;
// Generated 2010/06/30 10:57:59 by Hibernate Tools 3.2.1.GA

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.Transient;
import open.dolphin.queries.DolphinQuery;

/**
 * 患者基本情報 MEMO:マッピング
 * Serializable
 * 
 * 以下の情報を収める
 *
 * アレルギー(AllergyModel)
 * 身長体重(PhysicalModel)
 * 直近の来院日
 * PatientMemoModel
 * 
 * KarteBean generated by hbm2java
 */
public class KarteBean extends InfoModel {

    private long id;//MEMO:Refrection
    private PatientModel patient;//MEMO:Refrection
    private Date created;//MEMO:Refrection
    @Transient
    private Map<String, List> entries;

    /**
     *
     */
    public KarteBean() {
    }

    /**
     * 検索 MEMO:何もしない
     * @param query
     * @return false
     */
    @Override
    public boolean search(DolphinQuery query) {
        return false;
    }

    /**
     * idのGetter
     * MEMO:Refrection
     * @return
     */
    public long getId() {
        return this.id;
    }

    /**
     * idのSettter
     * MEMO:Refrection
     * @param id
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * patientのGetter
     * MEMO:Refrection
     * @return
     */
    public PatientModel getPatient() {
        return this.patient;
    }

    /**
     * patientのSetter
     * MEMO:Refrection
     * @param patient
     */
    public void setPatient(PatientModel patient) {
        this.patient = patient;
    }

    /**
     * createdのGetter
     * MEMO:Refrection
     * @return
     */
    public Date getCreated() {
        return this.created;
    }

    /**
     * createdのSetter
     * MEMO:Refrection
     * @param created
     */
    public void setCreated(Date created) {
        this.created = created;
    }

    /**
     * entriesのGetter
     * @return
     */
    public Map<String, List> getEntries() {
        return entries;
    }

    /**
     * entriesのSetter
     * @param entries
     */
    public void setEntries(Map<String, List> entries) {
        this.entries = entries;
    }

    /**
     * entryCollectionのGetter
     * @param category
     * @return
     */
    public List getEntryCollection(String category) {
        return entries != null ? entries.get(category) : null;
    }

    /**
     * entryCollectionのAdder
     * @param category
     * @param entrs
     */
    public void addEntryCollection(String category, List entrs) {

        if (entries == null) {
            entries = new HashMap<String, List>();
        }
        entries.put(category, entrs);
    }

    /**
     *
     * @return
     */
    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + (int) (id ^ (id >>> 32));
        return result;
    }

    /**
     *
     * @param obj
     * @return
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final KarteBean other = (KarteBean) obj;
        if (getId() != other.getId()) {
            return false;
        }
        return true;
    }
}
