Implement automatic MMF warning.

This commit is contained in:
Daniel Kraus 2015-12-02 17:08:25 +01:00
parent 865e5bff1e
commit e71e69d4c4
3 changed files with 55 additions and 2 deletions

View File

@ -111,5 +111,18 @@ namespace Tests.Medication
Assert.AreEqual("alle zwei Tage", p.Comment);
Assert.AreEqual("Eusaprim forte\talle zwei Tage", p.ToString(), "ToString");
}
[Test]
[TestCase("CellCept 500 mg", true)]
[TestCase("Cell CEpt 500 mg", true)]
[TestCase("Myfortic", true)]
[TestCase("Mycophenolatmofetil 500 mg", true)]
[TestCase("Cellophan 5 g", false)]
[TestCase("MMF 500 mg", true)]
public void MmfProperty(string drug, bool isMmf)
{
Prescription p = new Prescription(drug);
Assert.AreEqual(isMmf, p.IsMmf);
}
}
}

View File

@ -105,6 +105,14 @@ namespace zaaReloaded2.Medication
void AddDisclaimer(zaaReloaded2.Formatter.DocumentWriter writer)
{
if (HasMMF())
{
writer.WriteLine();
writer.WriteLine("<b>Hinweis: Während und nach Therapie mit Mycophenolsäurederivaten wie CellCept\u00ae " +
"und Myfortic\u00ae müssen Frauen und Männer eine Schwangerschaft sicher verhüten (siehe Rote-Hand-Brief zu " +
"CellCept\u00ae vom 10.11.2015).</b>");
writer.WriteLine();
}
writer.WriteLine("<highlight><b>Bitte Medikation überprüfen!</b></highlight>");
}
@ -188,6 +196,15 @@ namespace zaaReloaded2.Medication
Helpers.EndUndo();
}
/// <summary>
/// Determines whether MMF or MPA is contained in the prescriptions.
/// </summary>
/// <returns>True if MMF or MPA is prescribed.</returns>
bool HasMMF()
{
return Prescriptions.FirstOrDefault(p => p.IsMmf) != null;
}
#endregion
}
}

View File

@ -110,6 +110,23 @@ namespace zaaReloaded2.Medication
public string Comment { get; set; }
/// <summary>
/// Determines whether the drug is MMF or a derivative.
/// </summary>
public bool IsMmf
{
get
{
string d = Drug.ToLower();
return
d.StartsWith("mmf") ||
d.StartsWith("cellcept") ||
d.StartsWith("cell cept") ||
d.StartsWith("myfortic") ||
d.StartsWith("mycophenol");
}
}
#endregion
#region Overrides
@ -172,10 +189,16 @@ namespace zaaReloaded2.Medication
public Prescription() { }
public Prescription(string drug, string morning, string noon,
string evening, string night)
public Prescription(string drug)
: this()
{
Drug = drug.Trim();
}
public Prescription(string drug, string morning, string noon,
string evening, string night)
: this(drug)
{
Morning = morning.Trim();
Noon = noon.Trim();
Evening = evening.Trim();