package org.mitre.midiki.workshop;
import java.io.Serializable;
/**
* Represents an item in the patient's medical history which is suggestive
* of a particular disease. Typically, disease descriptions show those historys
* which must be present, while diagnosis queries may contain historys which
* have been identified as absent (as distinct from historys whose status
* is unknown).
*
* @author Carl Burke
* @version 1.0
* @since 1.0
* @see Serializable
*/
public class MedicalHistory implements Serializable
{
/**
* The name of the history.
*/
public String name;
/**
* true
if the symptom is required vs suggestive.
*/
public boolean required;
/**
* true
if the history is present.
*/
public boolean present;
/**
* Generates a string representation of the history.
*
* @return a String
value
*/
public String toString()
{
StringBuffer sb = new StringBuffer(128);
sb.append("MedicalHistory(");
sb.append(name);
sb.append(",");
if (required) {
sb.append("required=yes,");
} else {
sb.append("required=no,");
}
if (present) {
sb.append("present=yes");
} else {
sb.append("present=no");
}
sb.append(")");
return sb.toString();
}
/**
* Returns true
if the history matches the query.
* Since synonyms are not considered, this is a less powerful
* match than the one performed by WorkshopDatabase
* in calculating a diagnosis.
*
* @param s a MedicalHistory
value
* @return a boolean
value
*/
public boolean matches(MedicalHistory s)
{
if (!name.equalsIgnoreCase(s.name)) return false;
return (present==s.present);
}
/**
* Empty constructor.
*
*/
public MedicalHistory()
{
}
/**
* Creates a new MedicalHistory
instance.
*
* @param n a String
value
* @param q a boolean
value
* @param p a boolean
value
*/
public MedicalHistory(String n, boolean q, boolean p)
{
this();
name=n; required=q; present=p;
}
}