public void addVitalSign(string type, VitalSign s)
{
if (!VitalSign.IsValidType(type))
{
throw new Exception("Invalid Vital Sign: " + type);
}
if (theSigns.ContainsKey(type))
{
throw new Exception("Set already contains " + type);
}
theSigns.Add(type, s);
if (type == VitalSign.BLOOD_PRESSURE)
{
string[] parts = StringUtils.split(s.Value1, StringUtils.SLASH);
if (parts.Length == 2)
{
VitalSign vs = new VitalSign();
vs.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.SYSTOLIC_BP);
vs.Timestamp = s.Timestamp;
vs.Value1 = parts[0];
vs.Units = s.Units;
vs.Qualifiers = s.Qualifiers;
theSigns.Add(VitalSign.SYSTOLIC_BP, vs);
vs = new VitalSign();
vs.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.DIASTOLIC_BP);
vs.Timestamp = s.Timestamp;
vs.Value1 = parts[1];
vs.Units = s.Units;
vs.Qualifiers = s.Qualifiers;
theSigns.Add(VitalSign.DIASTOLIC_BP, vs);
}
}
}