I am design and EMR. I have determined the central object to the domain is the Patient. The patient must have the following a Doctor and Medical Records. Medical Records is a grouping term refering to the collective of Encounters, Labs, XRays, Prescriptions.... I am new to DDD and I am having trouble with a couple of concepts and my understanding of DDD. Below is a code sample which shows and Encounter class. Ecounter contains a couple of propertiees and it also references another class Vitals. Vitals has no significance outside of the Patient. I still identify vitals in the database with its own key. I am not sure if that qualifies Vitals as being an entity. Currently I have Vitals has a Value object. Second the way my model is built I have Encounter defined as and Aggregate root. Through and Encounter a doctor could order labs, xrays and prescribe medicine. Basically the Ecounter documents the reason why such items are being ordered/ The problem exist in the sense that I would also need to retrieve these items outside the context of an Encounter, therfore does that mean Encounter is not an Aggregate Root. An item such as Vitals is that just a value object. Code is below
//Abbreviated class listing public class Encounter {
String ChiefComplaint {get; set;} string Plan {get; set;} string Assessment {get; set;} Vital PatientVital {get; set;} }
public class Vital { public float Temperature { get; private set; } public BloodPressure BP { get; private set; } public int Pulse { get; private set; } public int Respiratory { get; private set; }
internal Vital(float temperature, int systolic, int diastolic, int pulse, int respiratory)
{
this.Temperature = temperature;
BloodPressure bp = new BloodPressure();
bp.Systolic = systolic;
bp.Diastolic = diastolic;
this.Respiratory = respiratory;
this.BP = bp;
}
public void AddBP(int systolic, int diastolic)
{
BloodPressure bp = new BloodPressure();
bp.Systolic = systolic;
bp.Diastolic = diastolic;
this.BP = bp;
}
}
public struct BloodPressure
{
public BloodPressure(int systolic, int diastolic) { Systolic = systolic; Diastolic = diastolic; }
public int Systolic { get; private set; }
public int Diastolic { get; private set; }
public string bloodPressure
{
get { return this.Systolic.ToString() + "/" + this.Diastolic.ToString(); }
}
}