Exemplo n.º 1
0
        public CdaProcedure(POCD_MT000040Procedure pocdProcedure)
        {
            if (pocdProcedure.id != null)
            {
                if (pocdProcedure.id.Length > 0)
                {
                    this.Id = pocdProcedure.id[0].root;
                }
            }

            this.Code = CdaCode.FromPocd(pocdProcedure.code);

            this.EffectiveTime = CdaEffectiveTime.FromPocd(pocdProcedure.effectiveTime);
        }
Exemplo n.º 2
0
        public static CdaCode GetLabSectionCode(string p)
        {
            CdaCode returnVal = new CdaCode();

            string val = Util.Piece(p, " ", 1);

            switch (val)
            {
            case "CH":
                returnVal.Code        = "18719-5";
                returnVal.DisplayName = "Chemistry Studies";
                returnVal.CodeSystem  = CodingSystem.Loinc;
                break;

            case "SEROL":
                returnVal.Code        = "18727-8";
                returnVal.DisplayName = "Serology Studies";
                returnVal.CodeSystem  = CodingSystem.Loinc;
                break;

            case "URINE":
                returnVal.Code        = "18729-4";
                returnVal.DisplayName = "Urinalysis Studies";
                returnVal.CodeSystem  = CodingSystem.Loinc;
                break;

            case "HE":
                returnVal.Code        = "18723-7";
                returnVal.DisplayName = "Hematology Studies";
                returnVal.CodeSystem  = CodingSystem.Loinc;
                break;

            case "COAG":
                returnVal.Code        = "18720-3";
                returnVal.DisplayName = "Coagulation Studies";
                returnVal.CodeSystem  = CodingSystem.Loinc;
                break;

            // TODO: others...?

            default:
                returnVal.Code        = "26436-6";
                returnVal.DisplayName = "Laboratory Studies";
                returnVal.CodeSystem  = CodingSystem.Loinc;
                break;
            }

            return(returnVal);
        }
        public CdaSimpleObservation(POCD_MT000040Observation pocdObs)
        {
            // *** Template Ids ***
            this.TemplateIds = new CdaTemplateIdList(pocdObs.templateId);

            // *** Observation Id ***
            if (pocdObs.id != null)
            {
                if (pocdObs.id.Length > 0)
                {
                    this.Id = pocdObs.id[0].root;
                }
            }

            // *** Code ***
            this.Code = CdaCode.FromPocd(pocdObs.code);

            // *** Negation ***
            if (pocdObs.negationIndSpecified)
            {
                this.NegationIndicator = pocdObs.negationInd;
            }

            // *** Status ***
            if (pocdObs.statusCode != null)
            {
                Hl7ProblemActStatus stat = Hl7ProblemActStatus.unknown;

                if (Enum.TryParse <Hl7ProblemActStatus>(pocdObs.statusCode.code, out stat))
                {
                    this.Status = stat;
                }
            }

            // *** Effective Time ***
            if (pocdObs.effectiveTime != null)
            {
                this.EffectiveTime = CdaEffectiveTime.FromPocd(pocdObs.effectiveTime);
            }

            this.Mood = x_ActMoodDocumentObservation.EVN;
        }
        private static CdaCode GetVisitSummaryValueCode(Observation observation)
        {
            CdaCode returnCode;

            AlbuminDictionary           albuminDictionary           = new AlbuminDictionary();
            EdemaDictionary             edemaDictionary             = new EdemaDictionary();
            FetalMovementDictionary     fetalMovementDictionary     = new FetalMovementDictionary();
            FetalPresentationDictionary fetalPresentationDictionary = new FetalPresentationDictionary();
            GlucoseDictionary           glucoseDictionary           = new GlucoseDictionary();
            PainDictionary painDictionary = new PainDictionary();


            string valueCode = "";

            Dictionary <string, string> lookupDictionary = null;

            switch (observation.Code)
            {
            case "11876-0":
            case "11877-8":
                lookupDictionary = fetalPresentationDictionary;
                break;

            case "57088-7":
                lookupDictionary = fetalMovementDictionary;
                break;

            case "1753-3":
                lookupDictionary = albuminDictionary;
                break;

            case "2349-9":
            case "25428-4":
                lookupDictionary = glucoseDictionary;
                break;

            case "44966-0":
                lookupDictionary = edemaDictionary;
                break;

            case "38208-5":
                lookupDictionary = painDictionary;
                break;
            }

            if (lookupDictionary != null)
            {
                if (lookupDictionary.ContainsKey(observation.Value))
                {
                    valueCode = lookupDictionary[observation.Value];
                }
            }

            if (!string.IsNullOrWhiteSpace(valueCode))
            {
                if (valueCode.Contains("-"))
                {
                    returnCode = new CdaCode()
                    {
                        CodeSystem = CodingSystem.Loinc, Code = valueCode, DisplayName = observation.Value
                    }
                }
            }
            ;
Exemplo n.º 5
0
        /// <summary>
        /// Create the component to add to the document
        /// </summary>
        /// <returns></returns>
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            if ((string.IsNullOrWhiteSpace(this.Narrative)) && (this.MenstrualHistoryObservations.Count == 0))
            {
                this.Narrative = "(No Data)";
            }

            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            // *** And entries ***
            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            // *** Create an entry ***
            POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

            // *** Create menstrual history organizer ***
            POCD_MT000040Organizer organizer = new POCD_MT000040Organizer();

            // *** Set the organizer attributes ***
            //organizer.classCode = x_ActClassDocumentEntryOrganizer.CLUSTER;
            organizer.moodCode   = "EVN";
            organizer.statusCode = new CS()
            {
                code = "active"
            };

            // *** Menstrual History Organizer Code ***
            CdaCode orgCode = new CdaCode()
            {
                Code = "49033-4", CodeSystem = CodingSystem.Loinc, DisplayName = "Menstrual History"
            };

            organizer.code = orgCode.ToCD();

            // *** Create a list of components for the observations ***
            List <POCD_MT000040Component4> componentList = new List <POCD_MT000040Component4>();

            foreach (var item in this.MenstrualHistoryObservations)
            {
                // *** Create a component ***
                POCD_MT000040Component4 component = new POCD_MT000040Component4();

                // *** Add observation to component ***
                component.Item = item.ToPocd();

                // *** Add component to list ***
                componentList.Add(component);
            }

            // *** Add component array to organizer ***
            organizer.component = componentList.ToArray();

            // *** Add organizer to entry ***
            newEntry.Item = organizer;

            // *** Add entry to the list ***
            entryList.Add(newEntry);

            // *** Add entry list to section ***
            returnVal.section.entry = entryList.ToArray();

            return(returnVal);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create the component to add to the document
        /// </summary>
        /// <returns></returns>
        public override POCD_MT000040Component5 ToPocdComponent5()
        {
            if (this.Observations.Count == 0)
            {
                this.Narrative = "(No Data)";
            }

            POCD_MT000040Component5 returnVal = base.ToPocdComponent5();

            // *** Check if we have entries ***
            if (this.Observations.Count > 0)
            {
                // *** And entries ***
                List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

                // *** Create an entry ***
                POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

                // *** Create vital signs organizer ***
                POCD_MT000040Organizer organizer = new POCD_MT000040Organizer();

                // *** Set the organizer attributes ***
                organizer.classCode = x_ActClassDocumentEntryOrganizer.CLUSTER;
                organizer.moodCode  = "EVN";

                // *** Template Id's ***
                CdaTemplateIdList orgIds = new CdaTemplateIdList("2.16.840.1.113883.10.20.1.32", "2.16.840.1.113883.10.20.1.35", "1.3.6.1.4.1.19376.1.5.3.1.4.13.1");
                organizer.templateId = orgIds.ToPocd();

                // *** Vital Signs Organizer Code ***
                CdaCode orgCode = new CdaCode()
                {
                    Code = "46680005", CodeSystem = CodingSystem.SnomedCT, DisplayName = "Vital Signs"
                };
                organizer.code = orgCode.ToCD();

                // *** Organizer shall have id ***
                organizer.id = new II[] { new II()
                                          {
                                              root = Guid.NewGuid().ToString()
                                          } };

                organizer.statusCode = new CS()
                {
                    code = "completed"
                };

                // *** Note: Using first observation's date/time ***

                // *** Effective Time of observations ***
                organizer.effectiveTime = this.Observations[0].EffectiveTime.ToIvlTs();

                // *** Create a list of components for the observations ***
                List <POCD_MT000040Component4> componentList = new List <POCD_MT000040Component4>();

                foreach (var item in this.Observations)
                {
                    // *** Create a component ***
                    POCD_MT000040Component4 component = new POCD_MT000040Component4();

                    // *** Add observation to component ***
                    component.Item = item.ToPocd();

                    // *** Add component to list ***
                    componentList.Add(component);
                }

                // *** Add component array to organizer ***
                organizer.component = componentList.ToArray();

                // *** Add organizer to entry ***
                newEntry.Item = organizer;

                // *** Add entry to the list ***
                entryList.Add(newEntry);

                // *** Add entry list to section ***
                returnVal.section.entry = entryList.ToArray();
            }

            return(returnVal);
        }