private static Procedure_Obj LoadProcedure(DataRow row, string facility)
        {
            //string procCode = NomenclatureDAL.GetNomenclature_SourceIdentifier(row["nomenclature_id"].ToString());
            string[]      phyItems;
            string        phys = "";
            string        npi  = "";
            Procedure_Obj proc = new Procedure_Obj();

            proc.ProcedureId       = row["procedure_id"].ToString();
            proc.ProcCode          = row["source_identifier"].ToString();
            proc.GrouperVersion    = string.Empty;
            proc.ProcedureDateTime = row["proc_dt_tm"].ToString();
            proc.SourceVocabCd     = row["source_vocabulary_cd"].ToString();
            proc.NomenID           = row["nomenclature_id"].ToString();
            proc.PriorityCd        = row["proc_priority"].ToString();
            phys     = ProcPrsnlReltn.GetSurgicalPhysician(proc.ProcedureId);
            phyItems = phys.Split('|');
            if (phyItems[0].Trim() != "")
            {
                npi = PrsnlAliasDAL.GetPrsnlAlias(phyItems[0]);
                proc.ProcedurePhy = CernerMapDAL.GetMapDR(npi, facility, "Z.CONVPROV");
            }
            if (phyItems[1].Trim() != "")
            {
                npi = PrsnlAliasDAL.GetPrsnlAlias(phyItems[1]);
                proc.ProcedurePhyAsst = CernerMapDAL.GetMapDR(npi, facility, "Z.CONVPROV");
            }
            //proc.ProcedureBy = CernerMapDAL.GetMap("CERNER_PROVIDER", procPersonId, "Z.CONVPROV");

            return(proc);
        }
Example #2
0
        public static List <Provider> GetEncounterPhysicians(string encounterId, string facility)
        {
            DateTime      todayDt = DateTime.Today;
            string        npi     = "";
            string        lic     = "";
            StringBuilder sb      = new StringBuilder();

            //sb.Append("SELECT epr.prsnl_person_id, epr.encntr_prsnl_r_cd, epr.encntr_id, epr.beg_effective_dt_tm,  ");
            //sb.Append("epr.end_effective_dt_tm, epr.encntr_type_cd, cv.display, cv.code_value  ");
            //sb.Append("FROM ENCNTR_PRSNL_RELTN epr  ");
            //sb.Append("JOIN CODE_VALUE cv on cv.code_value = epr.encntr_prsnl_r_cd ");
            //sb.Append("Where epr.Encntr_id = '" + encounterId + "' ");
            //sb.Append("AND(epr.encntr_prsnl_r_cd = '1116.0000' OR epr.encntr_prsnl_r_cd = '1119.0000' ");
            //sb.Append("OR epr.encntr_prsnl_r_cd = '1121.0000') ");
            sb.Append("SELECT epr.prsnl_person_id, epr.encntr_prsnl_r_cd, epr.encntr_id, epr.beg_effective_dt_tm,epr.end_effective_dt_tm, epr.encntr_type_cd  ");
            sb.Append("FROM BAR_ENCNTR_PRSNL_RELTN epr  ");
            sb.Append("Where epr.Encntr_id = " + long.Parse(encounterId) + " ");
            //sb.Append("AND(epr.encntr_prsnl_r_cd = '1116' OR epr.encntr_prsnl_r_cd = '1119' ");
            //sb.Append("OR epr.encntr_prsnl_r_cd = '1121') ");
            sb.Append("AND active_ind = '1' ");
            sb.Append("AND END_EFFECTIVE_DT_TM > '" + todayDt + "'");

            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))
                    {
                        cmd.CommandType = CommandType.Text;
                        da.Fill(dt);
                    }

            List <Provider> providers = new List <Provider>();

            foreach (DataRow row in dt.Rows)
            {
                Provider provider = LoadPhysician(row);
                if (provider != null)
                {
                    string phys     = row["prsnl_person_id"].ToString();
                    string physType = row["encntr_prsnl_r_cd"].ToString();// CernerCommon.GetPhysiicanType(row["encntr_prsnl_r_cd"].ToString());

                    npi = PrsnlAliasDAL.GetPrsnlAlias(phys);
                    //lic = PrsnlAliasDAL.GetPrsnlAliasLic(phys);



                    provider.Mnemonic      = CernerMapDAL.GetMapDR(npi, facility, "Z.CONVPROV");// npi;
                    provider.PhysicianType = physType;
                    provider.NPI           = npi;
                    provider.License       = lic;
                    providers.Add(provider);
                }
            }
            dt.Dispose();
            return(providers);
        }
        private static Charge LoadCharge(DataRow row, string facility)
        {
            string phys   = "";
            string npi    = "";
            Charge charge = new Charge();

            charge.Charge_Description  = row["charge_description"].ToString();
            charge.Charge_Item_Id      = row["charge_item_id"].ToString();
            charge.Item_Extended_Price = row["item_extended_price"].ToString();
            charge.Posted_Dt_Tm        = row["posted_dt_tm"].ToString();
            charge.Service_Dt_Tm       = row["service_dt_tm"].ToString();
            charge.Charge_Type_Cd      = row["charge_type_cd"].ToString();

            phys = row["perf_phys_id"].ToString();
            if (phys != "0")
            {
                npi = PrsnlAliasDAL.GetPrsnlAlias(phys);
                charge.Perf_Phy_Id = CernerMapDAL.GetMapDR(npi, facility, "Z.CONVPROV"); //row["perf_phys_id"].ToString();
            }
            else
            {
                charge.Perf_Phy_Id = "";
            }

            charge.Payor_Id = row["payor_id"].ToString();

            phys = row["ord_phys_id"].ToString();
            if (phys != "0")
            {
                npi = PrsnlAliasDAL.GetPrsnlAlias(phys);
                charge.Ord_Phy_Id = CernerMapDAL.GetMapDR(npi, facility, "Z.CONVPROV"); //row["ord_phys_id"].ToString();
            }
            else
            {
                charge.Ord_Phy_Id = "";
            }

            charge.Quantity     = row["item_quantity"].ToString();
            charge.User_Id      = row["posted_id"].ToString();
            charge.BILL_ITEM_ID = row["BILL_ITEM_ID"].ToString();
            return(charge);
        }