private void FillLabResults(PatientClinicalInformation patientinfo, Factory hl7factory, III hl7III)
        {
            var arrptLabResults = patientinfo.ptLabResults;

            if (arrptLabResults.Count > 0)
            {
                list          = hl7factory.CreateStrucDocList();
                list.ListType = 0;
                //Creating List Object.
                int i = 0;
                foreach (var patientLabResult in arrptLabResults)
                {
                    string testresult = string.Empty;
                    if (!String.IsNullOrEmpty(patientLabResult.TestResultn))
                    {
                        testresult = patientLabResult.TestResultn;
                    }
                    ListWithItem("result" + (i + 1), patientLabResult.TestPerformed + " - " + testresult + " " + patientLabResult.Units, hl7III, hl7factory, list);
                    GenerateLabResultEntry(patientLabResult, (i + 1), hl7III, hl7factory);
                    i++;
                }
                functionalStatus.Section.Text.Items.Add(list);
                // Adding List to Text Tag.
            }
            else
            {
                paragraph = hl7factory.CreateStrucDocParagraph();
                paragraph.Items.Add("N/A");
                GenerateLabResultEntryEmpty(hl7III, hl7factory);
                functionalStatus.Section.Text.Items.Add(paragraph);
            }
        }
 private void FillFunctionalStatusContent(PatientClinicalInformation patientinfo, III hl7III, Factory hl7factory)
 {
     if (patientinfo.ptFunctionalStatus.Count > 0)
     {
         managetable = new GenerateTableBodyStructure();
         DataArr.Add("Functional Condition");
         DataArr.Add("Effective Dates");
         DataArr.Add("Condition Status");
         tble  = hl7factory.CreateStrucDocTable();
         thead = tble.Thead;
         tbody = tble.Tbody.Append();
         tr    = thead.Tr.Append();
         managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
         //ArrayList alleries = new ArrayList(patientinfo.ptAllergies.ptAllergies);
         int i = 0;
         foreach (var item in patientinfo.ptFunctionalStatus)
         {
             DataArr       = new ArrayList();
             content       = hl7factory.CreateStrucDocContent();
             content.XmlId = "functional" + (i + 1);
             content.Items.Add(item.Description);
             DataArr.Add(content);
             DataArr.Add(item.StatusDate.ToString());
             DataArr.Add("Active");
             managetable.CreateTableBody(DataArr, hl7factory, tble, tbody, tr);
             GenerateFunctionalStatusEntry(item, i, hl7III, hl7factory);
             i++;
         }
         functionalStatus.Section.Text.Items.Add(tble);
     }
     else
     {
         CreateFunctionalStatusEmptyEntry(hl7III, hl7factory);
     }
 }
        private void FillMedicationContent(PatientClinicalInformation patientinfo, Factory hl7factory, III hl7III)
        {
            var arrPatientProblems = patientinfo.ptMedication;

            if (arrPatientProblems.Count > 0)
            {
                list = hl7factory.CreateStrucDocList();
                //Creating List Object.
                int i = 0;
                foreach (var patientmedication in arrPatientProblems)
                {
                    ListWithItem("medication" + Convert.ToString((i + 1)), Convert.ToString(patientmedication.Medication) + " - " + Convert.ToString(patientmedication.Dosage) + " " + Convert.ToString(patientmedication.Frequency), hl7III, hl7factory);
                    GenerateMedicationEntry(patientmedication, i, hl7III, hl7factory);
                    i++;
                }
                functionalStatus.Section.Text.Items.Add(list);
                // Adding List to Text Tag.
            }
            else
            {
                paragraph = hl7factory.CreateStrucDocParagraph();
                paragraph.Items.Add("N/A");
                functionalStatus.Section.Text.Items.Add(paragraph);
                GenerateMedicationEntryEmpty(hl7III, hl7factory);
            }
        }
Esempio n. 4
0
        private void FillImmunizationContent(PatientClinicalInformation patientinfo, Factory hl7factory, III hl7III)
        {
            if (patientinfo.ptPlanOfCare.Count > 0)
            {
                managetable = new GenerateTableBodyStructure();

                DataArr.Add("Planned Activity");
                DataArr.Add("Planned Date");
                tble  = hl7factory.CreateStrucDocTable();
                thead = tble.Thead;
                tbody = tble.Tbody.Append();
                tr    = thead.Tr.Append();
                managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
                //ArrayList alleries = new ArrayList(patientinfo.ptAllergies.ptAllergies);
                string isExistTbody = "false";
                int    i            = 0;

                foreach (var item in patientinfo.ptPlanOfCare)
                {
                    DataArr = new ArrayList();
                    DataArr.Add("Goal: " + item.Goal + ", Instructions: " + item.Instructions);
                    DataArr.Add(Convert.ToString(item.PlannedDate));
                    //CreateTableTd(DataArr);
                    isExistTbody = "true";
                    managetable.CreateTableBody(DataArr, hl7factory, tble, tbody, tr);
                    var entry = functionalStatus.Section.Entry.Append();
                    entry.TypeCode        = x_ActRelationshipEntry.DRIV;
                    entry.AsAct.ClassCode = 0;
                    entry.AsAct.MoodCode  = 0;
                    hl7III = entry.AsAct.TemplateId.Append();
                    hl7III.Init("2.16.840.1.113883.10.20.22.4.20");
                    hl7III = entry.AsAct.Id.Append();
                    hl7III.Init(Guid.NewGuid().ToString());
                    entry.AsAct.Code.Code        = "409073007";
                    entry.AsAct.Code.DisplayName = "instruction";
                    entry.AsAct.Code.CodeSystem  = "2.16.840.1.113883.6.96";

                    entry.AsAct.Text.Text       = "Goal: " + item.Goal + ", Instructions: " + item.Instructions;
                    entry.AsAct.StatusCode.Code = "completed";
                    i++;
                }
                functionalStatus.Section.Text.Items.Add(tble);
                //managetable.CreateTableBody(alleries, hl7factory);
            }
            else
            {
                managetable.CreateTableBody1("2", hl7factory, tble, tbody, tr); //Empty Body Entry
            }
        }
Esempio n. 5
0
        private void FillImmunizationContent(PatientClinicalInformation patientinfo, Factory hl7factory)
        {
            if (patientinfo.ptAllergies.Count > 0)
            {
                managetable = new GenerateTableBodyStructure();

                DataArr.Add("Vaccine");
                DataArr.Add("Date");
                DataArr.Add("Status");
                tble  = hl7factory.CreateStrucDocTable();
                thead = tble.Thead;
                tbody = tble.Tbody.Append();
                tr    = thead.Tr.Append();
                managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
                //ArrayList alleries = new ArrayList(patientinfo.ptAllergies.ptAllergies);
                int i = 0;
                foreach (var item in patientinfo.ptImmunization)
                {
                    DataArr = new ArrayList();
                    //DataArr.Add(Convert.ToString(item.substance));
                    content       = hl7factory.CreateStrucDocContent();
                    content.XmlId = "immun" + (i + 1);
                    content.Items.Add(item.Vaccine != null? item.Vaccine:"");
                    DataArr.Add(content);
                    if (!String.IsNullOrEmpty(item.ApproximateDate.ToString()))
                    {
                        DataArr.Add(string.Format("{0:MMM yyyy}", Convert.ToDateTime(item.ApproximateDate).ToString()));
                    }
                    else
                    {
                        DataArr.Add(string.Format("{0:MMM yyyy}", Convert.ToDateTime(DateTime.Now).ToString()));
                    }
                    DataArr.Add("Completed");
                    managetable.CreateTableBody(DataArr, hl7factory, tble, tbody, tr);
                    i++;
                }

                functionalStatus.Section.Text.Items.Add(tble);
                //managetable.CreateTableBody(alleries, hl7factory);
            }
            else
            {
                IStrucDocParagraph paragraph = hl7factory.CreateStrucDocParagraph();
                paragraph.Items.Add("N/A");
                functionalStatus.Section.Text.Items.Add(paragraph);
            }
        }
