Beispiel #1
0
        ///<summary>Inserts one Hcpcs into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Hcpcs hcpcs, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO hcpcs (";

            if (!useExistingPK && isRandomKeys)
            {
                hcpcs.HcpcsNum = ReplicationServers.GetKeyNoCache("hcpcs", "HcpcsNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "HcpcsNum,";
            }
            command += "HcpcsCode,DescriptionShort) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(hcpcs.HcpcsNum) + ",";
            }
            command +=
                "'" + POut.String(hcpcs.HcpcsCode) + "',"
                + "'" + POut.String(hcpcs.DescriptionShort) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                hcpcs.HcpcsNum = Db.NonQ(command, true, "HcpcsNum", "hcpcs");
            }
            return(hcpcs.HcpcsNum);
        }
Beispiel #2
0
        ///<summary>Inserts one Hcpcs into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Hcpcs hcpcs, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                hcpcs.HcpcsNum = ReplicationServers.GetKey("hcpcs", "HcpcsNum");
            }
            string command = "INSERT INTO hcpcs (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "HcpcsNum,";
            }
            command += "HcpcsCode,DescriptionShort) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(hcpcs.HcpcsNum) + ",";
            }
            command +=
                "'" + POut.String(hcpcs.HcpcsCode) + "',"
                + "'" + POut.String(hcpcs.DescriptionShort) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                hcpcs.HcpcsNum = Db.NonQ(command, true);
            }
            return(hcpcs.HcpcsNum);
        }
Beispiel #3
0
        ///<summary>Updates one Hcpcs in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(Hcpcs hcpcs, Hcpcs oldHcpcs)
        {
            string command = "";

            if (hcpcs.HcpcsCode != oldHcpcs.HcpcsCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HcpcsCode = '" + POut.String(hcpcs.HcpcsCode) + "'";
            }
            if (hcpcs.DescriptionShort != oldHcpcs.DescriptionShort)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DescriptionShort = '" + POut.String(hcpcs.DescriptionShort) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE hcpcs SET " + command
                      + " WHERE HcpcsNum = " + POut.Long(hcpcs.HcpcsNum);
            Db.NonQ(command);
        }
Beispiel #4
0
 ///<summary>Inserts one Hcpcs into the database.  Returns the new priKey.</summary>
 public static long Insert(Hcpcs hcpcs)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         hcpcs.HcpcsNum = DbHelper.GetNextOracleKey("hcpcs", "HcpcsNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(hcpcs, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     hcpcs.HcpcsNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(hcpcs, false));
     }
 }
Beispiel #5
0
        ///<summary>Updates one Hcpcs in the database.</summary>
        public static void Update(Hcpcs hcpcs)
        {
            string command = "UPDATE hcpcs SET "
                             + "HcpcsCode       = '" + POut.String(hcpcs.HcpcsCode) + "', "
                             + "DescriptionShort= '" + POut.String(hcpcs.DescriptionShort) + "' "
                             + "WHERE HcpcsNum = " + POut.Long(hcpcs.HcpcsNum);

            Db.NonQ(command);
        }
Beispiel #6
0
 private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
 {
     if (IsSelectionMode)
     {
         SelectedHcpcs = (Hcpcs)gridMain.ListGridRows[e.Row].Tag;
         DialogResult  = DialogResult.OK;
         return;
     }
 }
Beispiel #7
0
 private void butOK_Click(object sender, EventArgs e)
 {
     //not even visible unless IsSelectionMode
     if (gridMain.GetSelectedIndex() == -1)
     {
         MsgBox.Show(this, "Please select an item first.");
         return;
     }
     SelectedHcpcs = (Hcpcs)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;
     DialogResult  = DialogResult.OK;
 }
Beispiel #8
0
 ///<summary>Returns true if Update(Hcpcs,Hcpcs) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(Hcpcs hcpcs, Hcpcs oldHcpcs)
 {
     if (hcpcs.HcpcsCode != oldHcpcs.HcpcsCode)
     {
         return(true);
     }
     if (hcpcs.DescriptionShort != oldHcpcs.DescriptionShort)
     {
         return(true);
     }
     return(false);
 }
