public List <ProcedureList> FillProcedure(IEntryCollection entryCollection)
        {
            List <ProcedureList> procedureList = new List <ProcedureList>();

            foreach (IEntry entryitem in entryCollection)
            {
                IProcedure entryProcedure = entryitem.AsProcedure;
                if (entryProcedure != null)
                {
                    IObservation entryObservatio = entryitem.AsObservation;
                    ICD          meterialCode;
                    //if (entryProcedure != null)
                    //{
                    //    meterialCode = entryProcedure.Code;
                    //}
                    //else
                    //{
                    //    meterialCode = entryObservatio.Code;
                    //}
                    meterialCode = entryProcedure.Code;
                    ProcedureList ptprocedureList = new ProcedureList();
                    ptprocedureList.CPTCodes    = meterialCode.Code;
                    ptprocedureList.Description = meterialCode.DisplayName;
                    procedureList.Add(ptprocedureList);
                }
            }

            return(procedureList);
        }
        public List <LabResult> FillLabResults(IEntryCollection entryCollection)
        {
            List <LabResult> labResult = new List <LabResult>();

            foreach (IEntry entryitem in entryCollection)
            {
                IOrganizer            entryOrganizer = entryitem.AsOrganizer;
                IComponent4Collection entryComponent = entryOrganizer.Component;
                LabResult             ptLabResult    = new LabResult();
                foreach (IComponent4 obserComponent in entryComponent)
                {
                    IObservation    entryObservation = obserComponent.AsObservation;
                    IReferenceRange referenceRange   = entryObservation.ReferenceRange.FirstOrDefault();
                    meterialCode = entryObservation.Code;
                    try{ valueCode = (IPQ)entryObservation.Value[0]; }catch (Exception) {}
                    ptLabResult.TestPerformed = meterialCode.DisplayName;
                    ptLabResult.ReportDate    = entryObservation.EffectiveTime == null ? null : new DateTime?(Convert.ToDateTime(entryObservation.EffectiveTime.AsDateTime));
                    ptLabResult.LonicCode     = meterialCode.Code;
                    ptLabResult.Units         = valueCode != null?valueCode.Unit.ToString() : string.Empty;

                    ptLabResult.TestResultn = valueCode != null?valueCode.Value.ToString():string.Empty;

                    ptLabResult.NormalFindings = referenceRange != null ? referenceRange.ObservationRange.Text != null ? referenceRange.ObservationRange.Text.Text : null : null;
                }
                labResult.Add(ptLabResult);
            }

            return(labResult);
        }
        public List <PlanOfCare> FillPlanOfCare(IEntryCollection entryCollection)
        {
            List <PlanOfCare> planOfCare = new List <PlanOfCare>();

            foreach (IEntry singleRecord in entryCollection)
            {
                IObservation observation  = singleRecord.AsObservation;
                IAct         entryAct     = singleRecord.AsAct;
                string       goal         = null;
                string       instructions = null;
                if (observation != null)
                {
                    meterialCode = observation.Code;
                    goal         = meterialCode.DisplayName;
                    datetime     = observation.EffectiveTime;
                }
                if (entryAct != null)
                {
                    instructions = entryAct.Text.Text;
                }
                PlanOfCare ptPlanOfCare = new PlanOfCare();
                ptPlanOfCare.Goal         = goal;
                ptPlanOfCare.PlannedDate  = datetime != null ? datetime.Center != null ? new DateTime?(datetime.Center.AsDateTime) : null : null;
                ptPlanOfCare.Instructions = instructions;
                planOfCare.Add(ptPlanOfCare);
            }


            return(planOfCare);
        }
        public List <PatientProblemes> FillProblems(IEntryCollection entryCollection)
        {
            List <PatientProblemes> Problemes = new List <PatientProblemes>();

            foreach (IEntry singleentry in entryCollection)
            {
                IObservation     probObservation = singleentry.AsAct.EntryRelationship.FirstOrDefault().AsObservation;
                IIVL_TS          effectivetime   = probObservation.EffectiveTime;
                IANY             probValue       = probObservation.Value[0];
                ICD              itemVlues       = (ICD)probValue;
                PatientProblemes ptproblem       = new PatientProblemes();
                ptproblem.ProblemCode = itemVlues.Code != null ? itemVlues.Code : null;
                IEntryRelationship ObserentryRelation = probObservation.EntryRelationship.Where(e => e.AsObservation.Code.Code.ToString() == "33999-4").FirstOrDefault();
                if (ObserentryRelation != null)
                {
                    IANY probStatusVal = ObserentryRelation.AsObservation.Value.FirstOrDefault();
                    ICD  StatusVlues   = (ICD)probStatusVal;
                    ptproblem.Status = StatusVlues.DisplayName;
                }
                else
                {
                    ptproblem.Status = null;
                }
                ptproblem.DateDiagnosed = effectivetime.Low != null ? effectivetime.Low.Value != null?effectivetime.Low.AsDateTime.ToString() : null : null;

                ptproblem.Description = itemVlues.DisplayName != null ? itemVlues.DisplayName : null;
                Problemes.Add(ptproblem);
            }
            return(Problemes);
        }
        public List <Encounters> FillEncounters(IEntryCollection entryCollection, string name)
        {
            List <Encounters> encounters = new List <Encounters>();

            foreach (IEntry entryitem in entryCollection)
            {
                Encounters         ptEncounters      = new Encounters();
                IEncounter         entryEncounter    = entryitem.AsEncounter;
                IEntryRelationship entryRelationItem = entryEncounter.EntryRelationship.FirstOrDefault();
                if (entryRelationItem != null)
                {
                    IObservation observation = entryRelationItem.AsObservation;
                    IIVL_TS      efftime     = observation.EffectiveTime;
                    if (efftime == null)
                    {
                        throw new InvalidOperationException();
                    }
                    IANY   observationvalue = observation.Value.FirstOrDefault();
                    ICD    str      = (ICD)observationvalue;
                    string location = observation.Participant.Count > 0 ? observation.Participant[0].ParticipantRole.AsPlayingEntity.Name[0].Text : null;
                    ptEncounters.Code = str.Code;
                    ptEncounters.EncounterDescription = str.DisplayName;
                    ptEncounters.PerformerName        = name;
                    //ptEncounters.EncounterDate = efftime != null ? efftime.Low != null ? efftime.Low.Value != null ? new DateTime?(Convert.ToDateTime(efftime.Low.AsDateTime)) : null : null : efftime.Value != null ? new DateTime?(Convert.ToDateTime(efftime.AsDateTime)) : null;
                }
                encounters.Add(ptEncounters);
            }

            return(encounters);
        }
        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);
        }
        public void GenerateSocialHistoryEmpty(III hl7III, Factory hl7Factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.AsObservation.ClassCode = "OBS";
            entry.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            IIVXB_TS TS = hl7Factory.CreateIVXB_TS();

            hl7III = entry.AsObservation.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            hl7III = entry.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.78");
            IED ED = hl7Factory.CreateED();

            entry.AsObservation.Code.Code           = "ASSERTION";
            entry.AsObservation.Code.DisplayName    = "Assertion";
            entry.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.5.4";
            entry.AsObservation.Code.CodeSystemName = "ActCode";
            entry.AsObservation.StatusCode.Init("completed");
            entry.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS(), high: new IVXB_TS());
            ICD CD = hl7Factory.CreateCD();

            CD.NullFlavor = "UNK";
            entry.AsObservation.Value.Add(CD);
        }
        public List <VitalSigns> FillVitalSigns(IEntryCollection entryCollection)
        {
            List <VitalSigns> vitalSigns = new List <VitalSigns>();

            foreach (IEntry singleentry in entryCollection)
            {
                IOrganizer            organizer = singleentry.AsOrganizer;
                IComponent4Collection component = organizer.Component;
                IIVL_TS effectivetime           = organizer.EffectiveTime;
                if (effectivetime == null)
                {
                    throw new InvalidOperationException();
                }
                VitalSigns ptvitalSigns = new VitalSigns();
                try
                {
                    ptvitalSigns.VitalDate = effectivetime.AsDateTime;
                }
                catch (Exception)
                {
                    ptvitalSigns.VitalDate = effectivetime != null ? effectivetime.Low != null ? effectivetime.Low.Value != null ? new DateTime?(effectivetime.Low.AsDateTime) : null : null : effectivetime.Value != null ? new DateTime?(effectivetime.AsDateTime) : new DateTime?(effectivetime.AsDateTime);
                }


                foreach (IComponent4 orgComponent in component)
                {
                    IObservation orgObservation             = orgComponent.AsObservation;
                    ICD          itemCode                   = orgObservation.Code;
                    IANY         vitalSignsObservationValue = orgObservation.Value[0];
                    IPQ          itemVlues                  = (IPQ)vitalSignsObservationValue;

                    if (itemCode.Code != null)
                    {
                        if (itemCode.Code.ToString() == "8302-2")
                        {
                            ptvitalSigns.Height     = Convert.ToInt16(itemVlues.Value);
                            ptvitalSigns.HeightUnit = Convert.ToString(itemVlues.Unit);
                        }
                        if (itemCode.Code.ToString() == "3141-9")
                        {
                            ptvitalSigns.WEIGHT     = Convert.ToInt16(itemVlues.Value);
                            ptvitalSigns.WeightUnit = Convert.ToString(itemVlues.Unit);
                        }
                        if (itemCode.Code.ToString() == "8480-6")
                        {
                            ptvitalSigns.BloodPressure         = itemVlues.Value.ToString() + " " + itemVlues.Unit.ToString();
                            ptvitalSigns.BloodPressureSystolic = itemVlues.Value.ToString();
                        }

                        if (itemCode.Code.ToString() == "8462-4")
                        {
                            ptvitalSigns.BloodPressureDiastolic = itemVlues.Value.ToString();
                        }
                    }
                }
                vitalSigns.Add(ptvitalSigns);
            }
            return(vitalSigns);
        }
        public void GenerateProblemEntryEmpty(string refId, III hl7III, Factory hl7Factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.TypeCode        = x_ActRelationshipEntry.DRIV;
            entry.AsAct.ClassCode = x_ActClassDocumentEntryAct.ACT;
            entry.AsAct.MoodCode  = x_DocumentActMood.EVN;
            IIVXB_TS TS = hl7Factory.CreateIVXB_TS();

            hl7III = entry.AsAct.Id.Append();
            hl7III.Init(Convert.ToString(Guid.NewGuid()));
            hl7III = entry.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.3");
            entry.AsAct.Code.Code           = "CONC";
            entry.AsAct.Code.CodeSystem     = "2.16.840.1.113883.5.6";
            entry.AsAct.Code.CodeSystemName = "HL7ActClass";
            entry.AsAct.Code.DisplayName    = "Concern";
            entry.AsAct.StatusCode.Init("completed");
            entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
            IEntryRelationship entryRel = entry.AsAct.EntryRelationship.Append();

            entryRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryRel.AsObservation.ClassCode            = "OBS";
            entryRel.AsObservation.MoodCode             = x_ActMoodDocumentObservation.EVN;
            entryRel.AsObservation.NegationInd          = true;
            entryRel.AsObservation.NegationIndSpecified = true;
            III TempId = entryRel.AsObservation.TemplateId.Append();

            TempId.Root = "2.16.840.1.113883.10.20.22.4.4";
            hl7III      = entryRel.AsObservation.Id.Append();
            hl7III.Root = Guid.NewGuid().ToString();
            entryRel.AsObservation.Code.Code           = "55607006";
            entryRel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.96";
            entryRel.AsObservation.Code.DisplayName    = "Problem";
            entryRel.AsObservation.Code.CodeSystemName = "SNOMED CT";
            IED ED = hl7Factory.CreateED();

            ED.Reference.Value          = refId;
            entryRel.AsObservation.Text = ED;
            ICS CS = hl7Factory.CreateCS();

            CS.Init("completed");
            entryRel.AsObservation.StatusCode    = CS;
            entryRel.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS(), high: new IVXB_TS());
            ICD CD = hl7Factory.CreateCD();

            CD.Code           = "55607006";
            CD.CodeSystem     = "2.16.840.1.113883.6.96";
            CD.CodeSystemName = "SNOMED CT";
            CD.DisplayName    = Convert.ToString("Problem");
            entryRel.AsObservation.Value.Add(CD);
        }