Esempio n. 6
0
 protected void BindPatientName(PatientClinicalInformation patientinfo, IPN Name, Factory hl7factory)
 {
     if (patientinfo.ptDemographicDetail.FirstName != "")
     {
         var Given = hl7factory.Createengiven();
         Given = hl7factory.Createengiven();
         Given.Init(patientinfo.ptDemographicDetail.FirstName);
         Name.Items.Add(Given);
     }
     if (patientinfo.ptDemographicDetail.LastName != "")
     {
         var Family = hl7factory.Createenfamily();
         Family = hl7factory.Createenfamily();
         Family.Init(patientinfo.ptDemographicDetail.LastName);
         Name.Items.Add(Family);
     }
 }
Esempio n. 7
0
        private void FillAppointmentContent(PatientClinicalInformation patientinfo, Factory hl7factory, III hl7III)
        {
            if (patientinfo.ptAppointment.Count > 0)
            {
                managetable = new GenerateTableBodyStructure();
                paragraph   = hl7factory.CreateStrucDocParagraph();
                paragraph.Items.Add("Future Appointment");
                functionalStatus.Section.Text.Items.Add(paragraph);
                DataArr = new ArrayList();
                DataArr.Add("Date");
                DataArr.Add("Provider Name");
                tble  = hl7factory.CreateStrucDocTable();
                thead = tble.Thead;
                tbody = tble.Tbody.Append();
                tr    = thead.Tr.Append();
                managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
                //ArrayList alleries = new ArrayList(patientinfo.ptAllergies.ptAllergies);
                string isExistTbody = "false";
                int    i            = 0;

                foreach (var item in patientinfo.ptAppointment)
                {
                    DataArr = new ArrayList();
                    DataArr.Add(Convert.ToString(item.AppointmentDate));
                    DataArr.Add(item.DoctorName);
                    managetable.CreateTableBody(DataArr, hl7factory, tble, tbody, tr);
                    isExistTbody = "true";
                    i++;
                }
                if (isExistTbody == "false")
                {
                    managetable.CreateTableBody1("2", hl7factory, tble, tbody, tr); //Empty Body Entry
                }

                functionalStatus.Section.Text.Items.Add(tble);
                //managetable.CreateTableBody(alleries, hl7factory);
            }
            else
            {
                paragraph = hl7factory.CreateStrucDocParagraph();
                paragraph.Items.Add("N/A");
                functionalStatus.Section.Text.Items.Add(paragraph);
            }
        }
