First working version of drugs formatting.
This commit is contained in:
@ -36,7 +36,7 @@ namespace zaaReloaded2.Medication
|
||||
/// The detected block is selected.
|
||||
/// </summary>
|
||||
/// <returns>True if a block was detected, false if not.</returns>
|
||||
public bool AutoDetect(Document document)
|
||||
public static bool AutoDetect(Document document)
|
||||
{
|
||||
Paragraph start = null;
|
||||
Paragraph end = null;
|
||||
@ -47,20 +47,20 @@ namespace zaaReloaded2.Medication
|
||||
string line = document.Paragraphs[i].Range.Text;
|
||||
if (Prescription.IsPrescriptionLine(line))
|
||||
{
|
||||
start = document.Paragraphs[i];
|
||||
end = document.Paragraphs[i];
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
|
||||
if (start != null)
|
||||
if (end != null)
|
||||
{
|
||||
end = start;
|
||||
while (i > 1)
|
||||
start = end;
|
||||
while (i > 2)
|
||||
{
|
||||
if (!Prescription.IsPrescriptionLine(document.Paragraphs[i - 1].Range.Text))
|
||||
{
|
||||
end = document.Paragraphs[i];
|
||||
start = document.Paragraphs[i];
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
@ -102,7 +102,7 @@ namespace zaaReloaded2.Medication
|
||||
{
|
||||
if (Prescription.IsPrescriptionLine(line))
|
||||
{
|
||||
Prescriptions.Add(Prescription.FromLine(line));
|
||||
Prescriptions.AddRange(Prescription.ManyFromLine(line));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user