Пример #1
0
        public RawApeDocument ToRawDocument()
        {
            RawApeDocument returnDoc = new RawApeDocument();

            // *** Get base type ***
            POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument;

            // *** Populate from base ***
            arg = this.AddRawDocumentData(arg);

            // *** This is the list of body sections
            List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>();

            // *** After all sections are added, add as array ***
            POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody;

            // *** Add existing ***
            components.AddRange(body.component);

            // *** Add patient education ***
            POCD_MT000040Component3 patientEducation = this.PatientEducationSection.ToPocdComponent();

            if (patientEducation != null)
            {
                components.Add(patientEducation);
            }

            body.component = components.ToArray();
            return(returnDoc);
        }
Пример #2
0
        public RawAplDocument ToRawDocument()
        {
            RawAplDocument returnDoc = new RawAplDocument();

            // *** Get base type ***
            POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument;

            // *** Populate from base ***
            arg = this.AddRawDocumentData(arg);

            // *** This is the list of body sections
            List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>();

            // *** After all sections are added, add as array ***
            POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody;

            // *** Add existing ***
            components.AddRange(body.component);

            // *** Add lab results ***
            foreach (var section in this.Sections)
            {
                POCD_MT000040Component3 labResults = section.ToPocdComponent();
                if (labResults != null)
                {
                    components.Add(labResults);
                }
            }

            body.component = components.ToArray();
            return(returnDoc);
        }