Esempio n. 8
0
 private void FillAllergiesContent(PatientClinicalInformation patientinfo, Factory hl7factory)
 {
     if (patientinfo.ptAllergies.Count > 0)
     {
         managetable = new GenerateTableBodyStructure();
         ArrayList DataArr = new ArrayList();
         DataArr.Add("Substance");
         DataArr.Add("Reaction");
         DataArr.Add("Status");
         DataArr.Add("Date");
         tble  = hl7factory.CreateStrucDocTable();
         thead = tble.Thead;
         tbody = tble.Tbody.Append();
         tr    = thead.Tr.Append();
         managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
         //ArrayList alleries = new ArrayList(patientinfo.ptAllergies.ptAllergies);
         int i = 0;
         foreach (var item in patientinfo.ptAllergies)
         {
             DataArr = new ArrayList();
             DataArr.Add(Convert.ToString(item.substance));
             content       = hl7factory.CreateStrucDocContent();
             content.XmlId = "reaction" + (i + 1);
             content.Items.Add(item.reaction);
             DataArr.Add(content);
             DataArr.Add(item.status);
             DataArr.Add(item.reaction);
             managetable.CreateTableBody(DataArr, hl7factory, tble, tbody, tr);
             i++;
         }
         functionalStatus.Section.Text.Items.Add(tble);
         //managetable.CreateTableBody(alleries, hl7factory);
     }
     else
     {
         IStrucDocParagraph paragraph = hl7factory.CreateStrucDocParagraph();
         paragraph.Items.Add("N/A");
         functionalStatus.Section.Text.Items.Add(paragraph);
     }
 }
 private void FillEncounterContent(PatientClinicalInformation patientinfo, III hl7III, Factory hl7factory)
 {
     if (patientinfo.ptEncounters.Count > 0)
     {
         managetable = new GenerateTableBodyStructure();
         DataArr.Add("Encounter");
         DataArr.Add("Performer");
         DataArr.Add("Location");
         DataArr.Add("Date");
         tble  = hl7factory.CreateStrucDocTable();
         thead = tble.Thead;
         tbody = tble.Tbody.Append();
         tr    = thead.Tr.Append();
         managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
         //ArrayList alleries = new ArrayList(patientinfo.ptAllergies.ptAllergies);
         int i = 0;
         foreach (var item in patientinfo.ptEncounters)
         {
             DataArr = new ArrayList();
             //content = hl7factory.CreateStrucDocContent();
             //content.XmlId = "encounter" + (i + 1);
             //content.Items.Add(item.EncounterDescription);
             DataArr.Add(item.EncounterDescription);
             DataArr.Add(item.PerformerName);
             DataArr.Add(patientinfo.ptClinicInformation.ClinicName);
             DataArr.Add(string.Format("{0:MM/dd/yyyy}", item.EncounterDate));
             managetable.CreateTableBody(DataArr, hl7factory, tble, tbody, tr);
             GenerateEncounterEntry(item, patientinfo, i, hl7III, hl7factory);
             i++;
         }
         functionalStatus.Section.Text.Items.Add(tble);
     }
     else
     {
         CreateEncounterEmptyEntry(hl7III, hl7factory);
     }
 }
        private void FillProblemContent(PatientClinicalInformation patientinfo, Factory hl7factory)
        {
            var arrPatientProblems = patientinfo.ptProblemes;

            if (arrPatientProblems.Count > 0)
            {
                list = hl7factory.CreateStrucDocList();
                //Creating List Object.


                int i = 0;
                foreach (var patientProblem in arrPatientProblems)
                {
                    listItem          = hl7factory.CreateStrucDocItem();
                    contentItem       = hl7factory.CreateStrucDocContent();
                    contentItem.XmlId = "Problem" + (i + 1);

                    contentItem.Items.Add(Convert.ToString(patientProblem.Description) + ": Status - " + Convert.ToString(patientProblem.Status) + ", Date Diagnosed - " + Convert.ToString(patientProblem.DateDiagnosed));
                    listItem.Items.Add(contentItem);
                    list.ListType = 0;
                    list.Item.Add(listItem);
                    i++;
                }
                functionalStatus.Section.Text.Items.Add(list);
                // Adding List to Text Tag.
            }
            else
            {
                contentItem = hl7factory.CreateStrucDocContent();
                IStrucDocText text = hl7factory.CreateStrucDocText();
                contentItem.XmlId = "noproblems1";
                contentItem.Items.Add("No known problems");
                text.Items.Add(contentItem);
                functionalStatus.Section.Text.Items.Add(contentItem);
            }
        }
        public void GenerateEncounterEntry(Encounters ptEncounters, PatientClinicalInformation patientinfo, int refid, III hl7III, Factory hl7factory)
        {
            var Entry = functionalStatus.Section.Entry.Append();

            Entry.AsEncounter.ClassCode = "ENC";
            Entry.AsEncounter.MoodCode  = x_DocumentEncounterMood.EVN;
            hl7III = Entry.AsEncounter.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.49");
            hl7III = Entry.AsEncounter.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Entry.AsEncounter.Code.Code           = "99212";
            Entry.AsEncounter.Code.DisplayName    = "Outpatient Visit";
            Entry.AsEncounter.Code.CodeSystem     = "2.16.840.1.113883.6.12";
            Entry.AsEncounter.Code.CodeSystemName = "CPT";
            IVXB_TS low = new IVXB_TS();

            low.Init(Convert.ToDateTime(ptEncounters.EncounterDate));
            Entry.AsEncounter.EffectiveTime = new IVL_TS().Init(low: low);
            var performer = Entry.AsEncounter.Performer.Append();

            hl7III = performer.AssignedEntity.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            performer.AssignedEntity.Code.Code           = "59058001";
            performer.AssignedEntity.Code.CodeSystem     = "2.16.840.1.113883.6.96";
            performer.AssignedEntity.Code.CodeSystemName = "SNOMED CT";
            performer.AssignedEntity.Code.DisplayName    = "General Physician";
            var Participant = Entry.AsEncounter.Participant.Append();

            Participant.TypeCode = "LOC";
            Participant.ParticipantRole.ClassCode = "SDLOC";
            hl7III = Participant.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.32");
            Participant.ParticipantRole.Code.Code           = "1117-1";
            Participant.ParticipantRole.Code.CodeSystem     = "2.16.840.1.113883.6.259";
            Participant.ParticipantRole.Code.CodeSystemName = "HealthcareServiceLocation";
            Participant.ParticipantRole.Code.DisplayName    = "Family Medicine Clinic";

            addressphno         = new GenerateAddressPhNo();
            addressinfo         = new AddressModel();///Fill Clinic Address
            addressinfo.street  = patientinfo.ptClinicInformation.ClinicStreeet;
            addressinfo.city    = patientinfo.ptClinicInformation.ClinicCity;
            addressinfo.state   = patientinfo.ptClinicInformation.ClinicState;
            addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry;
            addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString();
            Participant.ParticipantRole.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END

            contactinfo             = new PhNoModel();                                                  ///FIll Clinic Contact Number
            contactinfo.telcomUse   = "WP";
            contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
            contactinfo.nullFlavor  = "UNK";
            Participant.ParticipantRole.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END

            var Rel = Entry.AsEncounter.EntryRelationship.Append();

            Rel.TypeCode = x_ActRelationshipEntryRelationship.RSON;
            Rel.AsObservation.ClassCode = "OBS";
            Rel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            hl7III = Rel.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.19");
            hl7III = Rel.AsObservation.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Rel.AsObservation.Code.Code           = "404684003";
            Rel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.96";
            Rel.AsObservation.Code.CodeSystemName = "SNOMED CT";
            Rel.AsObservation.Code.DisplayName    = "Finding";
            Rel.AsObservation.StatusCode.Code     = "completed";
            Rel.AsObservation.EffectiveTime       = new IVL_TS().Init(low: low);
            CD obsValueAsCD = new CD();

            obsValueAsCD.Code        = ptEncounters.Code;
            obsValueAsCD.DisplayName = Convert.ToString(ptEncounters.EncounterDescription);
            obsValueAsCD.CodeSystem  = "2.16.840.1.113883.6.96";
            Rel.AsObservation.Value.Add(obsValueAsCD);
            Rel                 = Entry.AsEncounter.EntryRelationship.Append();
            Rel.TypeCode        = x_ActRelationshipEntryRelationship.SUBJ;
            Rel.AsAct.ClassCode = 0;
            Rel.AsAct.MoodCode  = x_DocumentActMood.EVN;
            hl7III              = Rel.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.80");
            hl7III = Rel.AsAct.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Rel.AsAct.Code.Code           = "29308-4";
            Rel.AsAct.Code.CodeSystem     = "2.16.840.1.113883.6.1";
            Rel.AsAct.Code.CodeSystemName = "LOINC";
            Rel.AsAct.Code.DisplayName    = "ENCOUNTER DIAGNOSIS";
            Rel.AsAct.StatusCode.Code     = "active";
            Rel.AsAct.EffectiveTime       = new IVL_TS().Init(low: low);
            var SubRel = Rel.AsAct.EntryRelationship.Append();

            SubRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            SubRel.AsObservation.ClassCode = "OBS";
            SubRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            hl7III = SubRel.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.4");
            hl7III = SubRel.AsObservation.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            SubRel.AsObservation.Code.Code        = "409586006";
            SubRel.AsObservation.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            SubRel.AsObservation.Code.DisplayName = "Complaint";
            SubRel.AsObservation.StatusCode.Code  = "completed";
            SubRel.AsObservation.EffectiveTime    = new IVL_TS().Init(low: low);
            CD obsValueAsCDSub = new CD();

            obsValueAsCDSub.Code        = ptEncounters.Code;
            obsValueAsCDSub.DisplayName = Convert.ToString(ptEncounters.EncounterDescription);
            obsValueAsCDSub.CodeSystem  = "2.16.840.1.113883.6.96";
            SubRel.AsObservation.Value.Add(obsValueAsCDSub);
        }
        public PatientClinicalInformation ParseCCDAFile(string path, bool AsString)
        {
            ParseAddress prsadd = new ParseAddress();
            StreamReader sr     = new StreamReader(path);

            HL7SDK.Cda.ClinicalDocument doc = new HL7SDK.Cda.ClinicalDocument();
            doc.Load(sr);

            ///Patient Clinic Summary Information
            ptInformation = new PatientClinicalInformation();
            /// Patient Demographic Information
            ptDemographic = new PatientDemographicDetail();
            if (doc.RecordTarget != null)
            {
                IADCollection ptaddess = doc.RecordTarget[0].PatientRole.Addr;
                AddressModel  add      = prsadd.FillAddress(ptaddess); ///Parse Address
                                                                       /// Patient Address
                ptDemographic.Street  = add.street;
                ptDemographic.City    = add.city;
                ptDemographic.State   = add.state;
                ptDemographic.Country = add.country;
                ptDemographic.Zip     = Convert.ToString(add.pinCode);
                ///// Patient Name
                NameModel ptname = prsadd.FillName(doc.RecordTarget[0].PatientRole.Patient.Name);
                ptDemographic.FirstName = doc.RecordTarget[0].PatientRole.Patient.Name[0].FindENGiven();  ///Get Patient First Name
                ptDemographic.LastName  = doc.RecordTarget[0].PatientRole.Patient.Name[0].FindENFamily(); ///Get Patient Last Name
                ///// Patient DOB
                ITS ts = doc.RecordTarget[0].PatientRole.Patient.BirthTime;
                ptDemographic.DateofBirth = ts.AsDateTime.ToString();
                ///// Patient Gender
                ptDemographic.gender = doc.RecordTarget[0].PatientRole.Patient.AdministrativeGenderCode.Code == "M" ? "MALE" : "FEMALE";
                ///// Patient SSN
                try
                {
                    ptDemographic.SSN = doc.RecordTarget[0].PatientRole.Id.Where(k => k.Root == "2.16.840.1.113883.4.1").FirstOrDefault().Extension.ToString();
                }
                catch (Exception)
                {
                    ptDemographic.SSN = doc.RecordTarget[0].PatientRole.Id.FirstOrDefault().Extension.ToString();
                }

                ///// Patient PHNo.
                ptDemographic.ContactNo = Convert.ToString(doc.RecordTarget[0].PatientRole.Telecom[0].Value);
                ///// Patient Race
                ptDemographic.Race = doc.RecordTarget[0].PatientRole.Patient.RaceCode.DisplayName.ToString();
                ///// Patient Language
                if (doc.RecordTarget[0].PatientRole.Patient.LanguageCommunication.Count > 0)
                {
                    ptDemographic.PreferredLanguage = doc.RecordTarget[0].PatientRole.Patient.LanguageCommunication[0].LanguageCode.Code.ToString();
                    ptDemographic.LanguageCode      = doc.RecordTarget[0].PatientRole.Patient.LanguageCommunication[0].LanguageCode.Code.ToString();
                }
                ///// Patient Ethencity
                ptDemographic.Ethnicity           = doc.RecordTarget[0].PatientRole.Patient.EthnicGroupCode.DisplayName;
                ptInformation.ptDemographicDetail = ptDemographic;
            }
            ///Component OF
            IEncompassingEncounter componentOf = doc.ComponentOf.EncompassingEncounter;

            ptInformation.EncounterNoteDate = componentOf.EffectiveTime.Low != null ? componentOf.EffectiveTime.Low.Value != null?componentOf.EffectiveTime.Low.AsDateTime.ToString() : null : null;

            ptInformation.EncounterCode        = componentOf.Code.Code == null ? null : componentOf.Code.Code.ToString();
            ptInformation.EncounterDescription = componentOf.Code.DisplayName == null ? null : componentOf.Code.DisplayName.ToString();
            if (componentOf.ResponsibleParty.AssignedEntity.AssignedPerson.Name.Count > 0)
            {
                ptInformation.EncounterStaffName = componentOf.ResponsibleParty.AssignedEntity.AssignedPerson.Name[0].FindENFamily();///Performer Name (Staff/Clinician Name)
            }
            /// Clinic / Provider Detail
            ptClinicInformation = new ClinicInformation();
            if (doc.Author != null)
            {
                /////Clinic / Provider Address
                IADCollection ptaddess = doc.Author[0].AssignedAuthor.Addr;
                AddressModel  add      = prsadd.FillAddress(ptaddess);///Parse Address
                ptClinicInformation.ClinicCity    = add.city;
                ptClinicInformation.ClinicState   = add.state;
                ptClinicInformation.ClinicStreeet = add.street;
                ptClinicInformation.ClinicCountry = add.country;
                ptClinicInformation.ClinicZip     = add.pinCode;
                ///// Clinic / Provider PHNo.
                ptClinicInformation.ClinicPhoneNumber = doc.Author[0].AssignedAuthor.Telecom[0].Value;
                ///// Clinic / Provider Name
                try { ptClinicInformation.ClinicName = doc.Author[0].AssignedAuthor.AsPerson.Name[0].FindENGiven(); } catch (Exception) { }

                ptInformation.ptClinicInformation = ptClinicInformation;
            }
            if (doc.DocumentationOf != null)
            {
                documentationOfInfo = new List <DocumentationOfList>();
                for (int i = 0; i < doc.DocumentationOf.Count; i++)
                {
                    DocumentationOfList docof    = new DocumentationOfList();
                    IADCollection       ptaddess = doc.DocumentationOf[i].ServiceEvent.Performer[0].AssignedEntity.Addr;
                    AddressModel        add      = prsadd.FillAddress(ptaddess);
                    docof.address = add.street;
                    docof.city    = add.city;
                    docof.state   = add.state;
                    docof.pinCode = add.pinCode;
                    if (doc.DocumentationOf[i].ServiceEvent.Performer[0].AssignedEntity.AssignedPerson.Name.Count > 0)
                    {
                        docof.staffName = doc.DocumentationOf[i].ServiceEvent.Performer[0].AssignedEntity.AssignedPerson.Name[0].FindENFamily();
                    }
                    documentationOfInfo.Add(docof);
                }

                ptInformation.documentationOfInfo = documentationOfInfo;
            }
            /// Get All Document Component
            if (doc.Component.AsStructuredBody.Component != null)
            {
                IComponent3Collection       item     = doc.Component.AsStructuredBody.Component;
                IEnumerable <ISection>      sections = item.Select(s => s.Section);
                IEnumerable <IStrucDocText> text     = sections.Select(t => t.Text);
                IEnumerable <IStrucDocElementCollection> textitems = text.Select(tb => tb.Items);
                foreach (ISection funcststus in sections)
                {
                    string snomdcode = funcststus.Code.Code;
                    componentSections = new GetComponents();
                    dataCollection    = new ComponentDataCollection();
                    //Dictionary<string, ArrayList> DataArr = dataCollection.GetDataCollection(funcststus, ptInformation);
                    switch (snomdcode)
                    {
                    case "48765-2":    /// Patient Allergies Information
                        // ptAllergies = componentSections.GetAllergies(DataArr);
                        ptAllergies = componentSections.FillAllergies(funcststus.Entry);
                        break;

                    case "11450-4":    /// Patient Problems Information
                        //ptProblemes = componentSections.GetProblems(DataArr);
                        ptProblemes = componentSections.FillProblems(funcststus.Entry);
                        break;

                    case "29762-2":    /// Patient Social History Information
                        //ptSocialHistory = componentSections.GetSocialHistory(DataArr);
                        ptSocialHistory = componentSections.FillSocialHistory(funcststus.Entry);
                        break;

                    case "8716-3":    /// Patient Vital Signs Information
                        //ptVitalSigns = componentSections.GetVitalSigns(DataArr);
                        ptVitalSigns = componentSections.FillVitalSigns(funcststus.Entry);
                        break;

                    case "10160-0":    /// Patient Medication Information
                        // ptMedication = componentSections.GetMedication(DataArr);
                        ptMedication = componentSections.FillMedication(funcststus.Entry);
                        break;

                    case "46240-8":    /// Patient ENCOUNTERS Information
                        // ptEncounters = componentSections.GetEncounters(DataArr);
                        ptEncounters = componentSections.FillEncounters(funcststus.Entry, ptInformation.EncounterStaffName);
                        break;

                    case "30954-2":    /// Patient Lab Results Information
                        //ptLabResults = componentSections.GetLabResults(DataArr);
                        ptLabResults = componentSections.FillLabResults(funcststus.Entry);
                        break;

                    case "46239-0":    /// Patient Reason For Visit Information
                        //ptReason = componentSections.GetReason(DataArr);
                        ptReason = componentSections.FillReason(funcststus);
                        break;

                    case "11369-6":    /// Patient Immunizations Information
                        //ptImmunization = componentSections.GetImmunization(DataArr);
                        ptImmunization = componentSections.FillImmunization(funcststus.Entry);
                        break;

                    case "18776-5":    /// Patient Plan Of Care Information
                        //ptPlanOfCare = componentSections.GetPlanOfCare(DataArr);
                        ptPlanOfCare = componentSections.FillPlanOfCare(funcststus.Entry);
                        break;

                    case "42349-1":    /// Patient Reason For Transfer Information
                        //reasonforTransfer = componentSections.GetReasonForTransfer(DataArr);
                        reasonforTransfer = componentSections.FillReasonForTransfer(funcststus);
                        break;

                    case "47519-4":    /// Patient Procedure Information
                        //ptProcedure = componentSections.GetProcedure(DataArr);
                        ptProcedure = componentSections.FillProcedure(funcststus.Entry);
                        break;

                    case "47420-5":    /// Patient Functional Status Information
                        //ptFunctionalStatus = componentSections.GetFunctionalStatus(DataArr);
                        ptFunctionalStatus = componentSections.FillFunctionalStatus(funcststus.Entry);
                        break;
                    }
                }
                ///Encapsulate Patient Information In A Single Model
                ptInformation.ptAllergies        = ptAllergies;
                ptInformation.ptProblemes        = ptProblemes;
                ptInformation.ptVitalSigns       = ptVitalSigns;
                ptInformation.ptSocialHistory    = ptSocialHistory;
                ptInformation.ptMedication       = ptMedication;
                ptInformation.ptEncounters       = ptEncounters;
                ptInformation.ptLabResults       = ptLabResults;
                ptInformation.ptReason           = ptReason;
                ptInformation.ptImmunization     = ptImmunization;
                ptInformation.ptPlanOfCare       = ptPlanOfCare;
                ptInformation.reasonforTransfer  = reasonforTransfer;
                ptInformation.ptProcedure        = ptProcedure;
                ptInformation.ptFunctionalStatus = ptFunctionalStatus;
                ///END
            }

            return(ptInformation);
        }
        public string FillParticipantInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string participantdetais = string.Empty;
            var    participant       = clinicalDoc.Participant.Append();
            var    times             = hl7factory.CreateIVXB_TS();

            times.Init(DateTime.Now);
            IPN AsName = hl7factory.CreatePN();

            participant.TypeCode = "IND";
            participant.Time.Init(null, times, times);
            participant.AssociatedEntity.ClassCode       = "CAREGIVER";
            participant.AssociatedEntity.Code.Code       = "MTH";
            participant.AssociatedEntity.Code.CodeSystem = "2.16.840.1.113883.5.111";
            addressphno         = new GenerateAddressPhNo();
            addressinfo         = new AddressModel();///Fill Clinic Address
            addressinfo.street  = patientinfo.ptClinicInformation.ClinicStreeet;
            addressinfo.city    = patientinfo.ptClinicInformation.ClinicCity;
            addressinfo.state   = patientinfo.ptClinicInformation.ClinicState;
            addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry;
            addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString();
            participant.AssociatedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END

            contactinfo             = new PhNoModel();                                                   ///FIll Clinic Contact Number
            contactinfo.telcomUse   = "WP";
            contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
            contactinfo.nullFlavor  = "UNK";
            participant.AssociatedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END

            AsName   = participant.AssociatedEntity.AssociatedPerson.Name.Append();                      ///Manage Clinic Name
            nameinfo = new NameModel();
            nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName;
            addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name

            participantdetais = clinicalDoc.Xml;
            return(participantdetais);
        }
        public void GenerateProcedureEntry(ProcedureList patientProcedure, int refid, PatientClinicalInformation patientinfo, III hl7III, Factory hl7factory)
        {
            IEntry Entry = functionalStatus.Section.Entry.Append();

            Entry.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            Entry.AsObservation.ClassCode = "OBS";
            hl7III = Entry.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.13");
            hl7III = Entry.AsObservation.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Entry.AsObservation.Code.Code           = patientProcedure.CPTCodes;
            Entry.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.96";
            Entry.AsObservation.Code.CodeSystemName = "CPT";
            Entry.AsObservation.Code.DisplayName    = patientProcedure.Description;
            Entry.AsObservation.Code.OriginalText.Reference.Value = ("#Proc" + (refid + 1).ToString());
            Entry.AsObservation.StatusCode.Code          = "completed";
            Entry.AsObservation.EffectiveTime.NullFlavor = "UNK";
            Entry.AsObservation.PriorityCode.NullFlavor  = "UNK";
            CD obsValueAsCD = new CD();

            obsValueAsCD.OriginalText.Reference.Value = ("#Proc" + (refid + 1).ToString());
            Entry.AsObservation.Value.Add(obsValueAsCD);
            if (patientinfo.ptClinicInformation.ClinicName != null)
            {
                addressphno             = new GenerateAddressPhNo();
                addressinfo             = new AddressModel();///Fill Clinic Address
                addressinfo.street      = patientinfo.ptClinicInformation.ClinicStreeet;
                addressinfo.city        = patientinfo.ptClinicInformation.ClinicCity;
                addressinfo.state       = patientinfo.ptClinicInformation.ClinicState;
                addressinfo.country     = patientinfo.ptClinicInformation.ClinicCountry;
                addressinfo.pinCode     = patientinfo.ptClinicInformation.ClinicZip.ToString();
                contactinfo             = new PhNoModel();///FIll Clinic Contact Number
                contactinfo.telcomUse   = "WP";
                contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
                contactinfo.nullFlavor  = "UNK";
            }
            var Performer = Entry.AsObservation.Performer.Append();

            hl7III = Performer.AssignedEntity.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Performer.AssignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory));
            Performer.AssignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory));
            hl7III = Performer.AssignedEntity.RepresentedOrganization.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            IAD hl7IADInterface = hl7factory.CreateAD();

            hl7IADInterface.NullFlavor = "UNK";
            Performer.AssignedEntity.RepresentedOrganization.Addr.Add(hl7IADInterface);
            ITEL telcom = hl7factory.CreateTEL();

            telcom            = hl7factory.CreateTEL();
            telcom.NullFlavor = "UNK";
            Performer.AssignedEntity.RepresentedOrganization.Telecom.Add(telcom);
        }
        public string FillPatientProcedure(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptProcedureModel = new ProcedureModel();
            CreateComponent(ptProcedureModel, clinicalDoc, hl7III);// Manage Allergy Component
            //FillProcedureContent(patientinfo, hl7factory);
            int i = 0;

            if (patientinfo.ptAllergies.Count > 0)
            {
                foreach (ProcedureList item in patientinfo.ptProcedure)
                {
                    GenerateProcedureEntry(item, (i + 1), patientinfo, hl7III, hl7factory);
                }
            }
            else
            {
                GenerateProcedureEntryEmpty(hl7III, hl7factory);
            }
            return(clinicalDoc.Xml);
        }
