コード例 #1
0
        public SocialHistoryModel FillSocialHistory(IEntryCollection entryCollection)
        {
            SocialHistoryModel ptSocialHistory = new SocialHistoryModel();

            foreach (IEntry singleentry in entryCollection)
            {
                IObservation socialObservation = singleentry.AsObservation;
                if (socialObservation.TemplateId.Select(s => s.Root.ToString()).FirstOrDefault() == "2.16.840.1.113883.10.20.22.4.38")
                {
                    ICD     socialCode    = socialObservation.Code;
                    IIVL_TS effectiveTime = socialObservation.EffectiveTime;
                    if (socialCode.Code == "230056004" || socialCode.Code == "229819007")
                    {
                        ptSocialHistory.Smoker = socialCode.Code != null ? socialCode.Code : null;
                    }
                    if (socialCode.Code == "160573003")
                    {
                        //ptSocialHistory.EntryDate = effectiveTime != null ? effectiveTime.Low != null ? effectiveTime.Low.Value != null ? effectiveTime.Low.Value.ToString() : null : null : null;
                        ptSocialHistory.Alcohol = socialCode.Code != null ? socialCode.Code : null;
                    }
                    if (socialCode.Code == "363908000")
                    {
                        //ptSocialHistory.EntryDate = effectiveTime != null ? effectiveTime.Low != null ? effectiveTime.Low.Value != null ? effectiveTime.Low.Value.ToString() : null : null : null;
                        ptSocialHistory.Drugs = socialCode.Code != null ? socialCode.Code : null;
                    }
                    if (socialCode.Code == "81703003")
                    {
                        //ptSocialHistory.EntryDate = effectiveTime != null ? effectiveTime.Low != null ? effectiveTime.Low.Value != null ? effectiveTime.Low.Value.ToString() : null : null : null;
                        ptSocialHistory.Tobacoo = socialCode.Code != null ? socialCode.Code : null;
                    }
                    ptSocialHistory.EntryDate = effectiveTime != null ? effectiveTime.Low != null ? effectiveTime.Low.Value != null?effectiveTime.Low.Value.ToString() : null : null : null;
                }
            }
            return(ptSocialHistory);
        }
コード例 #2
0
        private void FillSocialHistoryContent(SocialHistoryModel ptSocialHistory, Factory hl7factory)
        {
            if (ptSocialHistory != null)
            {
                managetable = new GenerateTableBodyStructure();
                DataArr     = new ArrayList();
                DataArr.Add("Social History Element");
                DataArr.Add("Description");
                DataArr.Add("Effective Dates");
                tble  = hl7factory.CreateStrucDocTable();
                thead = tble.Thead;
                tbody = tble.Tbody.Append();
                tr    = thead.Tr.Append();
                managetable.CreateTableHeader(DataArr, hl7factory, tble, thead, tr);
                //isExistTbody = "false";
                int i = 1;
                ///' Smoking Status ''''

                if (ptSocialHistory != null && !string.IsNullOrEmpty(ptSocialHistory.Smoker))
                {
                    SocialHistoryTRFill(ref i, ptSocialHistory.Smoker, "Smoking", Convert.ToDateTime(ptSocialHistory.EntryDate), hl7factory, tble, tbody, tr);
                    //isExistTbody = "true";
                }

                if (ptSocialHistory != null)
                {
                    if (!string.IsNullOrEmpty(ptSocialHistory.Alcohol))
                    {
                        SocialHistoryTRFill(ref i, ptSocialHistory.Alcohol, "Alcohol consumption", Convert.ToDateTime(ptSocialHistory.EntryDate), hl7factory, tble, tbody, tr);
                        //isExistTbody = "true";
                    }

                    if (!string.IsNullOrEmpty(ptSocialHistory.Drugs))
                    {
                        SocialHistoryTRFill(ref i, ptSocialHistory.Drugs, "Drug consumption", Convert.ToDateTime(ptSocialHistory.EntryDate), hl7factory, tble, tbody, tr);
                        //isExistTbody = "true";
                    }

                    if (!string.IsNullOrEmpty(ptSocialHistory.Tobacoo))
                    {
                        SocialHistoryTRFill(ref i, ptSocialHistory.Tobacoo, "Tobacoo consumption", Convert.ToDateTime(ptSocialHistory.EntryDate), hl7factory, tble, tbody, tr);
                        //isExistTbody = "true";
                    }
                }
                functionalStatus.Section.Text.Items.Add(tble);
            }
            else
            {
                contentItem = hl7factory.CreateStrucDocContent();
                contentItem.Items.Add("Social History N/A");
                functionalStatus.Section.Text.Items.Add(contentItem);
            }
        }
コード例 #3
0
        /// <summary>
        /// Patient Social History Information
        /// </summary>
        /// <param name="dataArr"></param>
        /// <returns></returns>
        public SocialHistoryModel GetSocialHistory(Dictionary <string, ArrayList> dataArr)
        {
            SocialHistoryModel ptSocialHistory = new SocialHistoryModel();

            if (dataArr.Count > 0)
            {
                for (int i = 0; i < dataArr.Count; i++)
                {
                    ArrayList itemSocialHistory = dataArr[i.ToString()];
                    ptSocialHistory.Smoker    = itemSocialHistory[1].ToString();
                    ptSocialHistory.EntryDate = null;
                }
            }
            return(ptSocialHistory);
        }
コード例 #4
0
        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);
        }