Пример #3
0
        private List <POCD_MT000040Observation> ExtractObservationsFromSection(string sectionCode)
        {
            // *** Extract section observations from the document ***

            List <POCD_MT000040Observation> returnList = new List <POCD_MT000040Observation>();

            if (this.Initialize())
            {
                // *** Check if we have something to work with ***
                if (this.PocdDocument != null)
                {
                    if (this.PocdDocument.component != null)
                    {
                        if (this.PocdDocument.component.Item is POCD_MT000040StructuredBody)
                        {
                            POCD_MT000040StructuredBody body = this.PocdDocument.component.Item as POCD_MT000040StructuredBody;

                            if (body.component != null)
                            {
                                if (body.component.Length > 0)
                                {
                                    foreach (var item in body.component)
                                    {
                                        if (item.section != null)
                                        {
                                            if (item.section.code != null)
                                            {
                                                if (item.section.code.code == sectionCode)
                                                {
                                                    if (item.section.entry != null)
                                                    {
                                                        foreach (var entry in item.section.entry)
                                                        {
                                                            if (entry.Item != null)
                                                            {
                                                                if (entry.Item is POCD_MT000040Observation)
                                                                {
                                                                    POCD_MT000040Observation pocdObs = entry.Item as POCD_MT000040Observation;
                                                                    returnList.Add(pocdObs);

                                                                    List <POCD_MT000040Observation> tempList = this.GetSupportingObservationsFromSection(pocdObs);
                                                                    returnList.AddRange(tempList);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(returnList);
        }
Пример #4
0
        //internal List<POCD_MT000040Procedure> ExtractEducationProcedures()
        //{
        //    List<POCD_MT000040Procedure> returnList = new List<POCD_MT000040Procedure>();

        //    if (this.DocumentType == IheDocumentType.APE)
        //        returnList = this.ExtractEducationItems();

        //    return returnList;
        //}

        private List <POCD_MT000040Procedure> ExtractEducationProcedures()
        {
            List <POCD_MT000040Procedure> returnList = new List <POCD_MT000040Procedure>();

            // *** Extract section procedures from the document ***

            string sectionCode = "34895-3";

            if (this.Initialize())
            {
                // *** Check if we have something to work with ***
                if (this.PocdDocument != null)
                {
                    if (this.PocdDocument.component != null)
                    {
                        if (this.PocdDocument.component.Item is POCD_MT000040StructuredBody)
                        {
                            POCD_MT000040StructuredBody body = this.PocdDocument.component.Item as POCD_MT000040StructuredBody;

                            if (body.component != null)
                            {
                                if (body.component.Length > 0)
                                {
                                    foreach (var item in body.component)
                                    {
                                        if (item.section != null)
                                        {
                                            if (item.section.code != null)
                                            {
                                                if (item.section.code.code == sectionCode)
                                                {
                                                    if (item.section.entry != null)
                                                    {
                                                        foreach (var entry in item.section.entry)
                                                        {
                                                            if (entry.Item != null)
                                                            {
                                                                if (entry.Item is POCD_MT000040Procedure)
                                                                {
                                                                    POCD_MT000040Procedure pocdProc = entry.Item as POCD_MT000040Procedure;
                                                                    returnList.Add(pocdProc);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(returnList);
        }
Пример #5
0
        /// MDHT operation: returns all sections
        public List <POCD_MT000040Section> getAllSections(POCD_MT000040ClinicalDocument clinicalDocument)
        {
            List <POCD_MT000040Section> allSections = new List <POCD_MT000040Section>();
            POCD_MT000040Component2     component2  = clinicalDocument.component;

            if (component2 != null)
            {
                POCD_MT000040StructuredBody structuredBody = component2.structuredBody;
                if (structuredBody != null)
                {
                    foreach (POCD_MT000040Component3 component3 in structuredBody.component)
                    {
                        POCD_MT000040Section section = component3.section;
                        if (section != null)
                        {
                            allSections.AddRange(getSections(section));
                        }
                    }
                }
            }
            return(allSections);
        }
Пример #6
0
        public RawApsDocument ToRawDocument()
        {
            RawApsDocument returnDoc = new RawApsDocument();

            // *** Get base type ***
            POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument;

            // *** Populate from base ***
            arg = this.AddRawDocumentData(arg);

            // *** This is the list of body sections
            List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>();

            // *** After all sections are added, add as array ***
            POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody;

            // *** Add existing ***
            components.AddRange(body.component);

            // *** Add advance directive ***
            POCD_MT000040Component3 advanceDirective = this.AdvanceDirectiveSection.ToPocdComponent();

            if (advanceDirective != null)
            {
                components.Add(advanceDirective);
            }

            // *** Add care plan ***
            POCD_MT000040Component3 carePlan = this.CarePlanSection.ToPocdComponent();

            if (carePlan != null)
            {
                components.Add(carePlan);
            }

            // *** Add problems ***
            POCD_MT000040Component3 problems = this.ProblemsSection.ToPocdComponent();

            if (problems != null)
            {
                components.Add(problems);
            }

            // *** Add medications ***
            POCD_MT000040Component3 meds = this.MedicationsSection.ToPocdComponent();

            if (meds != null)
            {
                components.Add(meds);
            }

            // *** Add edd ***
            POCD_MT000040Component3 edd = this.EstimatedDeliveryDatesSection.ToPocdComponent();

            if (edd != null)
            {
                components.Add(edd);
            }

            // *** Add antepartum visit summary ***
            POCD_MT000040Component3 visit = this.AntepartumVisitSummarySection.ToPocdComponent();

            if (visit != null)
            {
                components.Add(visit);
            }

            body.component = components.ToArray();
            return(returnDoc);
        }
Пример #7
0
        public RawAphpDocument ToRawDocument()
        {
            // *** Converts this object to a raw APHP document ***

            RawAphpDocument returnDoc = new RawAphpDocument();

            // *** Get base type ***
            POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument;

            // *** Populate from base ***
            arg = this.AddRawDocumentData(arg);

            // *** This is the list of body sections
            List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>();

            // *** After all sections are added, add as array ***
            POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody;

            // *** Add existing ***
            components.AddRange(body.component);

            // *** Add chief complaint ***
            POCD_MT000040Component3 chiefComplaint = this.ChiefComplaint.ToPocdComponent();

            if (chiefComplaint != null)
            {
                components.Add(chiefComplaint);
            }

            // *** Add history of present illness ***
            POCD_MT000040Component3 presentIllness = this.HistoryOfPresentIllness.ToPocdComponent();

            if (presentIllness != null)
            {
                components.Add(presentIllness);
            }

            // *** Add history of past illness ***
            POCD_MT000040Component3 pastIllness = this.HistoryOfPastIllness.ToPocdComponent();

            if (presentIllness != null)
            {
                components.Add(pastIllness);
            }

            // *** Add coded history of infection ***
            POCD_MT000040Component3 infection = this.CodedHistoryOfInfection.ToPocdComponent();

            if (infection != null)
            {
                components.Add(infection);
            }

            // *** Add pregnancy history ***
            POCD_MT000040Component3 pregHist = this.PregnancyHistorySection.ToPocdComponent();

            if (pregHist != null)
            {
                components.Add(pregHist);
            }

            // *** Add coded social history ***
            POCD_MT000040Component3 socialHistory = this.SocialHistory.ToPocdComponent();

            if (socialHistory != null)
            {
                components.Add(socialHistory);
            }

            // *** Add coded family medical history ***
            POCD_MT000040Component3 familyMedicalHistory = this.FamilyMedicalHistory.ToPocdComponent();

            if (familyMedicalHistory != null)
            {
                components.Add(familyMedicalHistory);
            }

            // *** Add review of systems ***
            POCD_MT000040Component3 reviewOfSystems = this.ReviewOfSystems.ToPocdComponent();

            if (reviewOfSystems != null)
            {
                components.Add(reviewOfSystems);
            }

            // *** Add coded physical exam ***
            POCD_MT000040Component3 physicalExam = this.PhysicalExam.ToPocdComponent();

            if (physicalExam != null)
            {
                components.Add(physicalExam);
            }

            body.component = components.ToArray();

            return(returnDoc);
        }
Пример #8
0
        public RawPpvsDocument ToRawDocument()
        {
            RawPpvsDocument returnDoc = new RawPpvsDocument();

            // *** Get base type ***
            POCD_MT000040ClinicalDocument arg = returnDoc as POCD_MT000040ClinicalDocument;

            // *** Populate from base ***
            arg = this.AddRawDocumentData(arg);

            // *** This is the list of body sections
            List <POCD_MT000040Component3> components = new List <POCD_MT000040Component3>();

            // *** After all sections are added, add as array ***
            POCD_MT000040StructuredBody body = arg.component.Item as POCD_MT000040StructuredBody;

            // *** Add existing ***
            components.AddRange(body.component);

            // *** Add Labor & Delivery Events ***
            POCD_MT000040Component3 laborDelivery = this.LaborDeliveryEvents.ToPocdComponent();

            if (laborDelivery != null)
            {
                components.Add(laborDelivery);
            }

            // *** Add PP Hosp Tx ***
            POCD_MT000040Component3 ppHospTx = this.PostpartumHospitalizationTreatment.ToPocdComponent();

            if (ppHospTx != null)
            {
                components.Add(ppHospTx);
            }

            // *** Add care plan ***
            POCD_MT000040Component3 carePlan = this.CarePlanSection.ToPocdComponent();

            if (carePlan != null)
            {
                components.Add(carePlan);
            }

            // *** Add problems ***
            POCD_MT000040Component3 problems = this.ProblemsSection.ToPocdComponent();

            if (problems != null)
            {
                components.Add(problems);
            }

            // *** Add history of present illness ***
            POCD_MT000040Component3 presentIllness = this.HistoryOfPresentIllness.ToPocdComponent();

            if (presentIllness != null)
            {
                components.Add(presentIllness);
            }

            // *** Add coded social history ***
            POCD_MT000040Component3 socialHistory = this.SocialHistory.ToPocdComponent();

            if (socialHistory != null)
            {
                components.Add(socialHistory);
            }

            // *** Add coded physical exam ***
            POCD_MT000040Component3 physicalExam = this.PhysicalExam.ToPocdComponent();

            if (physicalExam != null)
            {
                components.Add(physicalExam);
            }

            // *** Add medications ***
            POCD_MT000040Component3 meds = this.MedicationsSection.ToPocdComponent();

            if (meds != null)
            {
                components.Add(meds);
            }

            // *** Add Newborn Status ***
            if (this.NewbornStatusSections.Count > 0)
            {
                foreach (var item in this.NewbornStatusSections.Values)
                {
                    POCD_MT000040Component3 stat = item.ToPocdComponent();
                    components.Add(stat);
                }
            }

            // *** Add Newborn Delivery Info ***
            if (this.NewbornDeliveryInfoSections.Count > 0)
            {
                foreach (var item in this.NewbornDeliveryInfoSections.Values)
                {
                    POCD_MT000040Component3 stat = item.ToPocdComponent();
                    components.Add(stat);
                }
            }

            // *** Add Newborn Care Plan ***
            if (this.NewbornCarePlanSections.Count > 0)
            {
                foreach (var item in this.NewbornCarePlanSections.Values)
                {
                    POCD_MT000040Component3 stat = item.ToPocdComponent();
                    components.Add(stat);
                }
            }

            body.component = components.ToArray();
            return(returnDoc);
        }
Пример #9
0
        //public abstract string ToCdaXml();

        protected POCD_MT000040ClinicalDocument AddRawDocumentData(POCD_MT000040ClinicalDocument rawDoc)
        {
            // *** Set the realm to US ***
            //rawDoc.realmCode = new List<CS>();
            //rawDoc.realmCode.Add(new CS() { code = "US" });

            // *** All documents will have this type ***
            rawDoc.typeId = new POCD_MT000040InfrastructureRoottypeId()
            {
                root = "2.16.840.1.113883.1.3", extension = "POCD_HD000040"
            };

            // *** Date/Time of Creation ***
            //<effectiveTime value='20000407130000+0500'/>
            rawDoc.effectiveTime = new TS()
            {
                value = DateTime.Now.ToString(RawCdaDocument.CdaDateFormat)
            };

            // *** Confidentiality ***
            //<confidentialityCode code='N' codeSystem='2.16.840.1.113883.5.25'/>
            rawDoc.confidentialityCode = new CE()
            {
                code = "N", codeSystem = "2.16.840.1.113883.5.25"
            };

            // *** Language ***
            //<languageCode code='en-US'/>
            rawDoc.languageCode = new CS()
            {
                code = "en-US"
            };

            // *** Set id ***
            rawDoc.id = new II()
            {
                root = this.DocumentId
            };

            // *** Record Target ***
            POCD_MT000040RecordTarget rt = this.RecordTarget.ToPocdRecordTarget();

            rawDoc.recordTarget = new POCD_MT000040RecordTarget[] { rt };

            // *** Information Recipient ***
            rawDoc.informationRecipient = this.Recipient.ToPocdRecipient();

            // *** Participants ***
            rawDoc.participant = this.Participants.ToPocdParticpantArray();

            // *** Authors ***
            List <POCD_MT000040Author> authorList = new List <POCD_MT000040Author>();

            // *** Device Author ***
            if (!this.DeviceAuthor.IsEmpty)
            {
                POCD_MT000040Author pocdDevAuthor = this.DeviceAuthor.ToPocdAuthor();
                authorList.Add(pocdDevAuthor);
            }

            // *** Author - Current User ***
            POCD_MT000040Author pocdAuthor = this.Author.ToPocdAuthor();

            authorList.Add(pocdAuthor);

            rawDoc.author = authorList.ToArray();

            // *** Custodian ***
            rawDoc.custodian = this.Custodian.ToPocdCustodian();

            // *** Documentation Of ***
            rawDoc.documentationOf = new POCD_MT000040DocumentationOf[] { this.DocumentationOf.ToPocdDocumentationOf() };

            // *** Document Body ***
            rawDoc.component = new POCD_MT000040Component2();
            POCD_MT000040StructuredBody body = new POCD_MT000040StructuredBody();

            // *** Create list of component/sections ***
            List <POCD_MT000040Component3> componentList = new List <POCD_MT000040Component3>();

            // *** Add allergy section ***
            POCD_MT000040Component3 allergySection = this.Allergies.ToPocdComponent();

            if (allergySection != null)
            {
                componentList.Add(allergySection);
            }

            // TODO: Add additional sections here...

            // *** Add the sections/component to body ***
            body.component = componentList.ToArray();

            // *** Add body ***
            rawDoc.component.Item = body;

            return(rawDoc);
        }
Пример #10
0
        private List <CdaObservationModel> ExtractBabyObservationsFromNds()
        {
            // *** Extract section observations from the document ***

            List <CdaObservationModel> returnList = new List <CdaObservationModel>();
            int babyNumber = 0;

            if (this.Initialize())
            {
                // *** Check if we have something to work with ***
                if (this.PocdDocument != null)
                {
                    if (this.PocdDocument.component != null)
                    {
                        if (this.PocdDocument.component.Item is POCD_MT000040StructuredBody)
                        {
                            POCD_MT000040StructuredBody body = this.PocdDocument.component.Item as POCD_MT000040StructuredBody;

                            if (body.component != null)
                            {
                                if (body.component.Length > 0)
                                {
                                    foreach (var item in body.component)
                                    {
                                        if (item.section != null)
                                        {
                                            if (item.section.code != null)
                                            {
                                                if (item.section.code.code == "57075-4")
                                                {
                                                    if (item.section.component != null)
                                                    {
                                                        foreach (var comp in item.section.component)
                                                        {
                                                            if (comp.section != null)
                                                            {
                                                                if (comp.section.code.code == "10210-3")
                                                                {
                                                                    if (comp.section.entry != null)
                                                                    {
                                                                        ++babyNumber;

                                                                        List <POCD_MT000040Observation> pocdList = new List <POCD_MT000040Observation>();

                                                                        foreach (var entry in comp.section.entry)
                                                                        {
                                                                            if (entry.Item != null)
                                                                            {
                                                                                if (entry.Item is POCD_MT000040Observation)
                                                                                {
                                                                                    POCD_MT000040Observation pocdObs = entry.Item as POCD_MT000040Observation;
                                                                                    pocdList.Add(pocdObs);

                                                                                    List <POCD_MT000040Observation> tempList = this.GetSupportingObservationsFromSection(pocdObs);
                                                                                    pocdList.AddRange(tempList);
                                                                                }
                                                                            }
                                                                        }

                                                                        foreach (var pocdObs in pocdList)
                                                                        {
                                                                            // *** Create a simple observation ***
                                                                            CdaSimpleObservation cdaObs = CdaObservationFactory.CreateObservation(pocdObs);

                                                                            // *** Convert to model + add to return ***
                                                                            if ((cdaObs != null) && (cdaObs.Code != null))
                                                                            {
                                                                                CdaObservationModel tempObs = CdaObservationModel.Create(cdaObs);
                                                                                tempObs.BabyNumber = babyNumber;
                                                                                returnList.Add(tempObs);
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(returnList);
        }