Exemple #10
0
        public string HienThiICD(string id)
        {
            ICD list = new ICD();

            list = ICDRepository.ShowICD(id);
            if (list.maicd == null)
            {
                return("NULL");
            }
            var convertedJson = JsonConvert.SerializeObject(list);

            return(convertedJson);
        }
Exemple #11
0
        ///<summary>
        /// Returns a single repetition of Pre-Certification Requirement(IN3-20).
        /// throws HL7Exception if the repetition number is invalid.
        /// <param name="rep">The repetition number (this is a repeating field)</param>
        ///</summary>
        public ICD GetPreCertificationRequirement(int rep)
        {
            ICD ret = null;

            try
            {
                IType t = this.GetField(20, rep);
                ret = (ICD)t;
            } catch (System.Exception ex) {
                HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", ex);
                throw new System.Exception("An unexpected error ocurred", ex);
            }
            return(ret);
        }
Exemple #12
0
        /// <summary> Returns a single repetition of Pre-Certification Requirement (IN3-20).</summary>
        /// <param name="rep">the repetition number (this is a repeating field)
        /// </param>
        /// <throws>  HL7Exception if the repetition number is invalid. </throws>
        public virtual ICD getPreCertificationRequirement(int rep)
        {
            ICD ret = null;

            try
            {
                Type t = this.getField(20, rep);
                ret = (ICD)t;
            }
            catch (System.InvalidCastException)
            {
                throw new Exception();
            }
            return(ret);
        }
