public static List <string> GetConditionCodes(string encounterId)
        {
            DateTime todayDt = DateTime.Today;

            string[]      items;
            StringBuilder sb = new StringBuilder();

            sb.Append("select condition_cd from BAR_Encntr_Condition_Code ");
            sb.Append("where encntr_Id = " + long.Parse(encounterId) + " and active_ind = '1' ");
            sb.Append("AND END_EFFECTIVE_DT_TM > '" + todayDt + "'");
            sb.Append(" order by sequence  ");

            DataTable dt = new DataTable();

            using (var conn = new SqlConnection(GlobalSettings.SqlConnectionString()))
                using (var cmd = new SqlCommand(sb.ToString(), conn))
                    using (var da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dt);
                    }

            List <string> condCodes = new List <string>();

            foreach (DataRow row in dt.Rows)
            {
                string code = row["condition_cd"].ToString();
                code  = CodeValueDAL.GetCodeValueDisplay(code.Trim());
                items = code.Split(' ');
                condCodes.Add(items[0].Trim());
            }
            return(condCodes);
        }
Ejemplo n.º 2
0
        private static Diagnosis LoadDiagnosis(DataRow row)
        {
            string diagCode = NomenclatureDAL.GetNomenclature_SourceIdentifier(row["nomenclature_id"].ToString());
            string poa      = CodeValueDAL.GetCodeValueDisplay(row["present_on_admit_cd"].ToString());
            string pri      = row["diag_priority"].ToString().Trim();

            if (poa == "0")
            {
                poa = string.Empty;
            }

            Diagnosis dx = new Diagnosis();

            dx.DxCode         = diagCode;
            dx.GrouperVersion = string.Empty;
            dx.POA            = poa;
            if (pri == "0" || pri == "")
            {
                dx.priority = string.Empty;
            }
            else
            {
                dx.priority = pri;
            }
            dx.DxType = row["diag_type_cd"].ToString().Trim();
            return(dx);
        }
        private static Encounter LoadEncounter(DataRow row)
        {
            string    npi       = "";
            Encounter encounter = new Encounter();

            encounter.Active_Ind = row["Active_Ind"].ToString().Replace(".0000", "");

            string dischDisp = CernerCommon.StripDecimalsForMap(row["Disch_Disposition_Cd"].ToString());

            encounter.Disch_Disposition_Cd = CernerMapDAL.GetMap("CERNER_DISCHARGE_DISPOSITION", dischDisp, dischDisp);
            encounter.Cerner_Disch_Disposition_Cd_Display = CodeValueDAL.GetCodeValueDisplay(dischDisp);

            encounter.Disch_Dt_Tm          = row["Disch_Dt_Tm"].ToString();
            encounter.Encntr_type_class_cd = row["Encntr_type_class_cd"].ToString().Replace(".0000", "");

            encounter.Original_Encounter_Id = row["Encntr_Id"].ToString().Replace(".0000", "");
            string encntrId = Encounter_AliasDAL.GetEncounterVisitNumber(row["Encntr_Id"].ToString().Replace(".0000", ""));

            encounter.Encounter_Id = encntrId;

            string encounterTypeCd = CernerCommon.StripDecimalsForMap(row["Encntr_Type_Cd"].ToString());

            encounter.Cerner_Encoutner_Type_Cd         = encounterTypeCd;                                   //used for special logic in mpi conversion record 02
            encounter.Cerner_Encounter_Type_Cd_Display = CodeValueDAL.GetCodeValueDisplay(encounterTypeCd); //for data sheet

            encounter.Encounter_Type_Cd     = CernerMapDAL.GetMap("CERNER_REGTYPE", encounterTypeCd, encounterTypeCd);
            encounter.Inpatient_Admit_Dt_Tm = row["Inpatient_Admit_Dt_Tm"].ToString();

            //From Encounter Table use field E_LOC_NURSE_UNIT_CD to retrieve the  DISPLAY_KEY (col E) in CodeSet 220.
            //Use the DISPLAY_KEY to retrieve the Meditech location from the spreadsheet - "Approved locations"
            string loc = CodeValueDAL.GetCodeValueDisplay_Key(row["Loc_Nurse_Unit_Cd"].ToString().Replace(".0000", ""));

            encounter.Cerner_Loc_Nurse_Unit_Cd_Display = loc; //for data sheet
            encounter.Loc_Nurse_Unit_Cd = CernerMapDAL.GetMap("CERNER_LOCATION", loc, loc);

            //string attendPhys = EncntrPrsnlReltnDAL.GetAttendPhysician(row["Encntr_Id"].ToString());
            encounter.AttendPhysicianId = ""; //attendPhys;
            //MPIOrganization org = MPIOrganizationDAL.GetOrganization(CernerCommon.StripDecimalsForMap(encounter.Organization_Id));
            //npi = PrsnlAliasDAL.GetPrsnlAlias(attendPhys);
            encounter.AttendPhysician = "";//CernerMapDAL.GetMapDR(npi, facility, "Z.CONVPROV");

            encounter.Person_Id         = row["Person_Id"].ToString().Replace(".0000", "");
            encounter.Reason_For_Visit  = row["Reason_For_Visit"].ToString();
            encounter.Reg_Dt_Tm         = row["Reg_Dt_Tm"].ToString();
            encounter.ConfidentialVisit = row["confid_level_cd"].ToString();
            encounter.VIP_Cd            = row["vip_cd"].ToString().Replace(".0000", "");
            encounter.Organization_Id   = row["organization_id"].ToString().Replace(".0000", "");
            encounter.Med_Serv_Cd       = row["med_service_cd"].ToString().Replace(".0000", "");
            //DateTime? d = GMTtoTZ(encounter.Disch_Dt_Tm, "Mountain Standard Time");


            //for BAR
            encounter.BAR_Encounter_Type_Cd = CernerMapDAL.GetMap("CERNER_REGTYPE", encounterTypeCd, encounterTypeCd);
            encounter.Admit_Src_Cd          = row["admit_src_cd"].ToString().Replace(".0000", "");
            encounter.Admit_Type_Cd         = row["admit_type_cd"].ToString().Replace(".0000", "");

            return(encounter);
        }
        private static Person_Alias LoadPersonAlias(DataRow row)
        {
            Person_Alias alias = new Person_Alias();

            alias.Aleas_Pool = CodeValueDAL.GetCodeValueDisplay(row["alias_pool_Cd"].ToString());
            alias.Alias_Type = CodeValueDAL.GetCodeValueDisplay(row["person_alias_type_cd"].ToString());
            alias.Alias      = row["alias"].ToString();

            return(alias);
        }
