Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            if (this.Observations.Count == 0)
            {
                this.Narrative = "(No Data)";
            }

            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            foreach (CdaSimpleObservation obs in this.Observations)
            {
                // *** Create an entry ***
                POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

                // *** Create observation ***
                newEntry.Item = obs.ToPocd();

                entryList.Add(newEntry);
            }

            returnVal.section.entry = entryList.ToArray();

            return(returnVal);
        }
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

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

            ////// *** Create observation ***
            //newEntry.Item = this.PhysicalExam.ToPocdComponent();

            ////returnVal.section.entry

            //List<POCD_MT000040Component5> compList = new List<POCD_MT000040Component5>();

            //POCD_MT000040Component5 comp = this.PhysicalExam.ToPocdComponent5();

            //comp.section.entry = new POCD_MT000040Entry[] { newEntry };

            //compList.Add(comp);

            List <POCD_MT000040Component5> compList = new List <POCD_MT000040Component5>();

            compList.Add(this.ProceduresInterventions.ToPocdComponent5());
            compList.AddRange(this.PhysicalExam.ToPocdComponentArray());

            returnVal.section.component = compList.ToArray();

            return(returnVal);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            if (string.IsNullOrWhiteSpace(this.Narrative))
            {
                this.Narrative = "(No Data)";
            }

            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            return(returnVal);
        }
Exemplo n.º 6
0
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            List <POCD_MT000040Component5> componentList = new List <POCD_MT000040Component5>();

            componentList.Add(this.ProceduresInterventionsSection.ToPocdComponent5());
            componentList.Add(this.DischargeDietSection.ToPocdComponent5());

            returnVal.section.component = componentList.ToArray();

            return(returnVal);
        }
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            if (this.EstimatedDeliveryDate == null)
            {
                this.Narrative = "(No Data)";
            }

            returnVal.section.entry         = new POCD_MT000040Entry[1];
            returnVal.section.entry[0]      = new POCD_MT000040Entry();
            returnVal.section.entry[0].Item = this.EstimatedDeliveryDate.ToPocd();

            return(returnVal);
        }
        //<section classCode="DOCSECT">
        //  <templateId root="1.3.6.1.4.1.19376.1.3.3.2.1"/>
        //  <!-- Example Specialty Section that holds Report Items directly as a Laboratory Report Data Processing Entry-->
        //  <code code="18719-5" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="CHEMISTRY STUDIES"/>
        //  <title>Laboratory Chemistry Results</title>
        //  <text><table>...</table></text>
        //  <entry typeCode="DRIV">
        //      <templateId root="1.3.6.1.4.1.19376.1.3"/>
        //      <act classCode="ACT" moodCode="EVN">
        //          ...
        //      </act>
        //  </entry>
        //</section>

        public virtual POCD_MT000040Component3 ToPocdComponent()
        {
            // *** Creates the basic section ***

            POCD_MT000040Component3 returnVal = new POCD_MT000040Component3();

            returnVal.section = new POCD_MT000040Section();

            // *** Template ID ***
            returnVal.section.templateId = this.TemplateIds.ToPocd();

            // *** Make sure section has an unique ID ***
            returnVal.section.id = new II {
                root = Guid.NewGuid().ToString()
            };

            // *** Code ***
            returnVal.section.code = this.Code.ToCE();

            // *** Title ***
            returnVal.section.title = new ST()
            {
                Text = new string[] { this.SectionTitle }
            };

            // *** Then add the text ***
            returnVal.section.text = this.GetSectionText();

            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            // *** Entries ***
            foreach (var item in this.LabObservations)
            {
                // *** Create an entry ***
                POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

                // *** Create observation ***
                newEntry.Item = item.ToPocd();

                entryList.Add(newEntry);
            }

            returnVal.section.entry = entryList.ToArray();

            return(returnVal);
        }
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            //if (this.Observations.Count == 0)
            //    this.Narrative = "(No Data)";

            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            if (this.PrepregnancyWeight != null)
            {
                // *** Create an entry ***
                POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

                // *** Create observation ***
                newEntry.Item = this.PrepregnancyWeight.ToPocd();

                entryList.Add(newEntry);
            }

            // *** Create battery ***

            //foreach (CdaBoolObservation obs in this.Observations)
            //{
            //    // *** Create an entry ***
            //    POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

            //    // *** Create observation ***
            //    newEntry.Item = obs.ToPocd();

            //    entryList.Add(newEntry);
            //}

            POCD_MT000040Entry orgEntry = this.Organizer.ToPocdOrganizerEntry();

            if (orgEntry != null)
            {
                entryList.Add(orgEntry);
            }

            returnVal.section.entry = entryList.ToArray();

            return(returnVal);
        }
