Пример #1
0
        public POCD_MT000040Procedure ToPocd()
        {
            POCD_MT000040Procedure returnVal = new POCD_MT000040Procedure();

//<procedure classCode='PROC' moodCode='EVN|INT'> 3880
//<templateId root='1.3.6.1.4.1.19376.1.5.3.1.4.19'/>
//<templateId root='2.16.840.1.113883.10.20.1.29'/><!-- see text of section 0 -->
//<templateId root='2.16.840.1.113883.10.20.1.25'/><!-- see text of section 0 -->
//<id root='' extension=''/>
//<code code='' codeSystem='2.16.840.1.113883.5.4' codeSystemName='ActCode' /> 3885
//<text><reference value='#xxx'/></text>
//<statusCode code='completed|active|aborted|cancelled'/>
//<effectiveTime>
//<low value=''/>
//<high value=''/> 3890
//</effectiveTime>
//<priorityCode code=''/>
//<approachSiteCode code='' displayName='' codeSystem='' codeSystemName=''/>
//<targetSiteCode code='' displayName='' codeSystem='' codeSystemName=''/>
//<author /> 3895
//<informant />
//<entryRelationship typeCode='COMP' inversionInd='true'>
//<act classCode='ACT' moodCode=''>
//<templateId root='1.3.6.1.4.1.19376.1.5.3.1.4.4.1'/>
//<id root='' extension=''/> 3900
//</act>
//</entryRelationship>
//<entryRelationship typeCode='RSON'>
//<act classCode='ACT' moodCode='EVN'>
//<templateId root='1.3.6.1.4.1.19376.1.5.3.1.4.4.1'/> 3905
//<id root='' extension=''/>
//</act>
//</entryRelationship>
//</procedure>

            returnVal.classCode = "PROC";

            CdaTemplateIdList templateIds = new CdaTemplateIdList(
                "1.3.6.1.4.1.19376.1.5.3.1.4.19",
                "2.16.840.1.113883.10.20.1.29"
                );

            returnVal.moodCode = x_DocumentProcedureMood.EVN;

            returnVal.templateId = templateIds.ToPocd();

            returnVal.id = new II[] { new II()
                                      {
                                          root = this.Id
                                      } };

            returnVal.code = this.Code.ToCE();

            returnVal.text = new ED()
            {
                reference = new TEL()
                {
                    value = string.Format("#{0}", this.ReferenceId)
                }
            };

            returnVal.statusCode = new CS()
            {
                code = "completed"
            };
            returnVal.effectiveTime = this.EffectiveTime.ToIvlTs();

            return(returnVal);
        }
        // *** 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);
        }
Пример #3
0
 /// <summary>
 /// Sets the template id's for this section
 /// </summary>
 /// <param name="list"></param>
 public void SetTemplateIds(params string[] list)
 {
     this.templateIds = new CdaTemplateIdList(list);
 }
Пример #4
0
        public List <POCD_MT000040Entry> ToPocdEntryList()
        {
            List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>();

            if (this.Observations != null)
            {
                foreach (CdaCodeObservation cdaObservation in this.Observations)
                {
                    // *** Create the entry ***
                    POCD_MT000040Entry tempEntry = new POCD_MT000040Entry();

                    // *** Create an act ***
                    POCD_MT000040Act act = new POCD_MT000040Act();

                    act.id = new II[] { new II {
                                            root = Guid.NewGuid().ToString()
                                        } };

                    act.classCode = x_ActClassDocumentEntryAct.ACT;
                    act.moodCode  = x_DocumentActMood.EVN;

                    // *** Add template ids for this act ***
                    CdaTemplateIdList templateIdList =
                        new CdaTemplateIdList(
                            "1.3.6.1.4.1.19376.1.5.3.1.4.5.2",
                            "1.3.6.1.4.1.19376.1.5.3.1.4.5.1",
                            "2.16.840.1.113883.10.20.1.27");

                    act.templateId = templateIdList.ToPocd();

                    // *** No code here ***
                    act.code = new CD()
                    {
                        nullFlavor = "NA"
                    };

                    // *** The concern is active, even though the problem itself may be resolved or inactive ***
                    act.statusCode = new CS()
                    {
                        code = "active"
                    };

                    // *** This concern uses the observation date/time ***
                    //CdaEffectiveTime effTime = new CdaEffectiveTime() { Low = cdaObservation.EffectiveTime };
                    //act.effectiveTime = effTime.ToIvlTs();
                    act.effectiveTime = cdaObservation.EffectiveTime.ToIvlTs();

                    // *** Create entry relationship ***
                    List <POCD_MT000040EntryRelationship> entryRelationships = new List <POCD_MT000040EntryRelationship>();

                    POCD_MT000040EntryRelationship tempEntryRelationship = new POCD_MT000040EntryRelationship();

                    tempEntryRelationship.typeCode              = x_ActRelationshipEntryRelationship.SUBJ;
                    tempEntryRelationship.inversionInd          = false;
                    tempEntryRelationship.inversionIndSpecified = true;

                    // *** Create pocd observation ***
                    POCD_MT000040Observation observation = cdaObservation.ToPocd();

                    // *** Add the observation to the entry relationship ***
                    tempEntryRelationship.Item = observation;

                    // *** Add the entry relationship to the list ***
                    entryRelationships.Add(tempEntryRelationship);

                    // *** Add entry relationships to the act ***
                    act.entryRelationship = entryRelationships.ToArray();

                    // *** Add act to entry ***
                    tempEntry.Item = act;

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

            return(entryList);
        }
Пример #5
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);
        }
Пример #6
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);
        }