/// <summary> /// Ctor for required elements /// </summary> public PLClinicalDocument(II id, CE <string> code, TS effectiveTime, CE <x_BasicConfidentialityKind> confidentialityCode, RecordTarget recordTarget, Author author, Custodian custodian, Component2 component) : base(id, code, effectiveTime, confidentialityCode, recordTarget, author, custodian, component) { this.PertinentInformation = new List <PertinentInformation>(); }
/// <summary> /// Ctor for all elements /// </summary> public PLClinicalDocument(II id, CE <string> code, ST title, TS effectiveTime, CE <x_BasicConfidentialityKind> confidentialityCode, CS <string> languageCode, II setId, INT versionNumber, TS copyTime, RecordTarget recordTarget, Author author, DataEnterer dataEnterer, Informant12 informant, Custodian custodian, InformationRecipient informationRecipient, LegalAuthenticator legalAuthenticator, Authenticator authenticator, Participant1 participant, InFulfillmentOf inFulfillmentOf, DocumentationOf documentationOf, RelatedDocument relatedDocument, Authorization authorization, Component1 componentOf, Component2 component) : base(id, code, title, effectiveTime, confidentialityCode, languageCode, setId, versionNumber, copyTime, recordTarget, author, dataEnterer, informant, custodian, informationRecipient, legalAuthenticator, authenticator, participant, inFulfillmentOf, documentationOf, relatedDocument, authorization, componentOf, component) { this.PertinentInformation = new List <PertinentInformation>(); }
private static ClinicalDocument CreateCDA(LIST <II> templateIds, CE <String> code, ST title, TS docDate, PatientData recordTarget, PatientData motherOfRCT, PatientData fatherOfRCT, PhysicianData author, params Section[] sections) { // First, we need to create a clinical document ClinicalDocument doc = new ClinicalDocument() { TemplateId = templateIds, // Identifiers Id = Guid.NewGuid(), // A unique id for the document Code = code, // The code for the document Title = title, // TypeId = new II("2.16.840.1.113883.1.3", "POCD_HD000040"), // This value is static and identifies the HL7 type RealmCode = SET <CS <BindingRealm> > .CreateSET(BindingRealm.UniversalRealmOrContextUsedInEveryInstance), // This is UV some profiles require US EffectiveTime = docDate, ConfidentialityCode = x_BasicConfidentialityKind.Normal, // Confidentiality of data within the CDA LanguageCode = "en-US", // Language of the CDA }; // Next we need to append the RecordTarget to the CDA RecordTarget rctPatient = new RecordTarget() { ContextControlCode = ContextControl.OverridingPropagating, PatientRole = new PatientRole() { Id = CreateIdList(recordTarget.OtherIds), // These are "other MRNs" we know about in the CDA Addr = SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, recordTarget.Address, null, recordTarget.City, recordTarget.State, "CA", null)), // We create the address from parts Patient = new Patient() { Name = SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, recordTarget.FamilyName, recordTarget.GivenName)), // PAtient name AdministrativeGenderCode = recordTarget.Gender, // GEnder BirthTime = new TS(recordTarget.DateOfBirth, DatePrecision.Day) // Day of birth } } }; // WE also need to add our local identifier (example: from our database/MRN) to the CDA // You will need to use your own OID rctPatient.PatientRole.Id.Add(new II("1.2.3.4.5.6", recordTarget.Id)); doc.RecordTarget.Add(rctPatient); // We now want to create an author Author docAuthor = new Author() { ContextControlCode = ContextControl.AdditivePropagating, Time = docDate, // When the document was created AssignedAuthor = new AssignedAuthor() { Id = SET <II> .CreateSET(new II("1.2.3.4.5.6.1", author.PhysicianId)), // Physician's identifiers (or how we know the physician) Addr = new SET <AD>() { AD.FromSimpleAddress(PostalAddressUse.PhysicalVisit, author.AddressLine, null, author.City, "ON", "CA", author.Postal) }, // The author's address AssignedAuthorChoice = AuthorChoice.CreatePerson( SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, author.PhysicianName[0], author.PhysicianName[1])) // The author's name ), RepresentedOrganization = new Organization() { Id = new SET <II>(new II("1.2.3.4.5.6.2", author.OrgId)), // Organization the physician represents Name = SET <ON> .CreateSET(new ON(null, new ENXP[] { new ENXP(author.OrgName[0]) })) // The name of the organization } } }; doc.Author.Add(docAuthor); // The document custodian is the source of truth for the document, i.e. the organization // that is responsible for storing/maintaining the document. Custodian docCustodian = new Custodian( new AssignedCustodian( new CustodianOrganization( SET <II> .CreateSET(new II("2.3.4.5.6.7", "304930-3")), new ON(null, new ENXP[] { new ENXP("ACME Medical Centres") }), null, AD.FromSimpleAddress(PostalAddressUse.PhysicalVisit, "123 Main St.", null, "Hamilton", "ON", "CA", "L0R2A0") ) ) ); doc.Custodian = docCustodian; // If the "mother" of the patient is provided, let's add the mother's data if (motherOfRCT != null) { doc.Participant.Add(new Participant1(ParticipationType.IND, ContextControl.OverridingNonpropagating, null, new IVL <TS>(new TS(recordTarget.DateOfBirth, DatePrecision.Year)), null) { AssociatedEntity = new AssociatedEntity(RoleClassAssociative.NextOfKin, CreateIdList(motherOfRCT.OtherIds), new CE <string>("MTH", "2.16.840.1.113883.5.111", null, null, "Mother", null), SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, motherOfRCT.Address, null, motherOfRCT.City, motherOfRCT.State, "CA", null)), SET <TEL> .CreateSET(new TEL() { NullFlavor = NullFlavor.NoInformation }), new Person(SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, motherOfRCT.FamilyName, motherOfRCT.GivenName))), null) }); } if (fatherOfRCT != null) { doc.Participant.Add(new Participant1(ParticipationType.IND, ContextControl.OverridingNonpropagating, null, new IVL <TS>(new TS(recordTarget.DateOfBirth, DatePrecision.Year)), null) { AssociatedEntity = new AssociatedEntity(RoleClassAssociative.NextOfKin, CreateIdList(fatherOfRCT.OtherIds), new CE <string>("FTH", "2.16.840.1.113883.5.111", null, null, "Father", null), SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, fatherOfRCT.Address, null, fatherOfRCT.City, fatherOfRCT.State, "CA", null)), SET <TEL> .CreateSET(new TEL() { NullFlavor = NullFlavor.NoInformation }), new Person(SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, fatherOfRCT.FamilyName, fatherOfRCT.GivenName))), null) }); } // Next we want to setup the body of the document doc.Component = new Component2( ActRelationshipHasComponent.HasComponent, true, new StructuredBody() // This document will be structured document ); // Now we add the sections passed to us foreach (var sct in sections) { doc.Component.GetBodyChoiceIfStructuredBody().Component.Add(new Component3( ActRelationshipHasComponent.HasComponent, true, sct)); } return(doc); }