Esempio n. 16
0
        public string FillReasonForVisit(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptreason         = new ReasonForVisitModel();
            hl7Body          = clinicalDoc.Component.AsStructuredBody;
            functionalStatus = hl7Body.Component.Append();
            hl7III           = functionalStatus.Section.TemplateId.Append();
            hl7III.Root      = ptreason.root;
            functionalStatus.Section.Code.CodeSystem     = ptreason.codeSystem;
            functionalStatus.Section.Code.Code           = ptreason.code;
            functionalStatus.Section.Code.CodeSystemName = ptreason.codeSystemName;
            functionalStatus.Section.Code.DisplayName    = ptreason.displayName;
            functionalStatus.Section.Title.Text          = ptreason.title;
            var paragraph = hl7factory.CreateStrucDocParagraph();

            if (patientinfo.ptReason != null)
            {
                paragraph.Items.Add(Convert.ToString(patientinfo.ptReason.Description));
            }
            else
            {
                paragraph.Items.Add("N/A");
            }

            functionalStatus.Section.Text.Items.Add(paragraph);
            return(clinicalDoc.Xml);
        }
        public string FillPatientLabResult(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptLabResultModel = new LabResultModel();
            CreateComponent(ptLabResultModel, clinicalDoc, hl7III);// Manage Problem Component
            FillLabResults(patientinfo, hl7factory, hl7III);
            return(clinicalDoc.Xml);
        }
        public string FillSocialHistory(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptSocialHistory = new SocialHistory();
            CreateComponent(ptSocialHistory, clinicalDoc, hl7III);// Manage Problem Component
            FillSocialHistoryContent(patientinfo.ptSocialHistory, hl7factory);

            //CreateSocialHistoryBody(patientinfo.ptSocialHistory);
            // Creating Social History Table Body with Table Structure
            int idCount = 1;

            ///''' For Smoking Status ''''''

            if (patientinfo.ptSocialHistory != null)
            {
                GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Smoker, ref idCount, "Smoking", hl7III, hl7factory);
            }
            else
            {
                GenerateSocialHistoryEmpty(hl7III, hl7factory);
            }
            ///''' For Alcohol Status '''''
            if (patientinfo.ptSocialHistory != null)
            {
                if (!string.IsNullOrEmpty(patientinfo.ptSocialHistory.Alcohol))
                {
                    GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Alcohol, ref idCount, "Alcohol", hl7III, hl7factory);
                }

                if (!string.IsNullOrEmpty(patientinfo.ptSocialHistory.Drugs))
                {
                    GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Drugs, ref idCount, "Drugs", hl7III, hl7factory);
                }

                if (!string.IsNullOrEmpty(patientinfo.ptSocialHistory.Tobacoo))
                {
                    GenerateSocialHistoryEntry(patientinfo.ptSocialHistory.Tobacoo, ref idCount, "Tobacoo", hl7III, hl7factory);
                }
            }
            return(clinicalDoc.Xml);
        }
