Exemplo n.º 1
0
 ///<summary>Inserts one Cpt into the database.  Returns the new priKey.</summary>
 public static long Insert(Cpt cpt)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         cpt.CptNum = DbHelper.GetNextOracleKey("cpt", "CptNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(cpt, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     cpt.CptNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(cpt, false));
     }
 }
Exemplo n.º 2
0
        ///<summary>Inserts one Cpt into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Cpt cpt, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                cpt.CptNum = ReplicationServers.GetKey("cpt", "CptNum");
            }
            string command = "INSERT INTO cpt (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "CptNum,";
            }
            command += "CptCode,Description,VersionIDs) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(cpt.CptNum) + ",";
            }
            command +=
                "'" + POut.String(cpt.CptCode) + "',"
                + "'" + POut.String(cpt.Description) + "',"
                + "'" + POut.String(cpt.VersionIDs) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                cpt.CptNum = Db.NonQ(command, true, "CptNum", "cpt");
            }
            return(cpt.CptNum);
        }
Exemplo n.º 3
0
        ///<summary>Inserts one Cpt into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(Cpt cpt, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO cpt (";

            if (!useExistingPK && isRandomKeys)
            {
                cpt.CptNum = ReplicationServers.GetKeyNoCache("cpt", "CptNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "CptNum,";
            }
            command += "CptCode,Description,VersionIDs) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(cpt.CptNum) + ",";
            }
            command +=
                "'" + POut.String(cpt.CptCode) + "',"
                + "'" + POut.String(cpt.Description) + "',"
                + "'" + POut.String(cpt.VersionIDs) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                cpt.CptNum = Db.NonQ(command, true, "CptNum", "cpt");
            }
            return(cpt.CptNum);
        }
Exemplo n.º 4
0
        ///<summary>Updates one Cpt 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(Cpt cpt, Cpt oldCpt)
        {
            string command = "";

            if (cpt.CptCode != oldCpt.CptCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CptCode = '" + POut.String(cpt.CptCode) + "'";
            }
            if (cpt.Description != oldCpt.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(cpt.Description) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE cpt SET " + command
                      + " WHERE CptNum = " + POut.Long(cpt.CptNum);
            Db.NonQ(command);
        }
Exemplo n.º 5
0
 public void AfficherListeComptes()//Méthode pour afficher la liste des comptes et opérations
 {
     Console.WriteLine($"Liste des comptes du client : {this.Nom} {this.Prenom}");
     foreach (Compte Cpt  in ListeComptes)
     {
         Cpt.Consulter();
     }
 }
Exemplo n.º 6
0
        public void TestThat_CptHoldsValues(string code, string description)
        {
            var sut = new Cpt {
                Code = code, Description = description
            };

            Assert.Equal(code, sut.Code);
            Assert.Equal(description.ToUpper(), sut.Description);
        }
Exemplo n.º 7
0
        ///<summary>Updates one Cpt in the database.</summary>
        public static void Update(Cpt cpt)
        {
            string command = "UPDATE cpt SET "
                             + "CptCode    = '" + POut.String(cpt.CptCode) + "', "
                             + "Description= '" + POut.String(cpt.Description) + "' "
                             + "WHERE CptNum = " + POut.Long(cpt.CptNum);

            Db.NonQ(command);
        }
Exemplo n.º 8
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(NameTextBox.Text))
            {
                MessageBox.Show(ErrMsg.NameMissingError);
                return;
            }

            if (!Utils.ValidateRgb(this.StimulusColorTextBox.Text))
            {
                MessageBox.Show(ErrMsg.InvalidRGBcode);
                this.StimulusColorTextBox.Text = string.Empty;
                return;
            }

            var otherColors = new List <string>();

            if (string.IsNullOrWhiteSpace(this.OtherColorsTextBox.Text))
            {
                otherColors = null;
            }
            foreach (var choice in this.OtherColorsTextBox.Text.Split(','))
            {
                if (!string.IsNullOrEmpty(choice))
                {
                    otherColors.Add(choice);
                }
            }

            if (otherColors.Count == 0)
            {
                otherColors = null;
            }

            var newCpt = new Cpt()
            {
                stimulus_shape = this.StimulusShapeUpDown.Text,
                stimulus_color = this.StimulusColorTextBox.Text,
                other_colors   = otherColors,
                block          = (BlockNumeric.Value),
                sub_block      = (SubBlockNumeric.Value),
                name           = NameTextBox.Text
            };


            if (this._existingTrial != null)
            {
                this.ReturnEdit = newCpt;
            }

            else
            {
                MainForm.AddCpt(newCpt);
            }
            this.Close();
        }