Exemple #13
0
 ///<summary>
 /// Returns all repetitions of Pre-Certification Requirement (IN3-20).
 ///</summary>
 public ICD[] GetPreCertificationRequirement()
 {
     ICD[] ret = null;
     try {
         IType[] t = this.GetField(20);
         ret = new ICD[t.Length];
         for (int i = 0; i < ret.Length; i++)
         {
             ret[i] = (ICD)t[i];
         }
     } catch (HL7Exception he) {
         HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", he);
         throw new System.Exception("An unexpected error ocurred", he);
     } catch (System.Exception cce) {
         HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", cce);
         throw new System.Exception("An unexpected error ocurred", cce);
     }
     return(ret);
 }
        public List <FunctionalStatus> FillFunctionalStatus(IEntryCollection entryCollection)
        {
            List <FunctionalStatus> functionalStatus = new List <FunctionalStatus>();

            foreach (IEntry entryitem in entryCollection)
            {
                IObservation     entryObservation = entryitem.AsObservation;
                IIVL_TS          effectiveDate    = entryObservation.EffectiveTime;
                IANY             functionalValue  = entryObservation.Value[0];
                ICD              cD = (ICD)functionalValue;
                FunctionalStatus ptfunctionalStatus = new FunctionalStatus();
                ptfunctionalStatus.StatusDate  = effectiveDate != null ? effectiveDate.Low != null ? effectiveDate.Low.Value != null ? new DateTime?(effectiveDate.Low.AsDateTime) : null : null : null;
                ptfunctionalStatus.Description = cD.DisplayName;
                ptfunctionalStatus.Code        = cD.Code;
                functionalStatus.Add(ptfunctionalStatus);
            }

            return(functionalStatus);
        }
Exemple #15
0
 /// <summary> Returns all repetitions of Pre-Certification Requirement (IN3-20).</summary>
 public virtual ICD[] getPreCertificationRequirement()
 {
     ICD[] ret = null;
     try
     {
         Type[] t = this.getField(20);
         ret = new ICD[t.Length];
         for (int i = 0; i < ret.Length; i++)
         {
             ret[i] = (ICD)t[i];
         }
     }
     catch (System.InvalidCastException)
     {
         throw new Exception();
     }
     catch (NuGenHL7Exception)
     {
         throw new Exception();
     }
     return(ret);
 }
Exemple #16
0
 public async Task Create(ICDDto dto)
 {
     try
     {
         using (DHContext db = new DHContext())
         {
             ICD entity = new ICD
             {
                 Id          = Guid.NewGuid(),
                 Code        = dto.Code,
                 Description = dto.Description,
                 Name        = dto.Name
             };
             db.ICDs.Add(entity);
             await db.SaveChangesAsync();
         }
     }
     catch (Exception exc)
     {
         _logger.Error($"Failed create ICD : {exc}");
     }
 }
Exemple #17
0
        public static ICD ShowICD(string id)
        {
            string query = "SELECT * FROM current.dmicd WHERE maicd=@maicd";
            ICD    icd   = new ICD();

            try
            {
                conn.Open();
                NpgsqlCommand cmd = new NpgsqlCommand(query, conn);
                cmd.Parameters.Add("@maicd", NpgsqlDbType.Varchar).Value = id;
                var reader = cmd.ExecuteReader();

                icd = new ICD(reader.GetString(0), reader.GetString(1));

                conn.Close();
            }
            catch (Exception e)
            {
                conn.Close();
                Console.WriteLine(e.Message);
            }
            return(icd);
        }
Exemple #18
0
 private void ShieldCDFinish(ICD userData)
 {
     this.RemoveComponent(this.m_ShieldCDComponent);
     this.m_ShieldCDComponent = null;
 }