Esempio n. 19
0
        public string FillPlanOfCare(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptPlanOfCareModel = new PlanOfCareModel();
            CreateComponent(ptPlanOfCareModel, clinicalDoc, hl7III);// Manage Allergy Component
            FillImmunizationContent(patientinfo, hl7factory, hl7III);
            if (patientinfo.ptAppointment != null)
            {
                FillAppointmentContent(patientinfo, hl7factory, hl7III);
            }
            return(clinicalDoc.Xml);
        }
Esempio n. 20
0
        public string FillDocumentationOf(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string documentationOfdetais = string.Empty;

            addressphno         = new GenerateAddressPhNo();
            addressinfo         = new AddressModel();///Fill Clinic Address
            addressinfo.street  = patientinfo.ptClinicInformation.ClinicStreeet;
            addressinfo.city    = patientinfo.ptClinicInformation.ClinicCity;
            addressinfo.state   = patientinfo.ptClinicInformation.ClinicState;
            addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry;
            addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString();

            contactinfo           = new PhNoModel();///FIll Clinic Contact Number
            contactinfo.telcomUse = "WP";
            //contactinfo.telcomValue = patientinfo.ClinicPhoneNumber;
            contactinfo.nullFlavor = "UNK";



            var docof = clinicalDoc.DocumentationOf.Append();
            int count = 0;

            foreach (DocumentationOfList item in patientinfo.documentationOfInfo)
            {
                IVXB_TS low = new IVXB_TS();
                docof.ServiceEvent.ClassCode           = "PCPR";
                docof.ServiceEvent.Code.Code           = "99214";
                docof.ServiceEvent.Code.CodeSystem     = "2.16.840.1.113883.6.12";
                docof.ServiceEvent.Code.CodeSystemName = "CPT4";
                docof.ServiceEvent.Code.DisplayName    = "Office Visit";
                var performer = docof.ServiceEvent.Performer.Append();

                performer.TypeCode = x_ServiceEventPerformer.PRF;
                if (count == 0)
                {
                    low.Init(Convert.ToDateTime(item.date));
                    docof.ServiceEvent.EffectiveTime = new IVL_TS().Init(low: low);
                    performer.FunctionCode.Code      = "PP";
                }
                else
                {
                    if (Convert.ToDateTime(item.date).Date < Convert.ToDateTime(patientinfo.documentationOfInfo[count - 1].date).Date)
                    {
                        low.Init(Convert.ToDateTime(item.date));
                        docof.ServiceEvent.EffectiveTime = new IVL_TS().Init(low: low);
                    }
                    performer.FunctionCode.Code = "SP";
                }
                performer.FunctionCode.DisplayName    = "Care Provider";
                performer.FunctionCode.CodeSystem     = "2.16.840.1.113883.12.443";
                performer.FunctionCode.CodeSystemName = "Provider Role";
                low.Init(Convert.ToDateTime(item.date));
                performer.Time = new IVL_TS().Init(low: low);
                var id = performer.AssignedEntity.Id.Append();
                id.Init("2.16.840.1.113883.4.6", "111111111", "NPI");
                performer.AssignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory));
                contactinfo.telcomValue = "mailto: info @drummondgroup.com";
                performer.AssignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory));
                IPN AsName = hl7factory.CreatePN();
                AsName   = performer.AssignedEntity.AssignedPerson.Name.Append();///Manage Clinic Name
                nameinfo = new NameModel();
                //nameinfo.Createengiven = patientinfo.ClinicName;
                nameinfo.Createenfamily = item.staffName;
                addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name
                count++;
            }
            documentationOfdetais = clinicalDoc.Xml;
            return(documentationOfdetais);
        }
        public string FillPatientMedication(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptMedication = new MedicationInformation();
            CreateComponent(ptMedication, clinicalDoc, hl7III);// Manage Problem Component
            FillMedicationContent(patientinfo, hl7factory, hl7III);
            return(clinicalDoc.Xml);
        }