Exemplo n.º 9
0
 public void AfficherListeComptes()
 {
     Console.WriteLine($"Liste des comptes du client : {this.Nom} {this.Prenom}");
     foreach (Compte Cpt in ListeComptes)
     {
         Cpt.Consulter();
         Cpt.AfficherOperation();
         Console.WriteLine();
     }
 }
Exemplo n.º 10
0
        /*private void butAdd_Click(object sender,EventArgs e) {
         *      //TODO: Either change to adding a snomed code instead of an ICD9 or don't allow users to add SNOMED codes other than importing.
         *      changed=true;
         *      Snomed snomed=new Snomed();
         *      FormSnomedEdit FormI=new FormSnomedEdit(snomed);
         *      FormI.IsNew=true;
         *      FormI.ShowDialog();
         *      FillGrid();
         * }*/

        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;
            }
            SelectedCpt  = (Cpt)gridMain.Rows[gridMain.GetSelectedIndex()].Tag;
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 11
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Cpt> TableToList(DataTable table){
			List<Cpt> retVal=new List<Cpt>();
			Cpt cpt;
			for(int i=0;i<table.Rows.Count;i++) {
				cpt=new Cpt();
				cpt.CptNum     = PIn.Long  (table.Rows[i]["CptNum"].ToString());
				cpt.CptCode    = PIn.String(table.Rows[i]["CptCode"].ToString());
				cpt.Description= PIn.String(table.Rows[i]["Description"].ToString());
				retVal.Add(cpt);
			}
			return retVal;
		}
Exemplo n.º 12
0
 ///<summary>Inserts one Cpt into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(Cpt cpt)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(cpt, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             cpt.CptNum = DbHelper.GetNextOracleKey("cpt", "CptNum");                  //Cacheless method
         }
         return(InsertNoCache(cpt, true));
     }
 }
Exemplo n.º 13
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Cpt> TableToList(DataTable table)
        {
            List <Cpt> retVal = new List <Cpt>();
            Cpt        cpt;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                cpt             = new Cpt();
                cpt.CptNum      = PIn.Long(table.Rows[i]["CptNum"].ToString());
                cpt.CptCode     = PIn.String(table.Rows[i]["CptCode"].ToString());
                cpt.Description = PIn.String(table.Rows[i]["Description"].ToString());
                retVal.Add(cpt);
            }
            return(retVal);
        }
Exemplo n.º 14
0
 ///<summary>Returns true if Update(Cpt,Cpt) 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(Cpt cpt, Cpt oldCpt)
 {
     if (cpt.CptCode != oldCpt.CptCode)
     {
         return(true);
     }
     if (cpt.Description != oldCpt.Description)
     {
         return(true);
     }
     if (cpt.VersionIDs != oldCpt.VersionIDs)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 15
0
        ///<summary>Sort function to put the codes that apply to the most number of CQM's at the top so the user can see which codes they should select.</summary>
        //private int SortMeasuresMet(ODGridRow row1,ODGridRow row2) {
        //	//First sort by the number of measures the codes apply to in a comma delimited list
        //	int diff=row2.Cells[2].Text.Split(new string[] { "," },StringSplitOptions.RemoveEmptyEntries).Length-row1.Cells[2].Text.Split(new string[] { "," },StringSplitOptions.RemoveEmptyEntries).Length;
        //	if(diff!=0) {
        //		return diff;
        //	}
        //	try {
        //		//if the codes apply to the same number of CQMs, order by the code values
        //		return PIn.Long(row1.Cells[0].Text).CompareTo(PIn.Long(row2.Cells[0].Text));
        //	}
        //	catch(Exception ex) {
        //		return 0;
        //	}
        //}

        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (IsSelectionMode)
            {
                SelectedCpt  = (Cpt)gridMain.Rows[e.Row].Tag;
                DialogResult = DialogResult.OK;
                return;
            }
            //changed=true;
            //FormSnomedEdit FormSE=new FormSnomedEdit((Snomed)gridMain.Rows[e.Row].Tag);
            //FormSE.ShowDialog();
            //if(FormSE.DialogResult!=DialogResult.OK) {
            //	return;
            //}
            //FillGrid();
        }