Exemple #19
0
        public string BindRecordTarget(string title, ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo)
        {
            string recordtarget = string.Empty;
            var    targetrole   = clinicalDoc.RecordTarget.Append();
            var    PRole        = targetrole.PatientRole;

            hl7III = PRole.Id.Append();
            string SSN = string.Empty;

            if (patientinfo.ptDemographicDetail.SSN != "")
            { /// MANAGE Patient SSN
                SSN = patientinfo.ptDemographicDetail.SSN;
            }
            hl7III.Init("2.16.840.1.113883.19.5", SSN); /// Manage ID Tag UNDER Record Target
                                                        ///Patient Address Information
            addressinfo         = new AddressModel();
            addressinfo.street  = patientinfo.ptDemographicDetail.Street;
            addressinfo.city    = patientinfo.ptDemographicDetail.City;
            addressinfo.state   = patientinfo.ptDemographicDetail.State;
            addressinfo.country = patientinfo.ptDemographicDetail.Country;
            addressinfo.pinCode = Convert.ToString(patientinfo.ptDemographicDetail.Zip);
            ///END
            ///Fill Address
            addressphno = new GenerateAddressPhNo();
            PRole.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory)); ///FIll Patient Address
                                                                                  ///END
                                                                                  ///Patient Contact Information
            contactinfo             = new PhNoModel();
            contactinfo.telcomUse   = "WP";
            contactinfo.telcomValue = patientinfo.ptDemographicDetail.ContactNo;
            contactinfo.nullFlavor  = "UNK";
            PRole.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory)); ///FIll Patient Contact Number
                                                                                  ///END
            var PatientName = targetrole.PatientRole.Patient.Name.Append();       ///Manage Patient Name

            //Fill Patient Name
            nameinfo = new NameModel();
            nameinfo.Createengiven  = patientinfo.ptDemographicDetail.FirstName;
            nameinfo.Createenfamily = patientinfo.ptDemographicDetail.LastName;
            addressphno.FillName(nameinfo, PatientName, hl7factory);                                                       ///FIll Patient Name
            //End
            var Patientbesic = targetrole.PatientRole.Patient;                                                             ///Manage Patient Gender

            Patientbesic.AdministrativeGenderCode.CodeSystem = "2.16.840.1.113883.5.1";                                    ///FIll Patient Gender Value Constraint
            Patientbesic.AdministrativeGenderCode.Code       = patientinfo.ptDemographicDetail.gender;                     //////FIll Patient Gender
            if (patientinfo.ptDemographicDetail.DateofBirth != "")                                                         ///Manage Patient DOB
            {
                Patientbesic.BirthTime.Value = addressphno.GetDateWithFormat(patientinfo.ptDemographicDetail.DateofBirth); ///Fill Patient DOB
            }
            if (patientinfo.ptDemographicDetail.Race != null && patientinfo.ptDemographicDetail.Race != "")                ///Manage Patient Race
            {
                string[] race = patientinfo.ptDemographicDetail.Race.Split(',');
                for (int i = 0; i < race.Length; i++)
                {
                    ICD icdObjects = hl7factory.CreateCD();
                    switch (race[i].ToString())
                    {
                    case "American Indian or Alaska Native":
                        Patientbesic.RaceCode.Code           = "1002-5";
                        Patientbesic.RaceCode.DisplayName    = "American Indian or Alaska Native";
                        Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    case "Asian":
                        Patientbesic.RaceCode.Code           = "2028-9";
                        Patientbesic.RaceCode.DisplayName    = "Asian";
                        Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    case "Black or African American":
                        Patientbesic.RaceCode.Code           = "2054-5";
                        Patientbesic.RaceCode.DisplayName    = "Black or African American";
                        Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    case "Hispanic or Latino":
                        Patientbesic.RaceCode.Code           = "2135-2";
                        Patientbesic.RaceCode.DisplayName    = "Hispanic or Latino";
                        Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    case "Native Hawaiian or Pacific Islander":
                        Patientbesic.RaceCode.Code           = "2076-8";
                        Patientbesic.RaceCode.DisplayName    = "Native Hawaiian or Pacific Islander";
                        Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    case "White":
                        Patientbesic.RaceCode.Code           = "2106-3";
                        Patientbesic.RaceCode.DisplayName    = "White";
                        Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    case "Some Other Race":
                        Patientbesic.RaceCode.Code           = "2131-1";
                        Patientbesic.RaceCode.DisplayName    = "White";
                        Patientbesic.RaceCode.CodeSystem     = "Some Other Race";
                        Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                        break;

                    default:
                        Patientbesic.RaceCode.NullFlavor = "UNK";
                        break;
                    }
                }
            }
            if (patientinfo.ptDemographicDetail.Ethnicity != null && patientinfo.ptDemographicDetail.Ethnicity != "")///Manage Patient Ethnicity
            {
                switch (patientinfo.ptDemographicDetail.Ethnicity)
                {
                case "Hispanic or Latino":
                    Patientbesic.EthnicGroupCode.Code    = "2135-2";
                    Patientbesic.RaceCode.DisplayName    = "Hispanic or Latino";
                    Patientbesic.RaceCode.CodeSystem     = "2.16.840.1.113883.6.238";
                    Patientbesic.RaceCode.CodeSystemName = "Race & Ethnicity - CDC";
                    break;

                case "Not Hispanic or Latino":
                    Patientbesic.EthnicGroupCode.Code           = "2186-5";
                    Patientbesic.EthnicGroupCode.DisplayName    = "Not Hispanic or Latino";
                    Patientbesic.EthnicGroupCode.CodeSystem     = "2.16.840.1.113883.6.238";
                    Patientbesic.EthnicGroupCode.CodeSystemName = "Race & Ethnicity - CDC";
                    break;

                default:
                    Patientbesic.EthnicGroupCode.NullFlavor = "UNK";
                    break;
                }
            }
            if (patientinfo.ptDemographicDetail.LanguageCode != null && patientinfo.ptDemographicDetail.LanguageCode != "")///Manage Patient LanguageCode
            {
                ILanguageCommunication langComm = hl7factory.CreateLanguageCommunication();
                langComm.LanguageCode.Code            = patientinfo.ptDemographicDetail.LanguageCode;
                langComm.PreferenceInd.ValueSpecified = true;
                langComm.PreferenceInd.Value          = true;
                Patientbesic.LanguageCommunication.Add(langComm);
            }
            return(clinicalDoc.Xml);
        }