Esempio n. 22
0
        public string FillComponentInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string documentationOfdetais = string.Empty;

            hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6");
            clinicalDoc.ComponentOf.EncompassingEncounter.Code.Code        = patientinfo.EncounterCode;
            clinicalDoc.ComponentOf.EncompassingEncounter.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            clinicalDoc.ComponentOf.EncompassingEncounter.Code.DisplayName = patientinfo.EncounterDescription;
            IVXB_TS low = new IVXB_TS();

            if (patientinfo.EncounterNoteDate != null && patientinfo.EncounterNoteDate != "")
            {
                low.Init(Convert.ToDateTime(patientinfo.EncounterNoteDate));
                clinicalDoc.ComponentOf.EncompassingEncounter.EffectiveTime = new IVL_TS().Init(low: low);
            }
            else
            {
                var times = hl7factory.CreateIVXB_TS();
                clinicalDoc.ComponentOf.EncompassingEncounter.EffectiveTime.Init(null, times, times);
            }

            hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.ResponsibleParty.AssignedEntity.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6");

            var EnName = clinicalDoc.ComponentOf.EncompassingEncounter.ResponsibleParty.AssignedEntity.AssignedPerson.Name.Append();

            addressphno             = new GenerateAddressPhNo();
            nameinfo                = new NameModel();
            nameinfo.Createenfamily = patientinfo.EncounterStaffName;
            addressphno.FillName(nameinfo, EnName, hl7factory);

            var EncounterParticipant = clinicalDoc.ComponentOf.EncompassingEncounter.EncounterParticipant.Append();

            hl7III = EncounterParticipant.AssignedEntity.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6");
            var ParticipantName = EncounterParticipant.AssignedEntity.AssignedPerson.Name.Append();

            addressphno.FillName(nameinfo, ParticipantName, hl7factory);

            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.CodeSystem     = "2.16.840.1.113883.12.112";
            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.Code           = "01";
            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.DisplayName    = "Routine Discharge";
            clinicalDoc.ComponentOf.EncompassingEncounter.DischargeDispositionCode.CodeSystemName = "HL7 Discharge Disposition";
            hl7III = clinicalDoc.ComponentOf.EncompassingEncounter.Location.HealthCareFacility.Id.Append();
            hl7III.Init("2.16.540.1.113883.19.2");

            documentationOfdetais = clinicalDoc.Xml;
            return(documentationOfdetais);
        }
        public string FillEncounters(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptEncounter = new EncounterModel();
            CreateComponent(ptEncounter, clinicalDoc, hl7III);// Manage Allergy Component
            FillEncounterContent(patientinfo, hl7III, hl7factory);
            return(clinicalDoc.Xml);
        }
        public string FillFunctionalStatus(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptFunctionalStatus = new FunctionalStatusModel();
            CreateComponent(ptFunctionalStatus, clinicalDoc, hl7III);// Manage Allergy Component
            FillFunctionalStatusContent(patientinfo, hl7III, hl7factory);
            return(clinicalDoc.Xml);
        }