Exemplo n.º 10
0
        // *** List of observations, matching the Antepartum History of Past Illness Value Set ***
        //public List<CdaProblemObservation> Observations { get; set; }

        //<component>
        //    <section>
        //        <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.8"/>
        //        <code code="11348-0" displayName="HISTORY OF PAST ILLNESS"
        //            codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
        //        <title>Resolved Problems</title>
        //        <text>None</text>
        //        <entry>
        //            <act classCode="ACT" moodCode="EVN">
        //                <!-- Required Problem Concern Entry element -->
        //                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5.2"/>
        //                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5.1"/>
        //                <templateId root="2.16.840.1.113883.10.20.1.27"/>
        //                <id/>
        //                <code nullFlavor="NA"/>
        //                <statusCode code="active"/>
        //                <effectiveTime>
        //                    <low value="20071011"/>
        //                    <!-- <high value="20071012"/> -->
        //                </effectiveTime>
        //                <entryRelationship typeCode="SUBJ" inversionInd="false">
        //                    <observation classCode="OBS" moodCode="EVN" negationInd="false">
        //                        <templateId root="2.16.840.1.113883.10.20.1.28"/>
        //                        <templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.5"/>
        //                        <id root="2.1.160"/>
        //                        <code code="64572001" codeSystem="2.16.840.1.113883.6.96"/>
        //                        <statusCode code="completed"/>
        //                        <effectiveTime>
        //                            <low nullFlavor="UNK"/>
        //                        </effectiveTime>
        //                        <text></text>
        //                        <value xsi:type="CD" code="thing" codeSystem="thing"
        //                            codeSystemName="myName" displayName="myName"/>
        //                    </observation>
        //                </entryRelationship>
        //            </act>
        //        </entry>
        //    </section>
        //</component>

        public override POCD_MT000040Component3 ToPocdComponent()
        {
            // *** Creates a CDA POCD component for inclusion in APHP document ***

            if ((string.IsNullOrWhiteSpace(this.Narrative)) && (this.Entries.Observations.Count == 0))
            {
                this.Narrative = "(No Data)";
            }

            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            // *** And entries ***
            List <POCD_MT000040Entry> entryList = this.Entries.ToPocdEntryList();

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

            return(returnVal);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Creates a POCD component 3
        /// </summary>
        /// <returns></returns>
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            List <POCD_MT000040Component5> componentList = new List <POCD_MT000040Component5>();

            // *** Create Vitals Subsection ***
            componentList.Add(this.VitalSigns.ToPocdComponent5());

            // *** Create Other Subsections ***
            foreach (string key in this.Subsections.Keys)
            {
                if ((!string.IsNullOrWhiteSpace(this.Subsections[key].Narrative)) ||
                    (this.Subsections[key].Observations.Count > 0))
                {
                    componentList.Add(this.Subsections[key].ToPocdComponent5());
                }
            }

            returnVal.section.component = componentList.ToArray();

            return(returnVal);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates a CDA component for use with adding into documents
        /// </summary>
        /// <returns>A CDA component</returns>
        public virtual POCD_MT000040Component3 ToPocdComponent()
        {
            // *** Creates the basic section ***

            POCD_MT000040Component3 returnVal = new POCD_MT000040Component3();

            returnVal.section = new POCD_MT000040Section();

            // *** Template ID ***
            returnVal.section.templateId = this.TemplateIds.ToPocd();

            // *** Make sure section has an unique ID ***
            returnVal.section.id = new II {
                root = Guid.NewGuid().ToString()
            };

            // *** Code ***
            returnVal.section.code = new CE()
            {
                code           = this.Code,
                displayName    = this.DisplayName,
                codeSystem     = this.CodeSystemId,
                codeSystemName = this.CodeSystemName
            };

            // *** Title ***
            returnVal.section.title = new ST()
            {
                Text = new string[] { this.SectionTitle }
            };

            // *** Then add the text ***
            returnVal.section.text = this.GetSectionText();

            return(returnVal);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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);
        }
        // *** Sample code from IHE PCC TF ***

        //<entry>
        //    <organizer classCode='CLUSTER' moodCode='EVN'>
        //        <templateId root='2.16.840.1.113883.10.20.1.23'/>
        //        <templateId root='1.3.6.1.4.1.19376.1.5.3.1.4.15'/>
        //        <subject typeCode='SBJ'>
        //            <relatedSubject classCode='PRS'>
        //            <code code='' displayName='' codeSystem='2.16.840.1.113883.5.111' codeSystemName='RoleCode'/>
        //            <subject>
        //                <sdtc:id root='' extension=''/>
        //                <administrativeGenderCode code='' displayName='' codeSystem='' codeSystemName=''/>
        //            </subject>
        //            </relatedSubject>
        //        </subject>
        //        <!-- zero or more participants linking to other relations -->
        //        <participant typeCode='IND'>
        //            <participantRole classCode='PRS'>
        //                <code code='' displayName='' codeSystem='2.16.840.1.113883.5.111' codeSystemName='RoleCode'/>
        //                <playingEntity classCode='PSN'>
        //                    <sdtc:id root='' extension=''/>
        //                </playingEntity>
        //            </participantRole>
        //        </participant>
        //        <!-- one or more entry relationships for family history observations -->
        //        <component typeCode='COMP'>
        //            <observation classCode='OBS' moodCode='EVN'>
        //                <templateId root='2.16.840.1.113883.10.20.1.22'/>
        //            </observation>
        //        </component>
        //    </organizer>
        //</entry>

        public override POCD_MT000040Component3 ToPocdComponent()
        {
            if (this.Observations.Count == 0)
            {
                this.Narrative = "(No Data)";
            }

            // *** Create the component ***
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            // *** There is one "organizer" per family member ***

            // *** Add the text ***
            //returnVal.section.text = this.GetSectionText();

            // *** Create list of entries ***
            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            // *** If we don't have anything ***
            if (this.UnknownObservation != null)
            {
                // *** Create an entry ***
                POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

                // *** Each entry has one organizer ***
                POCD_MT000040Organizer organizer = new POCD_MT000040Organizer();

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

                // *** Create the template ids ***
                CdaTemplateIdList ids = new CdaTemplateIdList("2.16.840.1.113883.10.20.1.23", "1.3.6.1.4.1.19376.1.5.3.1.4.15");
                organizer.templateId = ids.ToPocd();

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

                CdaSubject cdaSubject = new CdaSubject()
                {
                    FamilyMember = Hl7FamilyMember.FamilyMember
                };

                // *** Add the subject to the organizer ***
                organizer.subject = cdaSubject.ToPocdSubject();

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

                // *** Create a component ***
                POCD_MT000040Component4 component = new POCD_MT000040Component4();

                // *** Add observation to component ***
                component.Item = this.UnknownObservation.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);
            }
            else
            {
                // *** Loop through family members ***
                foreach (Hl7FamilyMember key in this.Observations.Keys)
                {
                    // *** Create an entry ***
                    POCD_MT000040Entry newEntry = new POCD_MT000040Entry();

                    // *** Each entry has one organizer ***
                    POCD_MT000040Organizer organizer = new POCD_MT000040Organizer();

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

                    // *** Create the template ids ***
                    CdaTemplateIdList ids = new CdaTemplateIdList("2.16.840.1.113883.10.20.1.23", "1.3.6.1.4.1.19376.1.5.3.1.4.15");
                    organizer.templateId = ids.ToPocd();

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

                    //// *** Create the subject ***
                    //POCD_MT000040Subject subject = new POCD_MT000040Subject() { typeCode = ParticipationTargetSubject.SBJ, typeCodeSpecified = true };

                    //// *** Create the related subject ***
                    //POCD_MT000040RelatedSubject relatedSubject = new POCD_MT000040RelatedSubject() { classCode = x_DocumentSubject.PRS };

                    //// *** Create the role and add as code ***
                    //CdaRoleCode roleCode = new CdaRoleCode() { FamilyMember = key };
                    //relatedSubject.code = roleCode.ToCe();

                    //// *** Add the related subject to the subject ***
                    //subject.relatedSubject = relatedSubject;

                    CdaSubject cdaSubject = new CdaSubject()
                    {
                        FamilyMember = key
                    };

                    // *** Add the subject to the organizer ***
                    organizer.subject = cdaSubject.ToPocdSubject();

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

                    // *** Loop through all observations for this family member ***
                    foreach (CdaCodeObservation obs in this.Observations[key])
                    {
                        // *** Create a component ***
                        POCD_MT000040Component4 component = new POCD_MT000040Component4();

                        // *** Add observation to component ***
                        component.Item = obs.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.º 16
0
        public POCD_MT000040Component3 ToPocdComponent()
        {
            // *** Converts this item to raw component ***

            POCD_MT000040Component3 returnVal = new POCD_MT000040Component3();

            if (this.Allergies.Count == 0)
            {
                returnVal = null;
            }
            else
            {
                // *** Add new section object ***
                returnVal.section = new POCD_MT000040Section();

                // *** Id ***
                returnVal.section.id = new II()
                {
                    root = Guid.NewGuid().ToString()
                };

                // *** Title ***
                returnVal.section.title = new ST()
                {
                    Text = new string[] { "Allergies" }
                };

                // *** Set section template ids ***
                returnVal.section.templateId = new II[] {
                    new II()
                    {
                        root = "2.16.840.1.113883.10.20.1.2"
                    },
                    new II()
                    {
                        root = "1.3.6.1.4.1.19376.1.5.3.1.3.13"
                    }
                };

                // *** Set section ID (Not needed currently) ***
                //returnVal.section.id = new II() { root = "", extension = "" };

                // *** Add code/system information ***
                returnVal.section.code = new CE()
                {
                    code           = "48765-2",
                    displayName    = "Allergies, adverse reactions, alerts",
                    codeSystem     = "2.16.840.1.113883.6.1",
                    codeSystemName = "LOINC"
                };

                returnVal.section.text = GetObservationTable(this.Allergies);

                List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

                foreach (CdaAllergy allergy in this.Allergies)
                {
                    entryList.Add(allergy.ToPocdEntry());
                }

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

            return(returnVal);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
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);
        }
        /// <summary>
        /// Creates a CDA component containing all required data
        /// </summary>
        /// <returns>A CDA component</returns>
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            // *** Converts this item to raw component ***

            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            // *** Create a list of entries ***
            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            // *** Loop through observations ***
            foreach (CdaSimpleObservation observation in this.Observations)
            {
                // *** Create an entry ***
                POCD_MT000040Entry tempEntry = new POCD_MT000040Entry();

                // *** Add a single pregnancy observation ***
                tempEntry.Item = observation.ToPocd();

                // *** Add entry to list ***
                entryList.Add(tempEntry);
            }

            // *** Add pregnancy status observation ***
            POCD_MT000040Entry pregEntry = new POCD_MT000040Entry();

            pregEntry.Item = this.PregnancyStatusObservation.ToPocd();
            entryList.Add(pregEntry);

            // *** Add bold to pregnancy status ***
            if (returnVal.section.text.Items != null)
            {
                if (returnVal.section.text.Items.Length > 0)
                {
                    if (returnVal.section.text.Items[0] is StrucDocParagraph)
                    {
                        StrucDocParagraph para = new StrucDocParagraph();

                        StrucDocContent cont = new StrucDocContent()
                        {
                            Text = new string[] { this.Narrative }
                        };
                        cont.styleCode = "Bold";

                        para.Items = new object[] { cont };

                        returnVal.section.text.Items[0] = para;
                    }
                }
            }

            // *** Add pregnancy organizers ***
            foreach (var pregOrg in this.PregnancyOrganizers.Values)
            {
                POCD_MT000040Entry pocdOrgEntry = pregOrg.ToPocdOrganizerEntry();
                if (pocdOrgEntry != null)
                {
                    entryList.Add(pocdOrgEntry);
                }
            }

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

            return(returnVal);
        }
Exemplo n.º 21
0
        public override POCD_MT000040Component3 ToPocdComponent()
        {
            POCD_MT000040Component3 returnVal = base.ToPocdComponent();

            // *** Skip unless we have a pediatrician name ***
            if (!string.IsNullOrWhiteSpace(this.PediatricianName))
            {
                // *** Create encounter containing pediatrician name ***
                POCD_MT000040Encounter enc = new POCD_MT000040Encounter();

                // *** Set Class, Mood ***
                enc.classCode = "ENC";
                enc.moodCode  = x_DocumentEncounterMood.PRP;

                // *** Set Template Ids ***
                CdaTemplateIdList templateIds = new CdaTemplateIdList("1.3.6.1.4.1.19376.1.5.3.1.4.14", "2.16.840.1.113883.10.20.1.21", "2.16.840.1.113883.10.20.1.25");
                enc.templateId = templateIds.ToPocd();

                // *** Add Id ***
                enc.id = new II[] { new II()
                                    {
                                        root = Guid.NewGuid().ToString()
                                    } };

                // *** Code ***
                enc.code = new CD()
                {
                    code = "Ambulatory", codeSystem = "2.16.840.1.113883.5.4", codeSystemName = "ActEncounterCode"
                };

                // *** Add name as performer ***
                CdaName cdaName = new CdaName()
                {
                    Last = this.PediatricianName
                };

                enc.performer = new POCD_MT000040Performer2[]
                {
                    new POCD_MT000040Performer2()
                    {
                        typeCode          = ParticipationPhysicalPerformer.PRF,
                        typeCodeSpecified = true,
                        assignedEntity    = new POCD_MT000040AssignedEntity()
                        {
                            assignedPerson = new POCD_MT000040Person()
                            {
                                name = new PN[]
                                {
                                    cdaName.ToPN()
                                }
                            }
                        }
                    }
                };

                // *** Add encounter to list of entries ***
                List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>(returnVal.section.entry);
                entryList.Add(new POCD_MT000040Entry()
                {
                    Item = enc
                });
                returnVal.section.entry = entryList.ToArray();

                // *** Add pediatrician to human-readable ***
                List <object> items = new List <object>(returnVal.section.text.Items);

                // *** Create a new paragraph ***
                StrucDocParagraph para = new StrucDocParagraph();
                para.Text = new[] { string.Format("Pediatrician: {0}", this.PediatricianName) };

                // *** Add it to list ***
                items.Add(para);

                // *** Add list to document ***
                returnVal.section.text.Items = items.ToArray();
            }

            return(returnVal);
        }