Exemple #20
0
        public Dictionary <string, ArrayList> GetDataCollection(ISection sections, PatientClinicalInformation ptInformation)
        {
            Dictionary <string, ArrayList> componententries = new Dictionary <string, ArrayList>();
            IEntryCollection           entries     = sections.Entry;
            IStrucDocText              sectiontext = sections.Text;
            IStrucDocElementCollection textitem    = sectiontext.Items;

            if (entries.Count() > 0)
            {
                int count = 0;
                foreach (IEntry singlerecord in entries)
                {
                    itemAct       = singlerecord.AsAct;
                    itemEncounter = singlerecord.AsEncounter;
                    itemSubstanceAdministration = singlerecord.AsSubstanceAdministration;
                    observation = singlerecord.AsObservation;
                    organizer   = singlerecord.AsOrganizer;
                    procedure   = singlerecord.AsProcedure;
                    //if(sections.Code.Code== "18776-5")
                    // {

                    // }
                    ArrayList arrayList = new ArrayList();
                    if (itemAct != null)
                    {
                        entryRelationship = itemAct.EntryRelationship;
                        IIVL_TS efftime = itemAct.EffectiveTime;
                        if (efftime != null && efftime.Low != null)
                        {
                            if (efftime.Low.Value != null)
                            {
                                arrayList.Add(efftime.Low.AsDateTime.ToString());
                            }
                            else
                            {
                                arrayList.Add("null");
                            }
                        }
                        else
                        {
                            arrayList.Add("null");
                        }
                        if (entryRelationship != null && entryRelationship.Count > 0)
                        {
                            observation = entryRelationship.Select(o => o.AsObservation).FirstOrDefault();
                            if (observation != null)
                            {
                                if (observation.Participant.Count() > 0)
                                {
                                    string participent = observation.Participant.Select(p => p.ParticipantRole).FirstOrDefault().AsPlayingEntity.Name.FirstOrDefault().Text;
                                    arrayList.Add(participent);
                                }

                                entity = observation.EntryRelationship;
                                foreach (IEntryRelationship singlentity in entity)
                                {
                                    IObservation entityobservation = singlentity.AsObservation;
                                    IANY         observationvalue  = entityobservation.Value.FirstOrDefault();
                                    if (observationvalue != null)
                                    {
                                        var    obj     = observationvalue.GetType();
                                        string objname = obj.Name;
                                        switch (objname)
                                        {
                                        default:
                                            ICD strcd = (ICD)observationvalue;
                                            arrayList.Add(strcd.Code);
                                            arrayList.Add(strcd.DisplayName);
                                            break;

                                        case "PQ":
                                            IPQ strpq = (IPQ)observationvalue;
                                            arrayList.Add(strpq.Value.ToString() + " " + strpq.Unit.ToString());
                                            break;
                                        }
                                    }
                                }

                                componententries.Add(count.ToString(), arrayList);
                                count++;
                            }
                        }
                        else
                        {
                            arrayList.Add(itemAct.Text.Text);
                            componententries.Add(count.ToString(), arrayList);
                            count++;
                        }
                    }
                    else if (itemEncounter != null)
                    {
                        entryRelationship = itemEncounter.EntryRelationship;
                        if ((entryRelationship.Select(t => t.TypeCode).FirstOrDefault().ToString()) == "RSON")
                        {
                            observation = entryRelationship.Select(o => o.AsObservation).FirstOrDefault();
                            IIVL_TS efftime          = observation.EffectiveTime;
                            IANY    observationvalue = observation.Value.FirstOrDefault();
                            ICD     str = (ICD)observationvalue;
                            arrayList.Add(str.DisplayName);
                            arrayList.Add(ptInformation.ptClinicInformation.ClinicName);
                            if (efftime.Low != null)
                            {
                                arrayList.Add(efftime.Low.AsDateTime);
                            }
                            else
                            {
                                arrayList.Add(null);
                            }
                            arrayList.Add(str.Code);
                        }

                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (itemSubstanceAdministration != null)
                    {
                        consumable          = itemSubstanceAdministration.Consumable;
                        manufacturedProduct = consumable.ManufacturedProduct;
                        material            = manufacturedProduct.AsMaterial;
                        arrayList.Add(material.Code.Code);
                        arrayList.Add(itemSubstanceAdministration.StatusCode.Code.ToString());
                        ISXCM_TSCollection efftime = itemSubstanceAdministration.EffectiveTime;
                        if (efftime.Count > 1)
                        {
                            foreach (IVL_TS daterange in efftime)
                            {
                                string startdatetime = daterange.Low != null ? daterange.Low.Value != null?daterange.Low.AsDateTime.ToString() : "null" : "null";

                                string EndDAtetime = daterange.High != null ? daterange.High.Value != null?daterange.High.AsDateTime.ToString() : "null" : "null";

                                arrayList.Add(startdatetime);
                                arrayList.Add(EndDAtetime);
                                break;
                            }
                        }
                        else
                        {
                            arrayList.Add(efftime[0].AsDateTime.ToString());
                        }

                        arrayList.Add(material.Code.DisplayName);
                        if (itemSubstanceAdministration.DoseQuantity != null)
                        {
                            arrayList.Add(itemSubstanceAdministration.DoseQuantity.Value.ToString() + " " + itemSubstanceAdministration.DoseQuantity.Unit.ToString());
                        }
                        else
                        {
                            arrayList.Add("NA");
                        }
                        if (manufacturedProduct.ManufacturerOrganization != null)
                        {
                            arrayList.Add(manufacturedProduct.ManufacturerOrganization.Name.ToString());
                        }
                        else
                        {
                            arrayList.Add("NA");
                        }

                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (observation != null)
                    {
                        if (observation.Value.Count > 0)
                        {
                            IANY observationvalue = observation.Value.FirstOrDefault();
                            ICD  str = (ICD)observationvalue;
                            arrayList.Add(str.Code);
                            arrayList.Add(str.DisplayName);
                            IIVL_TS efftime = observation.EffectiveTime;
                            if (efftime != null && efftime.Low != null)
                            {
                                if (efftime.Low.Value != null)
                                {
                                    arrayList.Add(efftime.Low.AsDateTime.ToString());
                                }
                                else
                                {
                                    arrayList.Add("null");
                                }
                            }
                            else
                            {
                                arrayList.Add("null");
                            }
                        }
                        else
                        {
                            arrayList.Add(null);
                            arrayList.Add(null);
                            arrayList.Add(null);
                        }

                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (organizer != null)
                    {
                        IComponent4Collection orgComponent = organizer.Component;

                        foreach (IComponent4 objItem in orgComponent)
                        {
                            IObservation orgObservation = objItem.AsObservation;
                            arrayList.Add(orgObservation.Code.DisplayName);
                            if (orgObservation.Value != null)
                            {
                                IANY   observationvalue = orgObservation.Value.FirstOrDefault();
                                var    obj     = observationvalue.GetType();
                                string objname = obj.Name;

                                switch (objname)
                                {
                                default:
                                    ICD strcd = (ICD)observationvalue;
                                    arrayList.Add(strcd.Code);
                                    arrayList.Add(strcd.DisplayName);
                                    break;

                                case "PQ":
                                    IPQ strpq = (IPQ)observationvalue;
                                    arrayList.Add(strpq.Value.ToString() + " " + strpq.Unit.ToString());
                                    break;
                                }
                                //IPQ str = (IPQ)observationvalue;
                                //arrayList.Add(str.Value.ToString() + " " + str.Unit.ToString());
                            }
                            IIVL_TS efftime = orgObservation.EffectiveTime;
                            if (efftime != null && efftime.Low != null)
                            {
                                if (efftime.Low.Value != null)
                                {
                                    arrayList.Add(efftime.Low.AsDateTime.ToString());
                                }
                                else
                                {
                                    arrayList.Add("null");
                                }
                            }
                            else
                            {
                                arrayList.Add("null");
                            }
                            if (orgObservation.ReferenceRange != null)
                            {
                                if (orgObservation.ReferenceRange.Count > 0)
                                {
                                    arrayList.Add(orgObservation.ReferenceRange[0].ObservationRange.Text.Text);
                                }
                                else
                                {
                                    arrayList.Add("NA");
                                }
                            }
                        }
                        arrayList.Add(organizer.Code.Code);
                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                    else if (procedure != null)
                    {
                        if (procedure.Code != null)
                        {
                            arrayList.Add(procedure.Code.Code);
                            arrayList.Add(procedure.Code.DisplayName);
                        }
                        else
                        {
                            arrayList.Add(null);
                            arrayList.Add(null);
                        }
                        componententries.Add(count.ToString(), arrayList);
                        count++;
                    }
                }
            }

            return(componententries);
        }
        public void GenerateSocialHistoryEntry(string observerValue, ref int refId, string obsrvType, III hl7III, Factory hl7Factory)
        {
            if (obsrvType == "Smoking")
            {
                IEntry entry = functionalStatus.Section.Entry.Append();
                //GetSNOMED(obsrvType)
                entry.AsObservation.ClassCode = "OBS";
                entry.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                IIVXB_TS TS = hl7Factory.CreateIVXB_TS();
                hl7III = entry.AsObservation.Id.Append();
                hl7III.Init(Guid.NewGuid().ToString());
                hl7III = entry.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.78");
                //entry.AsObservation.Code.Code = IIf(obsrvType = "Smoking", "230056004", IIf(obsrvType = "Alcohol", "160573003", IIf(obsrvType = "Drugs", "228423003", "229819007")))
                IED ED = hl7Factory.CreateED();
                entry.AsObservation.Code.Code           = "ASSERTION";
                entry.AsObservation.Code.DisplayName    = "Assertion";
                entry.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.5.4";
                entry.AsObservation.Code.CodeSystemName = "ActCode";
                //ED.Reference.Value = "#Sec" + refId
                //entry.AsObservation.Code.OriginalText = ED
                //entry.AsObservation.Code.CodeSystem = "2.16.840.1.113883.6.96"
                //entry.AsObservation.Code.DisplayName = IIf(obsrvType = "Smoking", "Cigarette smoking", IIf(obsrvType = "Alcohol", "Alcohol consumption", IIf(obsrvType = "Drugs", "Drugs consumption", "Tobacoo consumption")))

                entry.AsObservation.StatusCode.Init("completed");
                entry.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS(), high: new IVXB_TS());
                //entry.AsObservation.EffectiveTime.High.Value = "UNK"
                ICD CD = hl7Factory.CreateCD();
                CD.CodeSystemName = "SNOMED CT";
                //= observerValue
                CD.CodeSystem  = "2.16.840.1.113883.6.96";
                CD.Code        = "77176002";
                CD.DisplayName = "Cigarette smoking";
                CD.OriginalText.Reference.Value = "#Sec" + refId;
                entry.AsObservation.Value.Add(CD);
                refId = refId + 1;
            }
            else
            {
                IEntry entry = functionalStatus.Section.Entry.Append();
                GetSNOMED(obsrvType);
                entry.TypeCode = x_ActRelationshipEntry.DRIV;
                entry.AsObservation.ClassCode = "OBS";
                entry.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                IIVXB_TS TS = hl7Factory.CreateIVXB_TS();
                hl7III = entry.AsObservation.Id.Append();
                hl7III.Init(Guid.NewGuid().ToString());
                hl7III = entry.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.38");
                entry.AsObservation.Code.Code = (obsrvType == "Smoking" ? "230056004" : (obsrvType == "Alcohol" ? "160573003" : (obsrvType == "Drugs" ? "228423003" : "229819007")));
                IED ED = hl7Factory.CreateED();
                ED.Reference.Value = "#Sec" + refId;
                entry.AsObservation.Code.OriginalText = ED;
                entry.AsObservation.Code.CodeSystem   = "2.16.840.1.113883.6.96";
                entry.AsObservation.Code.DisplayName  = (obsrvType == "Smoking" ? "Cigarette smoking" : (obsrvType == "Alcohol" ? "Alcohol consumption" : (obsrvType == "Drugs" ? "Drugs consumption" : "Tobacoo consumption")));

                entry.AsObservation.StatusCode.Init("completed");
                entry.AsObservation.EffectiveTime.NullFlavor = "UNK";
                IST ST = hl7Factory.CreateST();
                ST.Text = observerValue;
                entry.AsObservation.Value.Add(ST);
                refId = refId + 1;
            }
        }
 private void CDFinished(ICD propsData)
 {
     this.RemoveComponent(this.m_CDComponent);
     this.m_CDComponent = null;
 }
Exemple #23
0
        public static string AddDienBienToDB(DienBien dienbien)
        {
            //validate
            BenhAn ba = BenhAnRepository.ShowBenhAn(dienbien.Maba);

            if (ba.Maba == null)
            {
                return("Bệnh án ko tồn tại");
            }
            //BenhNhan bn =BenhNhanRepository.ShowBenhNhanFromDB(dienbien.Mabn);
            //  NhanVien nv = NhanVienRepository.ShowNhanVienFromDB(dienbien.Manv);
            ICD icdchinh = ICDRepository.ShowICD(dienbien.Maicd);

            if (icdchinh.maicd == null)
            {
                return("Mã icd không tồn tại");
            }


            var tenicd = icdchinh.tenviet;
            var icdphu = new ICD();

            if (dienbien.Maicdp != "")
            {
                icdphu = ICDRepository.ShowICD(dienbien.Maicdp);
            }
            var tenicdp = dienbien.Tenicdp;


            //Cấu trúc connection
            //var connectionstring = "Server=127.0.0.1;Port=5432;User Id=postgres;Password=123456;Database=svthuctap;";
            //check benh an ton tai
            //Câu lệnh SQL thêm vào Database
            string query = "INSERT INTO current.dienbien VALUES(@Iddienbien,@mabn,@maba,@makhoa,@magiuong,@manv,@maicd,@tenicd,@maicdp,@tenicdp)";


            //Tạo kết nối tới PostgreSQL
            NpgsqlConnection conn = new NpgsqlConnection(connectstring);

            //Try thêm dữ liệu
            try
            {
                conn.Open();
                NpgsqlCommand cmd = new NpgsqlCommand(query, conn);
                cmd.Parameters.Add("@Iddienbien", NpgsqlDbType.Varchar).Value = dienbien.Iddienbien;
                cmd.Parameters.Add("@mabn", NpgsqlDbType.Varchar).Value       = dienbien.Mabn;
                cmd.Parameters.Add("@maba", NpgsqlDbType.Varchar).Value       = dienbien.Maba;
                cmd.Parameters.Add("@makhoa", NpgsqlDbType.Varchar).Value     = dienbien.Makhoa;
                cmd.Parameters.Add("@magiuong", NpgsqlDbType.Varchar).Value   = dienbien.Magiuong;
                cmd.Parameters.Add("@manv", NpgsqlDbType.Varchar).Value       = dienbien.Manv;
                cmd.Parameters.Add("@maicd", NpgsqlDbType.Varchar).Value      = dienbien.Maicd;
                cmd.Parameters.Add("@tenicd", NpgsqlDbType.Varchar).Value     = dienbien.Tenicd;
                cmd.Parameters.Add("@maicdp", NpgsqlDbType.Varchar).Value     = dienbien.Maicdp;
                cmd.Parameters.Add("@Tenicdp", NpgsqlDbType.Varchar).Value    = dienbien.Tenicdp;

                cmd.ExecuteNonQuery();
                conn.Close();

                return("Thêm thành công!");
            }
            // Bắt trường hợp lỗi
            catch (Exception e)
            {
                conn.Close();
                return(e.Message);
            }
        }
Exemple #24
0
        public static string Initialize_UsingStatementAndClassHeader(string nameSpace, string ClassName, ICD icdType)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.Append(USUtil.LoadUsingCodex(nameSpace, ""));

            strBuilder.Append("\tpublic class ");
            strBuilder.Append(ClassName);
            strBuilder.Append(icdType.ToString());
            strBuilder.Append("\r");
            strBuilder.Append("\t{");

            switch (icdType)
            {
            case ICD.Controller:
                strBuilder.Append(BuilControllerMethods(ClassName));
                break;

            case ICD.DataProvider:
                strBuilder.Append(BuilSQLDataProviderMethods(ClassName));
                break;

            case ICD.Info:
                break;
            }

            strBuilder.Append("\r");
            strBuilder.Append("\t}");

            strBuilder.Append(" \r }");//Close namespace bracket

            return(strBuilder.ToString());
        }
Exemple #25
0
 public CDComponent(ICD CDdata, float startTime)
 {
     this.m_PreviousTime = startTime;
     this.m_CD           = CDdata;
 }
Exemple #26
0
 protected void AddNewICDDataSource_Inserted(object sender, LinqDataSourceStatusEventArgs e)
 {
     insertedICD = (ICD)e.Result;
 }
Exemple #27
0
    private void BuffCDFinish(ICD buffData)
    {
        BuffData data = buffData as BuffData;

        this.m_RemoveBuff.Add(data);
    }
        public void GenerateProblemEntry(PatientProblemes patientProblem, string refId, DateTime dateofbirth, III hl7III, Factory hl7Factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.TypeCode        = x_ActRelationshipEntry.DRIV;
            entry.AsAct.ClassCode = x_ActClassDocumentEntryAct.ACT;
            entry.AsAct.MoodCode  = x_DocumentActMood.EVN;
            IIVXB_TS TS = hl7Factory.CreateIVXB_TS();

            hl7III = entry.AsAct.Id.Append();

            hl7III.Init(Convert.ToString(patientProblem.PatientGuid));
            hl7III = entry.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.3");
            entry.AsAct.Code.Code           = "CONC";
            entry.AsAct.Code.CodeSystem     = "2.16.840.1.113883.5.6";
            entry.AsAct.Code.CodeSystemName = "LOINC";

            entry.AsAct.StatusCode.Init((Convert.ToString(patientProblem.Status) == "Active" ? "active" : "completed"));
            if (patientProblem.DateDiagnosed != null)
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
            }
            else
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                //entry.AsAct.EffectiveTime.NullFlavor = "UNK";

                /* Not Compiled
                 * entry.AsAct.EffectiveTime = new IVL_TS().Init(Value:null, low:new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)),high:null,width:null,center:null);*/
                // Setting the DateTime.
            }

            IEntryRelationship entryRel = entry.AsAct.EntryRelationship.Append();

            entryRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryRel.AsObservation.ClassCode = "OBS";
            entryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            III TempId = entryRel.AsObservation.TemplateId.Append();

            TempId.Root = "2.16.840.1.113883.10.20.22.4.4";
            hl7III      = entryRel.AsObservation.Id.Append();
            hl7III.Root = Guid.NewGuid().ToString();

            entryRel.AsObservation.Code.Code        = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "404684003" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "282291009" : "409586006";
            entryRel.AsObservation.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            entryRel.AsObservation.Code.DisplayName = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "Finding" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "Diagnosis" : "Complaint";


            IED ED = hl7Factory.CreateED();

            ED.Reference.Value          = refId;
            entryRel.AsObservation.Text = ED;
            ICS CS = hl7Factory.CreateCS();

            CS.Init("completed");
            entryRel.AsObservation.StatusCode = CS;

            if (Convert.ToString(patientProblem.Status) == "Resolved")
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entry.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                }
                else
                {
                    entry.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";

                    /* Not Compiled
                     * entryRel.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * // Because Allergy Start Date is Missing.
                     *
                     * entryRel.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }
            else
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entryRel.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";
                }
                else
                {
                    entryRel.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";

                    /* Not Compiled
                     * entryRel.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * entryRel.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }

            ICD CD = hl7Factory.CreateCD();

            string snomedCode = GetSNOMED(Convert.ToString(patientProblem.Description));

            if (string.IsNullOrEmpty(snomedCode))
            {
                CD.NullFlavor = "UNK";
            }
            else
            {
                CD.Code           = snomedCode;
                CD.CodeSystem     = "2.16.840.1.113883.6.96";
                CD.CodeSystemName = "SNOMED CT";
                CD.DisplayName    = Convert.ToString(patientProblem.Description);
            }

            entryRel.AsObservation.Value.Add(CD);

            ///''''''''''''Problem Observation''''''''''''''''''
            IEntryRelationship entryProblemObs = entryRel.AsObservation.EntryRelationship.Append();

            entryProblemObs.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryProblemObs.AsObservation.ClassCode = "OBS";
            entryProblemObs.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            TempId      = entryProblemObs.AsObservation.TemplateId.Append();
            TempId.Root = "2.16.840.1.113883.10.20.22.4.4";
            hl7III      = entryProblemObs.AsObservation.Id.Append();
            hl7III.Root = Guid.NewGuid().ToString();

            entryProblemObs.AsObservation.Code.Code        = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "404684003" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "282291009" : "409586006";
            entryProblemObs.AsObservation.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            entryProblemObs.AsObservation.Code.DisplayName = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "Finding" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "Diagnosis" : "Complaint";

            ED = hl7Factory.CreateED();
            ED.Reference.Value = refId;
            entryProblemObs.AsObservation.Text = ED;
            CS = hl7Factory.CreateCS();
            CS.Init("completed");
            entryProblemObs.AsObservation.StatusCode = CS;

            if (Convert.ToString(patientProblem.Status) == "Resolved")
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryProblemObs.AsObservation.EffectiveTime.NullFlavor = "UNK";
                }
                else
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());

                    /* Not Compiled
                     * entryProblemObs.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * // Because Allergy Start Date is Missing.
                     * entryProblemObs.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }
            else
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                }
                else
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());

                    /* Not Compiled
                     * entryProblemObs.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * entryProblemObs.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }

            CD         = hl7Factory.CreateCD();
            snomedCode = GetSNOMED(Convert.ToString(patientProblem.Description));
            if (string.IsNullOrEmpty(snomedCode))
            {
                CD.NullFlavor = "UNK";
            }
            else
            {
                CD.Code        = snomedCode;
                CD.CodeSystem  = "2.16.840.1.113883.6.96";
                CD.DisplayName = Convert.ToString(patientProblem.Description);
            }

            entryProblemObs.AsObservation.Value.Add(CD);


            ///'''''''''''' Age Observation''''''''''''''''''

            if ((!object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value)))
            {
                IEntryRelationship age_EntryRel = entryRel.AsObservation.EntryRelationship.Append();
                age_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.SUBJ;
                age_EntryRel.InversionInd            = true;
                age_EntryRel.InversionIndSpecified   = true;
                age_EntryRel.AsObservation.ClassCode = "OBS";
                age_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                hl7III = age_EntryRel.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.31");
                CD = hl7Factory.CreateCD();
                CD.Init("445518008", "2.16.840.1.113883.6.96", "", "Age");
                age_EntryRel.AsObservation.Code = CD;
                age_EntryRel.AsObservation.StatusCode.Init("completed");
                IPQ PQ = hl7Factory.CreatePQ();
                PQ.Value = calcYear(Convert.ToDateTime(patientProblem.DateDiagnosed), dateofbirth);
                PQ.Unit  = "a";
                age_EntryRel.AsObservation.Value.Add(PQ);
            }

            ///'''''''''''' Problem Status Observation'''''''''''''
            IEntryRelationship problemStatus_EntryRel = entryRel.AsObservation.EntryRelationship.Append();

            problemStatus_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.REFR;
            problemStatus_EntryRel.InversionInd            = true;
            problemStatus_EntryRel.InversionIndSpecified   = true;
            problemStatus_EntryRel.AsObservation.ClassCode = "OBS";
            problemStatus_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            hl7III = problemStatus_EntryRel.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.6");

            CD = hl7Factory.CreateCD();
            CD.Init("33999-4", "2.16.840.1.113883.6.1", "LOINC", "Status");
            problemStatus_EntryRel.AsObservation.Code = CD;
            problemStatus_EntryRel.AsObservation.StatusCode.Init("completed");
            //55561003-Active, 73425007-Inactive, 413322009- Resolved
            CD = hl7Factory.CreateCD();

            CD.Init((Convert.ToString(patientProblem.Status) == "Active" ? "55561003" : (Convert.ToString(patientProblem.Status) == "Inactive" ? "73425007" : "413322009")), "2.16.840.1.113883.6.96", "SNOMED CT", Convert.ToString(patientProblem.Status));
            problemStatus_EntryRel.AsObservation.Value.Add(CD);
        }
Exemple #29
0
        public static void CreateClassFileForGivenTypeClass(string ClassName, string strCode, ICD CodeType)
        {
            string RootlibraryPath = SavePath;

            FileManager.CreateDirectory(RootlibraryPath);
            string infoPath = RootlibraryPath;

            switch (CodeType)
            {
            case ICD.Info:
                infoPath = infoPath + "/Info";
                break;

            case ICD.Controller:
                infoPath = infoPath + "/Controller";
                break;

            case ICD.DataProvider:
                infoPath = infoPath + "/DataProvider";
                break;

            default:
                break;
            }

            FileManager.CreateDirectory(infoPath);
            string destinationPath = infoPath + "/" + ClassName + ".cs";

            using (StreamWriter sw = new StreamWriter(destinationPath))
            {
                sw.Write(strCode);
            }
        }
 public CDController()
 {
     dao = DAOFactory.CriarCD_DAO();
 }