Esempio n. 25
0
        public string FillReasonForReferral(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            ptReasonForReferralModel = new ReasonForReferralModel();
            CreateComponent(ptReasonForReferralModel, clinicalDoc, hl7III);
            paragraph = hl7factory.CreateStrucDocParagraph();
            if (patientinfo.reasonforTransfer != null && patientinfo.reasonforTransfer != "")
            {
                paragraph.Items.Add(patientinfo.reasonforTransfer);
            }
            else
            {
                paragraph.Items.Add("N/A");
            }

            functionalStatus.Section.Text.Items.Add(paragraph);

            return(clinicalDoc.Xml);
        }
        public string FillAuthorInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string authordetais = string.Empty;
            //var targetrole = clinicalDoc.RecordTarget.Append();
            var authors = clinicalDoc.Author.Append();

            authors.Time.AsDateTime = DateTime.Now;
            var assignedAuthor = authors.AssignedAuthor;

            hl7III = assignedAuthor.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6", "999999");
            assignedAuthor.Code.Code           = "200000000X";
            assignedAuthor.Code.CodeSystem     = "2.16.840.1.113883.6.101";
            assignedAuthor.Code.CodeSystemName = "NUCC";
            assignedAuthor.Code.DisplayName    = "Allopathic &amp; Osteopathic Physicians";
            IPN   AsName = hl7factory.CreatePN();
            IENXP Ienxn  = hl7factory.CreateENXP();

            addressphno         = new GenerateAddressPhNo();
            addressinfo         = new AddressModel();///Fill Clinic Address
            addressinfo.street  = patientinfo.ptClinicInformation.ClinicStreeet;
            addressinfo.city    = patientinfo.ptClinicInformation.ClinicCity;
            addressinfo.state   = patientinfo.ptClinicInformation.ClinicState;
            addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry;
            addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString();
            assignedAuthor.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END

            contactinfo             = new PhNoModel();                                     ///FIll Clinic Contact Number
            contactinfo.telcomUse   = "WP";
            contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
            contactinfo.nullFlavor  = "UNK";
            assignedAuthor.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END

            AsName   = assignedAuthor.AsPerson.Name.Append();                              ///Manage Clinic Name
            nameinfo = new NameModel();
            nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName;
            //nameinfo.Createenfamily = patientinfo.LastName;
            addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name

            authordetais = clinicalDoc.Xml;
            return(authordetais);
        }
Esempio n. 27
0
        public string FillLegalAuthenticatorInfo(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string legalAuthenticatordetais = string.Empty;
            var    assignedEntity           = clinicalDoc.LegalAuthenticator.AssignedEntity;

            clinicalDoc.LegalAuthenticator.Time.Init(DateTime.Now);
            clinicalDoc.LegalAuthenticator.SignatureCode.Init("S");
            hl7III = assignedEntity.Id.Append();
            hl7III.Init("2.16.840.1.113883.4.6", "KP00017");
            assignedEntity.Code.Code           = "207QA0505X";
            assignedEntity.Code.CodeSystem     = "2.16.840.1.113883.6.101";
            assignedEntity.Code.CodeSystemName = "NUCC";
            assignedEntity.Code.DisplayName    = "Adult Medicine";
            IPN AsName = hl7factory.CreatePN();

            addressphno         = new GenerateAddressPhNo();
            addressinfo         = new AddressModel();///Fill Clinic Address
            addressinfo.street  = patientinfo.ptClinicInformation.ClinicStreeet;
            addressinfo.city    = patientinfo.ptClinicInformation.ClinicCity;
            addressinfo.state   = patientinfo.ptClinicInformation.ClinicState;
            addressinfo.country = patientinfo.ptClinicInformation.ClinicCountry;
            addressinfo.pinCode = patientinfo.ptClinicInformation.ClinicZip.ToString();
            assignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///END

            contactinfo             = new PhNoModel();                                     ///FIll Clinic Contact Number
            contactinfo.telcomUse   = "WP";
            contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
            contactinfo.nullFlavor  = "UNK";
            assignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///END

            AsName   = assignedEntity.AssignedPerson.Name.Append();                        ///Manage Clinic Name
            nameinfo = new NameModel();
            nameinfo.Createengiven = patientinfo.ptClinicInformation.ClinicName;
            addressphno.FillName(nameinfo, AsName, hl7factory);///FIll Clinic Name

            legalAuthenticatordetais = clinicalDoc.Xml;
            return(legalAuthenticatordetais);
        }
Esempio n. 28
0
        public string FillVitalSigns(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string clinicdetais = string.Empty;

            ptvitalSigns = new VitalSignsCode();
            CreateComponent(ptvitalSigns, clinicalDoc, hl7III);// Manage Allergy Component
            FillVitalSignsContent(patientinfo, hl7factory);
            int count = 1;

            if (patientinfo.ptAllergies.Count > 0)
            {
                foreach (VitalSigns item in patientinfo.ptVitalSigns)
                {
                    GenerateVitalSignsEntry(item, hl7III, hl7factory, ref count);
                }
            }
            else
            {
                GenerateVitalSignsEntryEmpty(hl7III, hl7factory);
            }
            return(clinicalDoc.Xml);
        }