Beispiel #9
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Hcpcs> TableToList(DataTable table){
			List<Hcpcs> retVal=new List<Hcpcs>();
			Hcpcs hcpcs;
			for(int i=0;i<table.Rows.Count;i++) {
				hcpcs=new Hcpcs();
				hcpcs.HcpcsNum        = PIn.Long  (table.Rows[i]["HcpcsNum"].ToString());
				hcpcs.HcpcsCode       = PIn.String(table.Rows[i]["HcpcsCode"].ToString());
				hcpcs.DescriptionShort= PIn.String(table.Rows[i]["DescriptionShort"].ToString());
				retVal.Add(hcpcs);
			}
			return retVal;
		}
Beispiel #10
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Hcpcs> TableToList(DataTable table)
        {
            List <Hcpcs> retVal = new List <Hcpcs>();
            Hcpcs        hcpcs;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                hcpcs                  = new Hcpcs();
                hcpcs.HcpcsNum         = PIn.Long(table.Rows[i]["HcpcsNum"].ToString());
                hcpcs.HcpcsCode        = PIn.String(table.Rows[i]["HcpcsCode"].ToString());
                hcpcs.DescriptionShort = PIn.String(table.Rows[i]["DescriptionShort"].ToString());
                retVal.Add(hcpcs);
            }
            return(retVal);
        }
Beispiel #11
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Hcpcs> TableToList(DataTable table)
        {
            List <Hcpcs> retVal = new List <Hcpcs>();
            Hcpcs        hcpcs;

            foreach (DataRow row in table.Rows)
            {
                hcpcs                  = new Hcpcs();
                hcpcs.HcpcsNum         = PIn.Long(row["HcpcsNum"].ToString());
                hcpcs.HcpcsCode        = PIn.String(row["HcpcsCode"].ToString());
                hcpcs.DescriptionShort = PIn.String(row["DescriptionShort"].ToString());
                retVal.Add(hcpcs);
            }
            return(retVal);
        }
Beispiel #12
0
 ///<summary>Inserts one Hcpcs into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(Hcpcs hcpcs)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(hcpcs, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             hcpcs.HcpcsNum = DbHelper.GetNextOracleKey("hcpcs", "HcpcsNum");                  //Cacheless method
         }
         return(InsertNoCache(hcpcs, true));
     }
 }
Beispiel #13
0
		///<summary>Inserts one Hcpcs into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(Hcpcs hcpcs,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				hcpcs.HcpcsNum=ReplicationServers.GetKey("hcpcs","HcpcsNum");
			}
			string command="INSERT INTO hcpcs (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="HcpcsNum,";
			}
			command+="HcpcsCode,DescriptionShort) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(hcpcs.HcpcsNum)+",";
			}
			command+=
				 "'"+POut.String(hcpcs.HcpcsCode)+"',"
				+"'"+POut.String(hcpcs.DescriptionShort)+"')";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				hcpcs.HcpcsNum=Db.NonQ(command,true);
			}
			return hcpcs.HcpcsNum;
		}
Beispiel #14
0
		///<summary>Inserts one Hcpcs into the database.  Returns the new priKey.</summary>
		public static long Insert(Hcpcs hcpcs){
			if(DataConnection.DBtype==DatabaseType.Oracle) {
				hcpcs.HcpcsNum=DbHelper.GetNextOracleKey("hcpcs","HcpcsNum");
				int loopcount=0;
				while(loopcount<100){
					try {
						return Insert(hcpcs,true);
					}
					catch(Oracle.DataAccess.Client.OracleException ex){
						if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
							hcpcs.HcpcsNum++;
							loopcount++;
						}
						else{
							throw ex;
						}
					}
				}
				throw new ApplicationException("Insert failed.  Could not generate primary key.");
			}
			else {
				return Insert(hcpcs,false);
			}
		}