Exemplo n.º 16
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Cpt> TableToList(DataTable table)
        {
            List <Cpt> retVal = new List <Cpt>();
            Cpt        cpt;

            foreach (DataRow row in table.Rows)
            {
                cpt             = new Cpt();
                cpt.CptNum      = PIn.Long(row["CptNum"].ToString());
                cpt.CptCode     = PIn.String(row["CptCode"].ToString());
                cpt.Description = PIn.String(row["Description"].ToString());
                cpt.VersionIDs  = PIn.String(row["VersionIDs"].ToString());
                retVal.Add(cpt);
            }
            return(retVal);
        }
Exemplo n.º 17
0
        public List <Cpt> GetCpt(Object arg)
        {
            List <Cpt> _cpts = new List <Cpt>();

            if (arg is JArray)
            {
                _cpts = JsonConvert.DeserializeObject <List <Cpt> >(arg.ToString());
                foreach (var item in _cpts)
                {
                    item.WhenDic = JsonConvert.DeserializeObject <Dictionary <string, string> >(item.WhenObject.ToString());
                    item.ThenDic = JsonConvert.DeserializeObject <Dictionary <string, string> >(item.ThenObject.ToString());
                }
            }
            else if (arg is JObject)
            {
                Cpt cpt = new Cpt();
                cpt.SingleCptDic = JsonConvert.DeserializeObject <Dictionary <string, string> >(arg.ToString());

                _cpts.Add(cpt);
            }

            return(_cpts);
        }
Exemplo n.º 18
0
		///<summary>Inserts one Cpt into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(Cpt cpt,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				cpt.CptNum=ReplicationServers.GetKey("cpt","CptNum");
			}
			string command="INSERT INTO cpt (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="CptNum,";
			}
			command+="CptCode,Description) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(cpt.CptNum)+",";
			}
			command+=
				 "'"+POut.String(cpt.CptCode)+"',"
				+"'"+POut.String(cpt.Description)+"')";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				cpt.CptNum=Db.NonQ(command,true);
			}
			return cpt.CptNum;
		}
Exemplo n.º 19
0
        ///<summary>Updates one Cpt 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.  Returns true if an update occurred.</summary>
        public static bool Update(Cpt cpt, Cpt oldCpt)
        {
            string command = "";

            if (cpt.CptCode != oldCpt.CptCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CptCode = '" + POut.String(cpt.CptCode) + "'";
            }
            if (cpt.Description != oldCpt.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(cpt.Description) + "'";
            }
            if (cpt.VersionIDs != oldCpt.VersionIDs)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "VersionIDs = '" + POut.String(cpt.VersionIDs) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE cpt SET " + command
                      + " WHERE CptNum = " + POut.Long(cpt.CptNum);
            Db.NonQ(command);
            return(true);
        }
Exemplo n.º 20
0
Arquivo: CptCrud.cs Projeto: mnisl/OD
		///<summary>Inserts one Cpt into the database.  Returns the new priKey.</summary>
		public static long Insert(Cpt cpt){
			if(DataConnection.DBtype==DatabaseType.Oracle) {
				cpt.CptNum=DbHelper.GetNextOracleKey("cpt","CptNum");
				int loopcount=0;
				while(loopcount<100){
					try {
						return Insert(cpt,true);
					}
					catch(Oracle.DataAccess.Client.OracleException ex){
						if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
							cpt.CptNum++;
							loopcount++;
						}
						else{
							throw ex;
						}
					}
				}
				throw new ApplicationException("Insert failed.  Could not generate primary key.");
			}
			else {
				return Insert(cpt,false);
			}
		}
