public buildMedObject ( string medName, string medId, string startDate, string stopDate, string issueDate, string fillDate, string expirationDate, string sig, string strength, string units, string form, string dose, string frequency, string route, string refills, string fillsRemaining, string quantity, string authorName, string authorId, string status, string rxType ) : |
||
medName | string | |
medId | string | |
startDate | string | |
stopDate | string | |
issueDate | string | |
fillDate | string | |
expirationDate | string | |
sig | string | |
strength | string | |
units | string | |
form | string | |
dose | string | |
frequency | string | |
route | string | |
refills | string | |
fillsRemaining | string | |
quantity | string | |
authorName | string | |
authorId | string | |
status | string | |
rxType | string | |
return |
public void testToCCRMed() { CCRHelper helper = new CCRHelper(); StructuredProductType med = helper.buildMedObject("METOPROLOL TARTRATE TAB", "403949;O", "3100227", "3100528", "3100227.090342", "3100227", "3100528", "TAKE ONE TABLET MOUTH TWICE A DAY", "500", "MG", "TABLET", "1", "BID", "PO", "1", "0", "180", "PROVIDER,ONE", "983", "EXPIRED", "O"); Assert.IsNotNull(med); Assert.AreEqual(med.Product.Count, 1); Assert.IsTrue(String.Equals(med.Product.First().ProductName.Text, "METOPROLOL TARTRATE TAB")); Assert.AreEqual(med.Product.First().IDs.Count, 1); Assert.IsTrue(String.Equals(med.Product.First().IDs.First().ID, "403949;O")); Assert.AreEqual(med.DateTime.Count, 4); Assert.IsTrue(String.Equals(med.DateTime.First().DateTimeRange.First().BeginRange.ExactDateTime, "3100227")); Assert.IsTrue(String.Equals(med.DateTime.First().DateTimeRange.First().EndRange.ExactDateTime, "3100528")); Assert.IsTrue(String.Equals(med.DateTime[1].ExactDateTime, "3100227.090342")); Assert.IsTrue(String.Equals(med.DateTime[1].Type.Text, "Prescription date")); Assert.IsTrue(String.Equals(med.DateTime[2].ExactDateTime, "3100227")); Assert.IsTrue(String.Equals(med.DateTime[2].Type.Text, "Dispense date")); Assert.IsTrue(String.Equals(med.DateTime[3].ExactDateTime, "3100528")); Assert.IsTrue(String.Equals(med.DateTime[3].Type.Text, "Expiration date")); Assert.IsTrue(String.Equals(med.PatientInstructions.First().Text, "TAKE ONE TABLET MOUTH TWICE A DAY")); Assert.IsTrue(String.Equals(med.Product.First().Strength.First().Value, "500")); Assert.IsTrue(String.Equals(med.Product.First().Strength.First().Units.Unit, "MG")); Assert.IsTrue(String.Equals(med.Product.First().Form.First().Text, "TABLET")); Assert.IsTrue(String.Equals(med.Directions.First().Dose.First().Value, "1")); Assert.IsTrue(String.Equals(med.Directions.First().Frequency.First().Value, "BID")); Assert.IsTrue(String.Equals(med.Directions.First().Route.First().Text, "PO")); Assert.IsTrue(String.Equals(med.Refills.First().Number.First(), "0")); // fills remaining Assert.IsTrue(String.Equals(med.Refills.First().Quantity.First().Value, "1")); // total refills allowed Assert.IsTrue(String.Equals(med.Quantity.First().Value, "180")); Assert.IsTrue(String.Equals(med.Source.First().Actor.First().ActorID, "PROVIDER,ONE")); Assert.IsTrue(String.Equals(med.Source.First().Actor.First().ActorRole.First().Text, "Prescribing clinician")); Assert.IsTrue(String.Equals(med.Status.Text, "EXPIRED")); Assert.IsTrue(String.Equals(med.Type.Text, "O")); }
public void testToCCRMed() { CCRHelper helper = new CCRHelper(); StructuredProductType med = helper.buildMedObject("METOPROLOL TARTRATE TAB", "403949;O", "3100227", "3100528", "3100227.090342", "3100227", "3100528", "TAKE ONE TABLET MOUTH TWICE A DAY", "500", "MG", "TABLET", "1", "BID", "PO", "1", "0", "180", "PROVIDER,ONE", "983", "EXPIRED", "O"); Assert.IsNotNull(med); Assert.AreEqual(med.Product.Count, 1); Assert.IsTrue(String.Equals(med.Product.First().ProductName.Text, "METOPROLOL TARTRATE TAB")); Assert.AreEqual(med.Product.First().IDs.Count, 1); Assert.IsTrue(String.Equals(med.Product.First().IDs.First().ID, "403949;O")); Assert.AreEqual(med.DateTime.Count, 4); Assert.IsTrue(String.Equals(med.DateTime.First().DateTimeRange.First().BeginRange.ExactDateTime, "3100227")); Assert.IsTrue(String.Equals(med.DateTime.First().DateTimeRange.First().EndRange.ExactDateTime, "3100528")); Assert.IsTrue(String.Equals(med.DateTime[1].ExactDateTime, "3100227.090342")); Assert.IsTrue(String.Equals(med.DateTime[1].Type.Text, "Prescription date")); Assert.IsTrue(String.Equals(med.DateTime[2].ExactDateTime, "3100227")); Assert.IsTrue(String.Equals(med.DateTime[2].Type.Text, "Dispense date")); Assert.IsTrue(String.Equals(med.DateTime[3].ExactDateTime, "3100528")); Assert.IsTrue(String.Equals(med.DateTime[3].Type.Text, "Expiration date")); Assert.IsTrue(String.Equals(med.PatientInstructions.First().Text, "TAKE ONE TABLET MOUTH TWICE A DAY")); Assert.IsTrue(String.Equals(med.Product.First().Strength.First().Value, "500")); Assert.IsTrue(String.Equals(med.Product.First().Strength.First().Units.Unit, "MG")); Assert.IsTrue(String.Equals(med.Product.First().Form.First().Text, "TABLET")); Assert.IsTrue(String.Equals(med.Directions.First().Dose.First().Value, "1")); Assert.IsTrue(String.Equals(med.Directions.First().Frequency.First().Value, "BID")); Assert.IsTrue(String.Equals(med.Directions.First().Route.First().Text, "PO")); Assert.IsTrue(String.Equals(med.Refills.First().Number.First(), "0")); // fills remaining Assert.IsTrue(String.Equals(med.Refills.First().Quantity.First().Value, "1")); // total refills allowed Assert.IsTrue(String.Equals(med.Quantity.First().Value, "180")); Assert.IsTrue(String.Equals(med.Source.First().Actor.First().ActorID, "PROVIDER,ONE")); Assert.IsTrue(String.Equals(med.Source.First().Actor.First().ActorRole.First().Text, "Prescribing clinician")); Assert.IsTrue(String.Equals(med.Status.Text, "EXPIRED")); Assert.IsTrue(String.Equals(med.Type.Text, "O")); }
internal Medications toCCRMedsFromXmlNode(XmlNode node) { Medications meds = new Medications(); int total = verifyTopLevelNode(node); if (total == 0) { return meds; } XmlNodeList medNodes = node.SelectNodes("/med"); if (medNodes == null || medNodes.Count == 0) { return meds; } meds.Medication = new List<StructuredProductType>();// new List<StructuredProductType>(); CCRHelper ccrHelper = new CCRHelper(); foreach (XmlNode medNode in medNodes) { string cost = XmlUtils.getXmlAttributeValue(medNode, "fillCost", "value"); string daysSupply = XmlUtils.getXmlAttributeValue(medNode, "daysSupply", "value"); string medId = XmlUtils.getXmlAttributeValue(medNode, "id", "value"); KeyValuePair<string, string> hospitalLocation = new KeyValuePair<string, string>(XmlUtils.getXmlAttributeValue(medNode, "location", "code"), XmlUtils.getXmlAttributeValue(medNode, "location", "name")); string medName = XmlUtils.getXmlAttributeValue(medNode, "name", "value"); string pharmId = XmlUtils.getXmlAttributeValue(medNode, "medID", "value"); string orderId = XmlUtils.getXmlAttributeValue(medNode, "orderID", "value"); string refills = XmlUtils.getXmlAttributeValue(medNode, "fillsAllowed", "value"); string refillsRemaining = XmlUtils.getXmlAttributeValue(medNode, "fillsRemaining", "value"); SiteId facility = new SiteId(XmlUtils.getXmlAttributeValue(medNode, "facility", "code"), XmlUtils.getXmlAttributeValue(medNode, "facility", "name")); Author provider = new Author(XmlUtils.getXmlAttributeValue(medNode, "orderingProvider", "code"), XmlUtils.getXmlAttributeValue(medNode, "orderingProvider", "name"), ""); string rxNumber = XmlUtils.getXmlAttributeValue(medNode, "prescription", "value"); string quantity = XmlUtils.getXmlAttributeValue(medNode, "quantity", "value"); string sig = ""; XmlNode sigNode = medNode.SelectSingleNode("sig"); if (sigNode != null) { sig = sigNode.InnerXml; } string status = XmlUtils.getXmlAttributeValue(medNode, "vaStatus", "value"); string medType = XmlUtils.getXmlAttributeValue(medNode, "vaType", "value"); string dose = XmlUtils.getXmlAttributeValue(medNode, "doses/dose", "dose"); string route = XmlUtils.getXmlAttributeValue(medNode, "doses/dose", "route"); string schedule = XmlUtils.getXmlAttributeValue(medNode, "doses/dose", "schedule"); string rate = XmlUtils.getXmlAttributeValue(medNode, "rate", "value"); // this should be a dictionary - can have more than 1 orderable item associate with a med (e.g. two components of a solution for IV med) // these should be the <products> nodes //med.PharmacyOrderableItem string expires = XmlUtils.getXmlAttributeValue(medNode, "expires", "value"); string issued = XmlUtils.getXmlAttributeValue(medNode, "ordered", "value"); string lastFilled = XmlUtils.getXmlAttributeValue(medNode, "lastFilled", "value"); string startDate = XmlUtils.getXmlAttributeValue(medNode, "start", "value"); string stopDate = XmlUtils.getXmlAttributeValue(medNode, "stop", "value"); // extra data in CCR med only string unitsPerDose = XmlUtils.getXmlAttributeValue(medNode, "doses/dose", "unitsPerDose"); string units = XmlUtils.getXmlAttributeValue(medNode, "doses/dose", "units"); string form = XmlUtils.getXmlAttributeValue(medNode, "doses/dose", "noun"); StructuredProductType ccrMed = ccrHelper.buildMedObject(medName, medId, startDate, stopDate, issued, lastFilled, expires, sig, dose, units, form, unitsPerDose, schedule, route, refills, refillsRemaining, quantity, provider.Name, provider.Id, status, medType); meds.Medication.Add(ccrMed); } return meds; }