Ejemplo n.º 5
0
        private static Occurrence_Code LoadOccurrenceCodes(DataRow row)
        {
            string ocode = "";

            string[]        items;
            Occurrence_Code code = new Occurrence_Code();

            ocode = CodeValueDAL.GetCodeValueDisplay(row["occurrence_cd"].ToString().Trim());
            items = ocode.Split(' ');
            code.OccurrenceCode = items[0].Trim();
            code.OccurrenceDate = CernerCommon.ConvertDateString(row["occurrence_dt_tm"].ToString());
            return(code);
        }
Ejemplo n.º 6
0
        private static Person LoadPersons(DataRow row)
        {
            string personId     = row["related_person_id"].ToString();
            string relationship = CernerCommon.StripDecimalsForMap(row["related_person_reltn_cd"].ToString());

            Person person = PersonDAL.GetPerson(personId);

            if (person != null)
            {
                person.Cerner_Relationship = CodeValueDAL.GetCodeValueDisplay(relationship);
                person.RelationShip        = CernerMapDAL.GetMap("CERNER_RELATIONSHIP", relationship, relationship);
            }
            return(person);
        }
        private static Diagnosis LoadDiagnosis(DataRow row)
        {
            string diagCode = NomenclatureDAL.GetNomenclature_SourceIdentifier(row["nomenclature_id"].ToString());
            string poa      = CodeValueDAL.GetCodeValueDisplay(row["present_on_admit_cd"].ToString() + ".0000");

            if (poa == "0")
            {
                poa = string.Empty;
            }

            Diagnosis dx = new Diagnosis();

            dx.DxCode         = diagCode;
            dx.GrouperVersion = string.Empty;
            dx.POA            = poa;
            return(dx);
        }
Ejemplo n.º 8
0
        private static List <Person> LoadPersons(DataTable dt)
        {
            List <Person> persons = new List <Person>();

            foreach (DataRow row in dt.Rows)
            {
                string personId     = row["related_person_id"].ToString();
                string relationship = CernerCommon.StripDecimalsForMap(row["related_person_reltn_cd"].ToString());

                Person person = PersonDAL.GetPerson(personId);
                if (person != null)
                {
                    person.Cerner_Relationship = CodeValueDAL.GetCodeValueDisplay(relationship);
                    person.RelationShip        = CernerMapDAL.GetMap("CERNER_RELATIONSHIP", relationship, relationship);
                    persons.Add(person);
                }
            }
            return(persons);
        }
        private static Value_Code LoadValueCode(DataRow row)
        {
            string vcode = "";

            string[]   items;
            Value_Code code = new Value_Code();

            vcode          = CodeValueDAL.GetCodeValueDisplay(row["value_cd"].ToString().Trim());
            items          = vcode.Split(' ');
            code.ValueCode = items[0].Trim();
            string amt = row["amount"].ToString();

            if (amt.Trim().Length > 0)
            {
                if (amt.Trim() != "null")
                {
                    code.ValueAmount = Convert.ToDecimal(amt);
                }
            }
            return(code);
        }