Exemplo n.º 21
0
Arquivo: CptCrud.cs Projeto: mnisl/OD
		///<summary>Updates one Cpt 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.  Returns true if an update occurred.</summary>
		public static bool Update(Cpt cpt,Cpt oldCpt){
			string command="";
			if(cpt.CptCode != oldCpt.CptCode) {
				if(command!=""){ command+=",";}
				command+="CptCode = '"+POut.String(cpt.CptCode)+"'";
			}
			if(cpt.Description != oldCpt.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(cpt.Description)+"'";
			}
			if(cpt.VersionIDs != oldCpt.VersionIDs) {
				if(command!=""){ command+=",";}
				command+="VersionIDs = '"+POut.String(cpt.VersionIDs)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE cpt SET "+command
				+" WHERE CptNum = "+POut.Long(cpt.CptNum);
			Db.NonQ(command);
			return true;
		}
Exemplo n.º 22
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);
            }
        }
Exemplo n.º 23
0
Arquivo: CptCrud.cs Projeto: mnisl/OD
		///<summary>Updates one Cpt in the database.</summary>
		public static void Update(Cpt cpt){
			string command="UPDATE cpt SET "
				+"CptCode    = '"+POut.String(cpt.CptCode)+"', "
				+"Description= '"+POut.String(cpt.Description)+"', "
				+"VersionIDs = '"+POut.String(cpt.VersionIDs)+"' "
				+"WHERE CptNum = "+POut.Long(cpt.CptNum);
			Db.NonQ(command);
		}
Exemplo n.º 24
0
 public int SaveCpt(Cpt entity)
 {
     return(CptDao.Save(entity));
 }
Exemplo n.º 25
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();
        }
 public static void AddCpt(Cpt obj)
 {
     AddTrial(obj);
     CptCount++;
 }
Exemplo n.º 27
0
		///<summary>Updates one Cpt 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(Cpt cpt,Cpt oldCpt){
			string command="";
			if(cpt.CptCode != oldCpt.CptCode) {
				if(command!=""){ command+=",";}
				command+="CptCode = '"+POut.String(cpt.CptCode)+"'";
			}
			if(cpt.Description != oldCpt.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(cpt.Description)+"'";
			}
			if(command==""){
				return;
			}
			command="UPDATE cpt SET "+command
				+" WHERE CptNum = "+POut.Long(cpt.CptNum);
			Db.NonQ(command);
		}
Exemplo n.º 28
0
        private void FillGridInterventions()
        {
            gridInterventions.BeginUpdate();
            gridInterventions.Columns.Clear();
            gridInterventions.Columns.Add(new ODGridColumn("Date", 70));
            gridInterventions.Columns.Add(new ODGridColumn("Type", 150));
            gridInterventions.Columns.Add(new ODGridColumn("Description", 160));
            gridInterventions.Columns.Add(new ODGridColumn("Declined", 60)
            {
                TextAlign = HorizontalAlignment.Center
            });
            gridInterventions.Columns.Add(new ODGridColumn("Documentation", 140));
            gridInterventions.Rows.Clear();
            //build list of rows of CessationInterventions and CessationMedications so we can order the list by date and type before filling the grid
            List <ODGridRow> listRows = new List <ODGridRow>();
            ODGridRow        row;

            #region CessationInterventions
            List <Intervention> listInterventions = Interventions.Refresh(PatCur.PatNum, InterventionCodeSet.TobaccoCessation);
            foreach (Intervention iCur in listInterventions)
            {
                row = new ODGridRow();
                row.Cells.Add(iCur.DateEntry.ToShortDateString());
                string type     = InterventionCodeSet.TobaccoCessation.ToString() + " Counseling";
                string descript = "";
                switch (iCur.CodeSystem)
                {
                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(iCur.CodeValue);
                    descript = cptCur != null?cptCur.Description:"";
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(iCur.CodeValue);
                    descript = sCur != null?sCur.Description:"";
                    break;

                case "RXNORM":
                    //if the user checks the "Patient Declined" checkbox, we enter the tobacco cessation medication as an intervention that was declined
                    type = InterventionCodeSet.TobaccoCessation.ToString() + " Medication";
                    RxNorm rCur = RxNorms.GetByRxCUI(iCur.CodeValue);
                    descript = rCur != null?rCur.Description:"";
                    break;
                }
                row.Cells.Add(type);
                row.Cells.Add(descript);
                row.Cells.Add(iCur.IsPatDeclined?"X":"");
                row.Cells.Add(iCur.Note);
                row.Tag = iCur;
                listRows.Add(row);
            }
            #endregion
            #region CessationMedications
            //Tobacco Use Cessation Pharmacotherapy Value Set
            string[] arrayRxCuiStrings = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1190"
            }, true)
                                         .Select(x => x.CodeValue).ToArray();
            //arrayRxCuiStrings will contain 41 RxCui strings for tobacco cessation medications if those exist in the rxnorm table
            List <MedicationPat> listMedPats = MedicationPats.Refresh(PatCur.PatNum, true).FindAll(x => arrayRxCuiStrings.Contains(x.RxCui.ToString()));
            foreach (MedicationPat medPatCur in listMedPats)
            {
                row = new ODGridRow();
                List <string> listMedDates = new List <string>();
                if (medPatCur.DateStart.Year > 1880)
                {
                    listMedDates.Add(medPatCur.DateStart.ToShortDateString());
                }
                if (medPatCur.DateStop.Year > 1880)
                {
                    listMedDates.Add(medPatCur.DateStop.ToShortDateString());
                }
                if (listMedDates.Count == 0)
                {
                    listMedDates.Add(medPatCur.DateTStamp.ToShortDateString());
                }
                row.Cells.Add(string.Join(" - ", listMedDates));
                row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication");
                row.Cells.Add(RxNorms.GetDescByRxCui(medPatCur.RxCui.ToString()));
                row.Cells.Add(medPatCur.PatNote);
                row.Tag = medPatCur;
                listRows.Add(row);
            }
            #endregion
            listRows.OrderBy(x => PIn.Date(x.Cells[0].Text))            //rows ordered by date, oldest first
            .ThenBy(x => x.Cells[3].Text != "")
            //interventions at the top, declined med interventions below normal interventions
            .ThenBy(x => x.Tag.GetType().Name != "Intervention" || ((Intervention)x.Tag).CodeSystem == "RXNORM").ToList()
            .ForEach(x => gridInterventions.Rows.Add(x));                    //then add rows to gridInterventions
            gridInterventions.EndUpdate();
        }