Esempio n. 29
0
        public MemoryStream GenerateCCDA(PatientClinicalInformation patientinfo, string title = "smartData")
        {
            string result = string.Empty;

            clreport   = new ClinicalDocument();
            hl7Factory = new Factory();

            rpHeader                = new GenerateHeader();
            rpTarget                = new GenerateRecordTarget();
            rpClinicInfo            = new GetAuthorInformation();
            rpClinicDataEntererInfo = new GenerateDataEnterer();
            rpClinicInformant       = new GenerateInformant();
            rpClinicCustodian       = new GenerateCustodian();
            rpRecipientInfo         = new GenerateRecipientInfo();
            rpLegalAuthenticator    = new GenerateLegalAuthenticator();
            rpAuthenticator         = new GenerateAuthenticator();
            rpParticipantInfo       = new GenerateParticipantInfo();
            rpDocumentationOf       = new GenerateDocumentationOf();
            rpGenerateComponent     = new GenerateComponent();
            rpAllergies             = new GenerateAllergies();
            rpProblemes             = new GeneratePatientProblem();
            rpSocialHistory         = new GenerateSocialHistory();
            rpVitalSigns            = new GenerateVitalSigns();
            rpMedication            = new GenerateMedication();
            rpFunctionalStatus      = new GenerateFunctionalStatus();
            rpEncounters            = new GenerateEncounters();
            rpLabResult             = new GenerateLabResults();
            rpReasonforVisit        = new GenerateReasonForVisit();
            rpImmunizationt         = new GenerateImmunization();
            rpPlanOfCare            = new GeneratePlanOfCare();
            rpReasonforTransfer     = new GenerateReasonforTransfer();
            rpProcedure             = new GenerateProcedure();
            xmlStream               = new MemoryStream();

            doc = new XmlDocument();
            try
            {
                //Bind Report Header
                result = rpHeader.BindHeader(title, clreport, hl7Factory, realmCode);
                //END
                /*********************Bind Report Suumary***************************************/
                //Bind Client RecordTarget
                if (patientinfo.ptDemographicDetail != null)
                {
                    result = rpTarget.BindRecordTarget(title, clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Clinic Author Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpClinicInfo.FillAuthorInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Clinic Data Enterer Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpClinicDataEntererInfo.FillDataEnterer(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Clinic Informant Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpClinicInformant.FillInformantInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Clinic Custodian Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpClinicCustodian.FillCustodianInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Recipient Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpRecipientInfo.FillRecipientInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Legal Authenticator Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpLegalAuthenticator.FillLegalAuthenticatorInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Authenticator Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpAuthenticator.FillLegalAuthenticatorInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Participant Information
                if (patientinfo.ptClinicInformation != null)
                {
                    result = rpParticipantInfo.FillParticipantInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Documentation Of Information
                if (patientinfo.ptClinicInformation != null && patientinfo.ptDemographicDetail != null)
                {
                    result = rpDocumentationOf.FillDocumentationOf(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Component Of Information
                if (patientinfo.EncounterStaffName != null && patientinfo.EncounterNoteDate != null)
                {
                    result = rpGenerateComponent.FillComponentInfo(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Allergies Information
                if (patientinfo.ptAllergies != null && patientinfo.ptAllergies.Count > 0)
                {
                    result = rpAllergies.FillPatientAllergies(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Problemes Information
                if (patientinfo.ptProblemes != null && patientinfo.ptProblemes.Count > 0)
                {
                    result = rpProblemes.FillPatientProblemes(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind SocialHistory Information
                if (patientinfo.ptSocialHistory != null)
                {
                    result = rpSocialHistory.FillSocialHistory(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Vital Signs Information
                if (patientinfo.ptVitalSigns != null && patientinfo.ptVitalSigns.Count > 0)
                {
                    result = rpVitalSigns.FillVitalSigns(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Medication Information
                if (patientinfo.ptMedication != null && patientinfo.ptMedication.Count > 0)
                {
                    result = rpMedication.FillPatientMedication(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Functional Status Information
                if (patientinfo.ptFunctionalStatus != null && patientinfo.ptFunctionalStatus.Count > 0)
                {
                    result = rpFunctionalStatus.FillFunctionalStatus(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Encounter Information
                if (patientinfo.ptEncounters != null && patientinfo.ptEncounters.Count > 0)
                {
                    result = rpEncounters.FillEncounters(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Lab Result Information
                if (patientinfo.ptLabResults != null && patientinfo.ptLabResults.Count > 0)
                {
                    result = rpLabResult.FillPatientLabResult(clreport, hl7Factory, hl7III, patientinfo);
                }
                //END
                //Bind Reason For Visit Information
                string reasonforVisitInfo = rpReasonforVisit.FillReasonForVisit(clreport, hl7Factory, hl7III, patientinfo);

                //END
                //Bind Immunization Information
                if (patientinfo.ptImmunization != null && patientinfo.ptImmunization.Count > 0)
                {
                    result = rpImmunizationt.FillPatientImmunization(clreport, hl7Factory, hl7III, patientinfo);
                }

                //END
                //Bind Plan Of Care Information
                if (patientinfo.ptPlanOfCare != null && patientinfo.ptPlanOfCare.Count > 0)
                {
                    result = rpPlanOfCare.FillPlanOfCare(clreport, hl7Factory, hl7III, patientinfo);
                }

                //END
                // Bind Reason For Referral Information
                if (patientinfo.ptReason != null)
                {
                    result = rpReasonforTransfer.FillReasonForReferral(clreport, hl7Factory, hl7III, patientinfo);
                }

                // END
                // Bind Procedures Information
                if (patientinfo.ptProcedure != null && patientinfo.ptProcedure.Count > 0)
                {
                    result = rpProcedure.FillPatientProcedure(clreport, hl7Factory, hl7III, patientinfo);
                }
                // END
                /*********************END*******************************************************/
                //result = ptProcedure;


                string resulttext = "<?xml-stylesheet type='text/xsl' href ='CDA.xsl'?>" + result.Trim();
                doc.LoadXml(resulttext.ToString().Trim());
                doc.Save(Directory.GetCurrentDirectory() + "\\wwwroot\\CDA\\CDA.xml");

                XmlDocument xmlDoc = new XmlDocument();

                doc.Save(xmlStream);

                xmlStream.Flush();//Adjust this if you want read your data
                xmlStream.Position = 0;
            }
            catch (Exception ex)
            {
                string error = ex.Message.ToString();
            }
            //return new HttpResponseMessage()
            //{
            //    Content = new StringContent(doc.ToString(), Encoding.UTF8, "application/xml")
            //};
            return(xmlStream);
        }
Esempio n. 30
0
        private void FillVitalSignsContent(PatientClinicalInformation patientinfo, Factory hl7Factory)
        {
            if (patientinfo.ptVitalSigns.Count > 0)
            {
                managetable = new GenerateTableBodyStructure();

                DataArr = new ArrayList();
                DataArr.Add("Date / Time:");
                var arrVitalSign = patientinfo.ptVitalSigns;
                foreach (var vitalSign in arrVitalSign)
                {
                    DataArr.Add(Convert.ToString(vitalSign.Entrydate));
                }
                tble  = hl7Factory.CreateStrucDocTable();
                thead = tble.Thead;
                tbody = tble.Tbody.Append();
                tr    = thead.Tr.Append();
                managetable.CreateTableHeader(DataArr, hl7Factory, tble, thead, tr);

                IStrucDocTr tr2 = hl7Factory.CreateStrucDocTr();
                IStrucDocTr tr3 = hl7Factory.CreateStrucDocTr();
                tr = hl7Factory.CreateStrucDocTr();
                th = hl7Factory.CreateStrucDocTh();

                th.Items.Add("Height");
                tr.Items.Add(th);

                th = hl7Factory.CreateStrucDocTh();
                th.Items.Add("Weight");
                tr2.Items.Add(th);

                th = hl7Factory.CreateStrucDocTh();
                th.Items.Add("Blood Pressure");
                tr3.Items.Add(th);


                // Dim content
                int i = 1;
                foreach (var vitalSign in arrVitalSign)
                {
                    td            = hl7Factory.CreateStrucDocTd();
                    content       = hl7Factory.CreateStrucDocContent();
                    content.XmlId = "vit" + (i);

                    content.Items.Add(Convert.ToString(vitalSign.Height) + " inch");
                    td.Items.Add(content);
                    tr.Items.Add(td);
                    i = i + 1;

                    td            = hl7Factory.CreateStrucDocTd();
                    content       = hl7Factory.CreateStrucDocContent();
                    content.XmlId = "vit" + (i);

                    content.Items.Add(Convert.ToString(vitalSign.WEIGHT) + " Kg");
                    td.Items.Add(content);
                    tr2.Items.Add(td);
                    i = i + 1;

                    td            = hl7Factory.CreateStrucDocTd();
                    content       = hl7Factory.CreateStrucDocContent();
                    content.XmlId = "vit" + (i);

                    content.Items.Add(Convert.ToString(vitalSign.BloodPressure) + " mmHg");
                    td.Items.Add(content);
                    tr3.Items.Add(td);
                    i = i + 1;
                }

                tbody.Tr.Add(tr);
                tbody.Tr.Add(tr2);
                tbody.Tr.Add(tr3);
                if (arrVitalSign.Count > 0)
                {
                    functionalStatus.Section.Text.Items.Add(tble);
                }
                else
                {
                    IStrucDocParagraph paragraph = hl7Factory.CreateStrucDocParagraph();
                    paragraph.Items.Add("N/A");
                    functionalStatus.Section.Text.Items.Add(paragraph);
                }
            }
        }