Beispiel #15
0
        private void FormEhrSettings_Load(object sender, EventArgs e)
        {
            checkAlertHighSeverity.Checked = PrefC.GetBool(PrefName.EhrRxAlertHighSeverity);
            checkMU2.Checked = PrefC.GetBool(PrefName.MeaningfulUseTwo);
            #region DefaultEncounterGroup
            FillRecEncCodesList();
            string defaultEncCode       = PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue);
            string defaultEncCodeSystem = PrefC.GetString(PrefName.CQMDefaultEncounterCodeSystem);
            NewEncCodeSystem      = defaultEncCodeSystem;
            OldEncListSelectedIdx = -1;
            int countNotInSnomedTable = 0;
            for (int i = 0; i < ListRecEncCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboEncCodes.Items.Add(ListRecEncCodes[i]);
                    comboEncCodes.SelectedIndex = i;
                    if (defaultEncCode == ListRecEncCodes[i])
                    {
                        comboEncCodes.SelectedIndex = i;
                        OldEncListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecEncCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboEncCodes.Items.Add(ListRecEncCodes[i]);
                if (ListRecEncCodes[i] == defaultEncCode && defaultEncCodeSystem == "SNOMEDCT")
                {
                    comboEncCodes.SelectedIndex = i;
                    OldEncListSelectedIdx       = i;
                    labelEncWarning.Visible     = false;
                    textEncCodeDescript.Text    = Snomeds.GetByCode(ListRecEncCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended encounter codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | EHR.");
            }
            if (comboEncCodes.SelectedIndex == -1)           //default enc code set to code not in recommended list and not 'none'
            {
                switch (defaultEncCodeSystem)
                {
                case "CDT":
                    textEncCodeValue.Text    = ProcedureCodes.GetProcCode(defaultEncCode).ProcCode;                       //Will return a new ProcCode object, not null, if not found
                    textEncCodeDescript.Text = ProcedureCodes.GetProcCode(defaultEncCode).Descript;
                    break;

                case "CPT":
                    Cpt cEnc = Cpts.GetByCode(defaultEncCode);
                    if (cEnc != null)
                    {
                        textEncCodeValue.Text    = cEnc.CptCode;
                        textEncCodeDescript.Text = cEnc.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sEnc = Snomeds.GetByCode(defaultEncCode);
                    if (sEnc != null)
                    {
                        textEncCodeValue.Text    = sEnc.SnomedCode;
                        textEncCodeDescript.Text = sEnc.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hEnc = Hcpcses.GetByCode(defaultEncCode);
                    if (hEnc != null)
                    {
                        textEncCodeValue.Text    = hEnc.HcpcsCode;
                        textEncCodeDescript.Text = hEnc.DescriptionShort;
                    }
                    break;
                }
            }
            #endregion
            #region DefaultPregnancyGroup
            FillRecPregCodesList();
            string defaultPregCode       = PrefC.GetString(PrefName.PregnancyDefaultCodeValue);
            string defaultPregCodeSystem = PrefC.GetString(PrefName.PregnancyDefaultCodeSystem);
            NewPregCodeSystem      = defaultPregCodeSystem;
            OldPregListSelectedIdx = -1;
            countNotInSnomedTable  = 0;
            for (int i = 0; i < ListRecPregCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboPregCodes.Items.Add(ListRecPregCodes[i]);
                    comboPregCodes.SelectedIndex = i;
                    if (defaultPregCode == ListRecPregCodes[i])
                    {
                        comboPregCodes.SelectedIndex = i;
                        OldPregListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecPregCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboPregCodes.Items.Add(ListRecPregCodes[i]);
                if (ListRecPregCodes[i] == defaultPregCode && defaultPregCodeSystem == "SNOMEDCT")
                {
                    comboPregCodes.SelectedIndex = i;
                    OldPregListSelectedIdx       = i;
                    labelPregWarning.Visible     = false;
                    textPregCodeDescript.Text    = Snomeds.GetByCode(ListRecPregCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended pregnancy codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | EHR.");
            }
            if (comboPregCodes.SelectedIndex == -1)           //default preg code set to code not in recommended list and not 'none'
            {
                switch (defaultPregCodeSystem)
                {
                case "ICD9CM":
                    ICD9 i9Preg = ICD9s.GetByCode(defaultPregCode);
                    if (i9Preg != null)
                    {
                        textPregCodeValue.Text    = i9Preg.ICD9Code;
                        textPregCodeDescript.Text = i9Preg.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sPreg = Snomeds.GetByCode(defaultPregCode);
                    if (sPreg != null)
                    {
                        textPregCodeValue.Text    = sPreg.SnomedCode;
                        textPregCodeDescript.Text = sPreg.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Preg = Icd10s.GetByCode(defaultPregCode);
                    if (i10Preg != null)
                    {
                        textPregCodeValue.Text    = i10Preg.Icd10Code;
                        textPregCodeDescript.Text = i10Preg.Description;
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion
        }
Beispiel #16
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Date", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Prov", 50);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Intervention Type", 115);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code", 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code System", 85);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code Description", 300);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Note", 100);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            #region Interventions
            listIntervention = Interventions.Refresh(PatCur.PatNum);
            for (int i = 0; i < listIntervention.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listIntervention[i].DateEntry.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listIntervention[i].ProvNum));
                row.Cells.Add(listIntervention[i].CodeSet.ToString());
                row.Cells.Add(listIntervention[i].CodeValue);
                row.Cells.Add(listIntervention[i].CodeSystem);
                //Description of Intervention---------------------------------------------
                //to get description, first determine which table the code is from.  Interventions are allowed to be SNOMEDCT, ICD9, ICD10, HCPCS, or CPT.
                string descript = "";
                switch (listIntervention[i].CodeSystem)
                {
                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listIntervention[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;

                case "ICD9CM":
                    ICD9 i9Cur = ICD9s.GetByCode(listIntervention[i].CodeValue);
                    if (i9Cur != null)
                    {
                        descript = i9Cur.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Cur = Icd10s.GetByCode(listIntervention[i].CodeValue);
                    if (i10Cur != null)
                    {
                        descript = i10Cur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listIntervention[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(listIntervention[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                row.Cells.Add(listIntervention[i].Note);
                row.Tag = listIntervention[i];
                gridMain.Rows.Add(row);
            }
            #endregion
            #region MedicationPats
            listMedPats = MedicationPats.Refresh(PatCur.PatNum, true);
            if (listMedPats.Count > 0)
            {
                //The following medications are used as interventions for some measures.  Include them in the intervention window if they belong to these value sets.
                //Above Normal Medications RxNorm Value Set, Below Normal Medications RxNorm Value Set, Tobacco Use Cessation Pharmacotherapy Value Set
                List <string> listVS = new List <string> {
                    "2.16.840.1.113883.3.600.1.1498", "2.16.840.1.113883.3.600.1.1499", "2.16.840.1.113883.3.526.3.1190"
                };
                List <EhrCode> listEhrMeds = EhrCodes.GetForValueSetOIDs(listVS, true);
                for (int i = listMedPats.Count - 1; i > -1; i--)
                {
                    bool found = false;
                    for (int j = 0; j < listEhrMeds.Count; j++)
                    {
                        if (listMedPats[i].RxCui.ToString() == listEhrMeds[j].CodeValue)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        listMedPats.RemoveAt(i);
                    }
                }
            }
            for (int i = 0; i < listMedPats.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listMedPats[i].DateStart.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listMedPats[i].ProvNum));
                if (listMedPats[i].RxCui == 314153 || listMedPats[i].RxCui == 692876)
                {
                    row.Cells.Add(InterventionCodeSet.AboveNormalWeight.ToString() + " Medication");
                }
                else if (listMedPats[i].RxCui == 577154 || listMedPats[i].RxCui == 860215 || listMedPats[i].RxCui == 860221 || listMedPats[i].RxCui == 860225 || listMedPats[i].RxCui == 860231)
                {
                    row.Cells.Add(InterventionCodeSet.BelowNormalWeight.ToString() + " Medication");
                }
                else                  //There are 48 total medications that can be used as interventions.  The remaining 41 medications are tobacco cessation medications
                {
                    row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication");
                }
                row.Cells.Add(listMedPats[i].RxCui.ToString());
                row.Cells.Add("RXNORM");
                //Medications that are used as interventions are all RxNorm codes, get description from that table
                string descript = RxNorms.GetDescByRxCui(listMedPats[i].RxCui.ToString());
                row.Cells.Add(descript);
                row.Cells.Add(listMedPats[i].PatNote);
                row.Tag = listMedPats[i];
                gridMain.Rows.Add(row);
            }
            #endregion
            gridMain.EndUpdate();
        }
Beispiel #17
0
        private void FillDefaultEncCode()
        {
            string defaultEncCode       = PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue);
            string defaultEncCodeSystem = PrefC.GetString(PrefName.CQMDefaultEncounterCodeSystem);

            NewEncCodeSystem      = defaultEncCodeSystem;
            OldEncListSelectedIdx = -1;
            int countNotInSnomedTable = 0;

            for (int i = 0; i < ListRecEncCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboEncCodes.Items.Add(ListRecEncCodes[i]);
                    comboEncCodes.SelectedIndex = i;
                    if (defaultEncCode == ListRecEncCodes[i])
                    {
                        comboEncCodes.SelectedIndex = i;
                        OldEncListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecEncCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboEncCodes.Items.Add(ListRecEncCodes[i]);
                if (ListRecEncCodes[i] == defaultEncCode && defaultEncCodeSystem == "SNOMEDCT")
                {
                    comboEncCodes.SelectedIndex = i;
                    OldEncListSelectedIdx       = i;
                    labelEncWarning.Visible     = false;
                    textEncCodeDescript.Text    = Snomeds.GetByCode(ListRecEncCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended encounter codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | Chart | EHR.");
            }
            if (comboEncCodes.SelectedIndex == -1)           //default enc code set to code not in recommended list and not 'none'
            {
                switch (defaultEncCodeSystem)
                {
                case "CDT":
                    textEncCodeValue.Text    = ProcedureCodes.GetProcCode(defaultEncCode).ProcCode;                       //Will return a new ProcCode object, not null, if not found
                    textEncCodeDescript.Text = ProcedureCodes.GetProcCode(defaultEncCode).Descript;
                    break;

                case "CPT":
                    Cpt cEnc = Cpts.GetByCode(defaultEncCode);
                    if (cEnc != null)
                    {
                        textEncCodeValue.Text    = cEnc.CptCode;
                        textEncCodeDescript.Text = cEnc.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sEnc = Snomeds.GetByCode(defaultEncCode);
                    if (sEnc != null)
                    {
                        textEncCodeValue.Text    = sEnc.SnomedCode;
                        textEncCodeDescript.Text = sEnc.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hEnc = Hcpcses.GetByCode(defaultEncCode);
                    if (hEnc != null)
                    {
                        textEncCodeValue.Text    = hEnc.HcpcsCode;
                        textEncCodeDescript.Text = hEnc.DescriptionShort;
                    }
                    break;
                }
            }
        }
Beispiel #18
0
 ///<summary>Inserts one Hcpcs into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(Hcpcs hcpcs)
 {
     return(InsertNoCache(hcpcs, false));
 }
Beispiel #19
0
 ///<summary>Inserts one Hcpcs into the database.  Returns the new priKey.</summary>
 public static long Insert(Hcpcs hcpcs)
 {
     return(Insert(hcpcs, false));
 }
Beispiel #20
0
        public void FormEncounters_Load(object sender, EventArgs e)
        {
            _patCur          = Patients.GetPat(_encCur.PatNum);
            this.Text       += " - " + _patCur.GetNameLF();
            textDateEnc.Text = _encCur.DateEncounter.ToShortDateString();
            _provNumSelected = _encCur.ProvNum;
            comboProv.Items.Clear();
            _listProviders = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProv.Items.Add(_listProviders[i].GetLongDesc());                //Only visible provs added to combobox.
                if (_listProviders[i].ProvNum == _encCur.ProvNum)
                {
                    comboProv.SelectedIndex = i;                  //Sets combo text too.
                }
            }
            if (_provNumSelected == 0)           //Is new
            {
                comboProv.SelectedIndex = 0;
                _provNumSelected        = _listProviders[0].ProvNum;
            }
            if (comboProv.SelectedIndex == -1)                            //The provider exists but is hidden
            {
                comboProv.Text = Providers.GetLongDesc(_provNumSelected); //Appends "(hidden)" to the end of the long description.
            }
            textNote.Text       = _encCur.Note;
            textCodeValue.Text  = _encCur.CodeValue;
            textCodeSystem.Text = _encCur.CodeSystem;
            //to get description, first determine which table the code is from.  Encounter is only allowed to be a CDT, CPT, HCPCS, and SNOMEDCT.  Will be null if new encounter.
            switch (_encCur.CodeSystem)
            {
            case "CDT":
                textCodeDescript.Text = ProcedureCodes.GetProcCode(_encCur.CodeValue).Descript;
                break;

            case "CPT":
                Cpt cptCur = Cpts.GetByCode(_encCur.CodeValue);
                if (cptCur != null)
                {
                    textCodeDescript.Text = cptCur.Description;
                }
                break;

            case "HCPCS":
                Hcpcs hCur = Hcpcses.GetByCode(_encCur.CodeValue);
                if (hCur != null)
                {
                    textCodeDescript.Text = hCur.DescriptionShort;
                }
                break;

            case "SNOMEDCT":
                Snomed sCur = Snomeds.GetByCode(_encCur.CodeValue);
                if (sCur != null)
                {
                    textCodeDescript.Text = sCur.Description;
                }
                break;

            case null:
                textCodeDescript.Text = "";
                break;

            default:
                MsgBox.Show(this, "Error: Unknown code system");
                break;
            }
        }
Beispiel #21
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Date", 80);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Prov", 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code", 110);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 180);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Note", 100);
            gridMain.Columns.Add(col);
            listEncs = Encounters.Refresh(PatCur.PatNum);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listEncs.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listEncs[i].DateEncounter.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listEncs[i].ProvNum));
                row.Cells.Add(listEncs[i].CodeValue);
                string descript = "";
                //to get description, first determine which table the code is from.  Encounter is only allowed to be a CDT, CPT, HCPCS, and SNOMEDCT.
                switch (listEncs[i].CodeSystem)
                {
                case "CDT":
                    descript = ProcedureCodes.GetProcCode(listEncs[i].CodeValue).Descript;
                    break;

                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(listEncs[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listEncs[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listEncs[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                row.Cells.Add(listEncs[i].Note);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Beispiel #22
0
		///<summary>Updates one Hcpcs in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
		public static void Update(Hcpcs hcpcs,Hcpcs oldHcpcs){
			string command="";
			if(hcpcs.HcpcsCode != oldHcpcs.HcpcsCode) {
				if(command!=""){ command+=",";}
				command+="HcpcsCode = '"+POut.String(hcpcs.HcpcsCode)+"'";
			}
			if(hcpcs.DescriptionShort != oldHcpcs.DescriptionShort) {
				if(command!=""){ command+=",";}
				command+="DescriptionShort = '"+POut.String(hcpcs.DescriptionShort)+"'";
			}
			if(command==""){
				return;
			}
			command="UPDATE hcpcs SET "+command
				+" WHERE HcpcsNum = "+POut.Long(hcpcs.HcpcsNum);
			Db.NonQ(command);
		}
Beispiel #23
0
		///<summary>Updates one Hcpcs in the database.</summary>
		public static void Update(Hcpcs hcpcs){
			string command="UPDATE hcpcs SET "
				+"HcpcsCode       = '"+POut.String(hcpcs.HcpcsCode)+"', "
				+"DescriptionShort= '"+POut.String(hcpcs.DescriptionShort)+"' "
				+"WHERE HcpcsNum = "+POut.Long(hcpcs.HcpcsNum);
			Db.NonQ(command);
		}
Beispiel #24
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Code", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("CodeSystem", 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 200);
            gridMain.Columns.Add(col);
            string        selectedValue  = comboCodeSet.SelectedItem.ToString();
            List <string> listValSetOIDs = new List <string>();

            if (selectedValue == "All")
            {
                listValSetOIDs = new List <string>(dictValueCodeSets.Values);
            }
            else              //this will limit the codes to only one value set oid
            {
                listValSetOIDs.Add(dictValueCodeSets[selectedValue]);
            }
            listCodes = EhrCodes.GetForValueSetOIDs(listValSetOIDs, true);         //these codes will exist in the corresponding table or will not be in the list
            gridMain.Rows.Clear();
            ODGridRow row;
            int       selectedIdx = -1;

            for (int i = 0; i < listCodes.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listCodes[i].CodeValue);
                row.Cells.Add(listCodes[i].CodeSystem);
                //Retrieve description from the associated table
                string descript = "";
                switch (listCodes[i].CodeSystem)
                {
                case "CPT":
                    Cpt cCur = Cpts.GetByCode(listCodes[i].CodeValue);
                    if (cCur != null)
                    {
                        descript = cCur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listCodes[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "ICD9CM":
                    ICD9 i9Cur = ICD9s.GetByCode(listCodes[i].CodeValue);
                    if (i9Cur != null)
                    {
                        descript = i9Cur.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Cur = Icd10s.GetByCode(listCodes[i].CodeValue);
                    if (i10Cur != null)
                    {
                        descript = i10Cur.Description;
                    }
                    break;

                case "RXNORM":
                    descript = RxNorms.GetDescByRxCui(listCodes[i].CodeValue);
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listCodes[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                gridMain.Rows.Add(row);
                if (listCodes[i].CodeValue == InterventionCur.CodeValue && listCodes[i].CodeSystem == InterventionCur.CodeSystem)
                {
                    selectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            if (selectedIdx > -1)
            {
                gridMain.SetSelected(selectedIdx, true);
                gridMain.ScrollToIndex(selectedIdx);
            }
        }