Exemplo n.º 1
0
        internal StructuredProductType buildImmunizationObject(string immIen, string timestamp, string contraindicated, string encounter, string facility, string name, string reaction)
        {
            StructuredProductType immunization = new StructuredProductType();

            immunization.IDs = new List <IDType>()
            {
                new IDType()
                {
                    ID = immIen, Type = new CodedDescriptionType()
                    {
                        Text = "ID"
                    }
                }
            };
            immunization.DateTime = new List <DateTimeType>()
            {
                new DateTimeType()
                {
                    ExactDateTime = timestamp, Type = new CodedDescriptionType()
                    {
                        Text = "Administered"
                    }
                }
            };
            immunization.Product = new List <StructuredProductTypeProduct>()
            {
                new StructuredProductTypeProduct()
                {
                    ProductName = new CodedDescriptionType()
                    {
                        Text = name
                    }
                }
            };
            immunization.Reaction = new Reaction()
            {
                Description = new CodedDescriptionType()
                {
                    Text = reaction
                }
            };

            return(immunization);
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        internal Immunizations toImmunizations(IDataReader reader)
        {
            Immunizations immunizations = new Immunizations();

            immunizations.Immunization = new List <StructuredProductType>();
            StructuredProductType current = new StructuredProductType();

            while (reader.Read())
            {
                Int32  immSid     = reader.GetInt32(reader.GetOrdinal("ImmunizationSID"));
                string immIen     = reader.GetString(reader.GetOrdinal("ImmunizationIEN"));
                Int16  sitecode   = reader.GetInt16(reader.GetOrdinal("Sta3n"));
                string patientIen = getValue(reader, reader.GetOrdinal("PatientIEN"));
                //string patientSid = getValue(reader, reader.GetOrdinal("PatientSID"));
                string   immunizationName      = getValue(reader, reader.GetOrdinal("ImmunizationName"));
                string   immunizationShortName = getValue(reader, reader.GetOrdinal("ImmunizationShortName"));
                string   inactive             = getValue(reader, reader.GetOrdinal("ImmunizationInactiveFlag"));
                string   series               = getValue(reader, reader.GetOrdinal("Series"));
                string   reaction             = getValue(reader, reader.GetOrdinal("Reaction"));
                string   contraindicated      = getValue(reader, reader.GetOrdinal("ContraindicatedFlag"));
                DateTime eventDateTime        = reader.IsDBNull(reader.GetOrdinal("EventDateTime")) ? new DateTime() : reader.GetDateTime(reader.GetOrdinal("EventDateTime"));
                DateTime visitDateTime        = reader.IsDBNull(reader.GetOrdinal("VisitDateTime")) ? new DateTime() : reader.GetDateTime(reader.GetOrdinal("VisitDateTime"));
                DateTime immunizationDateTime = reader.IsDBNull(reader.GetOrdinal("ImmunizationDateTime")) ? new DateTime() : reader.GetDateTime(reader.GetOrdinal("ImmunizationDateTime"));
                string   orderedBy            = getValue(reader, reader.GetOrdinal("OrderingStaffIEN"));
                string   comments             = getValue(reader, reader.GetOrdinal("Comments"));

                current.CCRDataObjectID = immSid.ToString();

                current.CommentID = new List <string>();
                current.CommentID.Add(comments);

                DateTimeType ts = new DateTimeType()
                {
                    ExactDateTime = eventDateTime.ToShortDateString(), Type = new CodedDescriptionType()
                    {
                        Text = "EventDateTime"
                    }
                };
                (current.DateTime = new List <DateTimeType>()).Add(ts);

                (current.Product = new List <StructuredProductTypeProduct>()).Add(new StructuredProductTypeProduct()
                {
                    ProductName = new CodedDescriptionType()
                    {
                        Text = immunizationName
                    }
                });
                current.Reaction = new Reaction()
                {
                    Description = new CodedDescriptionType()
                    {
                        Text = reaction
                    }
                };
                current.SeriesNumber = series;

                ActorReferenceType orderingProvider = new ActorReferenceType()
                {
                    ActorID = orderedBy
                };
                (current.Source = new List <SourceType>()).Add(new SourceType()
                {
                    Actor = new List <ActorReferenceType>()
                });
                current.Source[0].Actor.Add(orderingProvider);

                SourceType site = new SourceType()
                {
                    ReferenceID = new List <string>()
                };
                site.ReferenceID.Add(sitecode.ToString());
                current.Source.Add(site);

                current.Type = new CodedDescriptionType()
                {
                    Text = "Immunization"
                };

                immunizations.Immunization.Add(current);
                current = new StructuredProductType();
            }

            return(immunizations);
        }
Exemplo n.º 4
0
        public StructuredProductType 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)
        {
            StructuredProductType newMed = new StructuredProductType();

            // MED TIMES
            // start/stop time range
            newMed.DateTime = new List <DateTimeType>();
            DateTimeType timeRange = new DateTimeType();

            timeRange.DateTimeRange = new List <DateTimeTypeDateTimeRange>();
            DateTimeTypeDateTimeRange range = new DateTimeTypeDateTimeRange();

            range.BeginRange = new DateTimeTypeDateTimeRangeBeginRange();
            range.BeginRange.ExactDateTime = startDate;
            range.EndRange = new DateTimeTypeDateTimeRangeEndRange();
            range.EndRange.ExactDateTime = stopDate;
            timeRange.DateTimeRange.Add(range);
            newMed.DateTime.Add(timeRange);
            // prescribed time
            DateTimeType created = new DateTimeType();

            created.ExactDateTime = issueDate;
            created.Type          = new CodedDescriptionType();
            created.Type.Text     = "Prescription date";
            newMed.DateTime.Add(created);
            // last fill time
            DateTimeType filled = new DateTimeType();

            filled.ExactDateTime = fillDate;
            filled.Type          = new CodedDescriptionType();
            filled.Type.Text     = "Dispense date";
            newMed.DateTime.Add(filled);
            // expiration date
            DateTimeType expires = new DateTimeType();

            expires.ExactDateTime = expirationDate;
            expires.Type          = new CodedDescriptionType();
            expires.Type.Text     = "Expiration date";
            newMed.DateTime.Add(expires);
            // END MED TIMES
            // MED NAME AND DETAILS
            // med name and info
            newMed.Product = new List <StructuredProductTypeProduct>();
            StructuredProductTypeProduct medProduct = new StructuredProductTypeProduct();

            medProduct.ProductName      = new CodedDescriptionType();
            medProduct.ProductName.Text = medName;
            medProduct.Strength         = new List <StructuredProductTypeProductStrength>();
            StructuredProductTypeProductStrength medStrength = new StructuredProductTypeProductStrength();

            medStrength.Units      = new MeasureTypeUnits();
            medStrength.Units.Unit = units;
            medStrength.Value      = strength;
            medProduct.Strength.Add(medStrength);
            medProduct.Form = new List <StructuredProductTypeProductForm>();
            medProduct.Form.Add(new StructuredProductTypeProductForm()
            {
                Text = form
            });

            newMed.Product.Add(medProduct);
            // END MED NAME AND DETAILS

            // MED DIRECTIONS
            newMed.Directions = new List <Direction>();
            Direction direction = new Direction();

            direction.Route = new List <DirectionRoute>();
            direction.Route.Add(new DirectionRoute()
            {
                Text = route
            });
            direction.Dose = new List <DirectionDose>();
            direction.Dose.Add(new DirectionDose()
            {
                Value = dose
            });
            direction.Frequency = new List <FrequencyType>();
            direction.Frequency.Add(new FrequencyType()
            {
                Value = frequency
            });
            newMed.Directions.Add(direction);

            newMed.PatientInstructions = new List <InstructionType>();
            newMed.PatientInstructions.Add(new InstructionType()
            {
                Text = sig
            });
            // END MED DIRECTIONS

            // PROVIDER INFO
            newMed.Source = new List <SourceType>();
            //ActorType provider = new ActorType();
            //provider.ActorObjectID = authorName;
            //provider.IDs = new List<IDType>();
            //provider.IDs.Add(new IDType() { ID = authorId });
            SourceType source = new SourceType()
            {
                Actor = new List <ActorReferenceType>()
                {
                    new ActorReferenceType()
                    {
                        ActorID   = authorName,
                        ActorRole = new List <CodedDescriptionType>()
                        {
                            new CodedDescriptionType()
                            {
                                Text = "Prescribing clinician"
                            }
                        }
                    }
                }
            };

            newMed.Source.Add(source);
            // END PROVIDER INFO

            // MED IDs
            medProduct.IDs = new List <IDType>();
            IDType newMedId = new IDType();

            newMedId.ID        = medId;
            newMedId.Type      = new CodedDescriptionType();
            newMedId.Type.Text = "Pharmacy ID";
            medProduct.IDs.Add(newMedId);
            // END MED IDs

            newMed.Status      = new CodedDescriptionType();
            newMed.Status.Text = status;
            newMed.Type        = new CodedDescriptionType()
            {
                Text = rxType
            };
            newMed.Quantity = new List <QuantityType>();
            QuantityType medQuantity = new QuantityType()
            {
                Value = quantity
            };

            newMed.Quantity.Add(medQuantity);
            newMed.Refills = new List <StructuredProductTypeRefill>();
            StructuredProductTypeRefill medRefills = new StructuredProductTypeRefill()
            {
                Number = new List <string>()
                {
                    fillsRemaining
                }
            };

            medRefills.Quantity = new List <QuantityType>()
            {
                new QuantityType()
                {
                    Value = refills
                }
            };
            newMed.Refills.Add(medRefills);

            return(newMed);
        }