Exemplo n.º 29
0
 public void UpdateCpt(Cpt entity)
 {
     CptDao.Update(entity);
 }
Exemplo n.º 30
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn("Date", 70);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Prov", 50);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Item Not Performed", 130);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Code", 102);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Code Description", 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Reason Code", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Reason Description", 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Note", 150);
            gridMain.ListGridColumns.Add(col);
            listNotPerf = EhrNotPerformeds.Refresh(PatCur.PatNum);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < listNotPerf.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(listNotPerf[i].DateEntry.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listNotPerf[i].ProvNum));
                //Item not performed------------------------------------------------------------
                switch (listNotPerf[i].CodeValue)
                {
                case "39156-5":                        //BMI exam
                    row.Cells.Add(EhrNotPerformedItem.BMIExam.ToString());
                    break;

                case "428191000124101":                        //CurrentMedsDocumented
                    row.Cells.Add(EhrNotPerformedItem.DocumentCurrentMeds.ToString());
                    break;

                case "11366-2":                        //History of tobacco use Narrative
                case "68535-4":                        //Have you used tobacco in the last 30 days
                case "68536-2":                        //Have you used smokeless tobacco in last 30 days
                    row.Cells.Add(EhrNotPerformedItem.TobaccoScreening.ToString());
                    break;

                default:                        //We will default to Influenza Vaccine, there are 26 codes, for this item
                    row.Cells.Add(EhrNotPerformedItem.InfluenzaVaccination.ToString());
                    break;
                }
                //Code not performed------------------------------------------------------------
                row.Cells.Add(listNotPerf[i].CodeValue + " (" + listNotPerf[i].CodeSystem + ")");
                //Description of code not performed---------------------------------------------
                string descript = "";
                //to get description, first determine which table the code is from.  EhrNotPerformed is allowed to be CPT, CVX, LOINC, SNOMEDCT.
                switch (listNotPerf[i].CodeSystem)
                {
                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(listNotPerf[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;

                case "CVX":
                    Cvx cvxCur = Cvxs.GetOneFromDb(listNotPerf[i].CodeValue);
                    if (cvxCur != null)
                    {
                        descript = cvxCur.Description;
                    }
                    break;

                case "LOINC":
                    Loinc lCur = Loincs.GetByCode(listNotPerf[i].CodeValue);
                    if (lCur != null)
                    {
                        descript = lCur.NameLongCommon;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listNotPerf[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                //Reason Code-------------------------------------------------------------------
                row.Cells.Add(listNotPerf[i].CodeValueReason + " (" + listNotPerf[i].CodeSystemReason + ")");
                //Reason Description------------------------------------------------------------
                descript = "";
                if (listNotPerf[i].CodeValueReason != "")
                {
                    //reason codes are only allowed to be SNOMEDCT codes
                    Snomed sCur = Snomeds.GetByCode(listNotPerf[i].CodeValueReason);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                }
                row.Cells.Add(descript);
                //Note--------------------------------------------------------------------------
                row.Cells.Add(listNotPerf[i].Note);
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 31
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();
        }
Exemplo n.º 32
0
 ///<summary>Inserts one Cpt into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(Cpt cpt)
 {
     return(InsertNoCache(cpt, false));
 }
Exemplo n.º 33
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;
            }
        }
Exemplo n.º 34
0
 ///<summary>Inserts one Cpt into the database.  Returns the new priKey.</summary>
 public static long Insert(Cpt cpt)
 {
     return(Insert(cpt, false));
 }
Exemplo n.º 35
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Date", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Type", 170);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 170);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Documentation", 170);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow        row;
            List <ODGridRow> listRows = new List <ODGridRow>();

            #region AssessedEvents
            _ListEvents = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.TobaccoUseAssessed);
            for (int i = 0; i < _ListEvents.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_ListEvents[i].DateTEvent.ToShortDateString());
                Loinc lCur = Loincs.GetByCode(_ListEvents[i].CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                if (lCur != null)
                {
                    row.Cells.Add(lCur.NameLongCommon);
                }
                else
                {
                    row.Cells.Add(_ListEvents[i].EventType.ToString());
                }
                Snomed sCur = Snomeds.GetByCode(_ListEvents[i].CodeValueResult);
                if (sCur != null)
                {
                    row.Cells.Add(sCur.Description);
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(_ListEvents[i].MoreInfo);
                row.Tag = _ListEvents[i];
                listRows.Add(row);
            }
            #endregion
            #region CessationInterventions
            _ListInterventions = Interventions.Refresh(PatCur.PatNum, InterventionCodeSet.TobaccoCessation);
            for (int i = 0; i < _ListInterventions.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_ListInterventions[i].DateEntry.ToShortDateString());
                row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Counseling");
                string descript = "";
                switch (_ListInterventions[i].CodeSystem)
                {
                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(_ListInterventions[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(_ListInterventions[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                row.Cells.Add(_ListInterventions[i].Note);
                row.Tag = _ListInterventions[i];
                listRows.Add(row);
            }
            #endregion
            #region CessationMedications
            _ListMedPats = MedicationPats.Refresh(PatCur.PatNum, true);
            List <EhrCode> listEhrMeds = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1190"
            }, true);                                                                                                                     //Tobacco Use Cessation Pharmacotherapy Value Set
            //listEhrMeds will contain 41 medications for tobacco cessation if those exist in the rxnorm table
            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();
                string dateRange = "";
                if (_ListMedPats[i].DateStart.Year > 1880)
                {
                    dateRange = _ListMedPats[i].DateStart.ToShortDateString();
                }
                if (_ListMedPats[i].DateStop.Year > 1880)
                {
                    if (dateRange != "")
                    {
                        dateRange += " - ";
                    }
                    dateRange += _ListMedPats[i].DateStop.ToShortDateString();
                }
                if (dateRange == "")
                {
                    dateRange = _ListMedPats[i].DateTStamp.ToShortDateString();
                }
                row.Cells.Add(dateRange);
                row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication");
                string medDescript = RxNorms.GetDescByRxCui(_ListMedPats[i].RxCui.ToString());
                row.Cells.Add(medDescript);
                row.Cells.Add(_ListMedPats[i].PatNote);
                row.Tag = _ListMedPats[i];
                listRows.Add(row);
            }
            #endregion
            listRows.Sort(SortDate);
            for (int i = 0; i < listRows.Count; i++)
            {
                gridMain.Rows.Add(listRows[i]);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 36
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;
                }
            }
        }