コード例 #1
0
		///<summary></summary>
		public static long Insert(Medication Cur) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Cur.MedicationNum=Meth.GetLong(MethodBase.GetCurrentMethod(),Cur);
				return Cur.MedicationNum;
			}
			return Crud.MedicationCrud.Insert(Cur);
		}
コード例 #2
0
		///<summary></summary>
		public static void Update(Medication Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
				return;
			}
			Crud.MedicationCrud.Update(Cur);
		}
コード例 #3
0
ファイル: Medications.cs プロジェクト: nampn/ODental
 ///<summary>Dependent brands and patients will already be checked.</summary>
 public static void Delete(Medication Cur)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
         return;
     }
     string command = "DELETE from medication WHERE medicationNum = '"+Cur.MedicationNum.ToString()+"'";
     Db.NonQ(command);
     DeletedObjects.SetDeleted(DeletedObjectType.Medication,Cur.MedicationNum);
 }
コード例 #4
0
		///<summary>Dependent brands and patients will already be checked.  Be sure to surround with try-catch.</summary>
		public static void Delete(Medication Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
				return;
			}
			string s=IsInUse(Cur);
			if(s!="") {
				throw new ApplicationException(Lans.g("Medications",s));
			}
			string command = "DELETE from medication WHERE medicationNum = '"+Cur.MedicationNum.ToString()+"'";
			Db.NonQ(command);
		}
コード例 #5
0
ファイル: Medications.cs プロジェクト: mnisl/OD
		///<summary>All medications.  Not refreshed with local data.  Only refreshed as needed.</summary>
		public static Medication[] GetListt() {
			bool isListNull=false;
			lock(_lockObj) {
				if(_listt==null) {
					isListNull=true;
				}
			}
			if(isListNull) {
				Refresh();
			}
			Medication[] arrayMedications;
			lock(_lockObj) {
				arrayMedications=new Medication[_listt.Length];
				for(int i=0;i<_listt.Length;i++) {
					arrayMedications[i]=_listt[i].Copy();
				}
			}
			return arrayMedications;
		}
コード例 #6
0
ファイル: FormMedications.cs プロジェクト: nampn/ODental
 private void butAddBrand_Click(object sender, System.EventArgs e)
 {
     if(gridMain.GetSelectedIndex()==-1){
         MessageBox.Show(Lan.g(this,"You must first highlight the generic medication from the list.  If it is not already on the list, then you must add it first."));
         return;
     }
     Medication selected=medList[gridMain.GetSelectedIndex()];
     if(selected.MedicationNum!=selected.GenericNum){
         MessageBox.Show(Lan.g(this,"The selected medication is not generic."));
         return;
     }
     Medication MedicationCur=new Medication();
     Medications.Insert(MedicationCur);//so that we will have the primary key
     MedicationCur.GenericNum=selected.MedicationNum;
     FormMedicationEdit FormME=new FormMedicationEdit();
     FormME.MedicationCur=MedicationCur;
     FormME.IsNew=true;
     FormME.ShowDialog();
     FillGrid();
 }
コード例 #7
0
ファイル: Medications.cs プロジェクト: steev90/opendental
        ///<summary>Returns a string if medication is in use in medicationpat, allergydef, eduresources, or preference.MedicationsIndicateNone. The string will explain where the medication is in use.</summary>
        public static string IsInUse(Medication med)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), med.MedicationNum));
            }
            string[] brands;
            if (med.MedicationNum == med.GenericNum)
            {
                brands = GetBrands(med.MedicationNum);
            }
            else
            {
                brands = new string[0];
            }
            if (brands.Length > 0)
            {
                return("You can not delete a medication that has brand names attached.");
            }
            string command = "SELECT COUNT(*) FROM medicationpat WHERE MedicationNum=" + POut.Long(med.MedicationNum);

            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by a patient");
            }
            command = "SELECT COUNT(*) FROM allergydef WHERE MedicationNum=" + POut.Long(med.MedicationNum);
            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by an allergy");
            }
            command = "SELECT COUNT(*) FROM eduresource WHERE MedicationNum=" + POut.Long(med.MedicationNum);
            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by an education resource");
            }
            if (PrefC.GetLong(PrefName.MedicationsIndicateNone) == med.MedicationNum)
            {
                return("Not allowed to delete medication because it is in use by a medication");
            }
            return("");
        }
コード例 #8
0
        ///<summary>Gets the medication name.  Also, generic in () if applicable.  Returns empty string if not found.</summary>
        public static string GetDescription(long medNum)
        {
            //No need to check RemotingRole; no call to db.
            if (!HasMedicationInCache(medNum))
            {
                return("");
            }
            Medication med    = GetOne(medNum);
            string     retVal = med.MedName;

            if (med.GenericNum == med.MedicationNum)          //this is generic
            {
                return(retVal);
            }
            if (!GetContainsKey(med.GenericNum))
            {
                return(retVal);
            }
            Medication generic = GetOne(med.GenericNum);

            return(retVal + "(" + generic.MedName + ")");
        }
コード例 #9
0
		///<summary>Returns a string if medication is in use in medicationpat, allergydef, eduresources, or preference.MedicationsIndicateNone. The string will explain where the medication is in use.</summary>
		public static string IsInUse(Medication med) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetString(MethodBase.GetCurrentMethod(),med.MedicationNum);
			}
			string[] brands;
			if(med.MedicationNum==med.GenericNum) {
				brands=GetBrands(med.MedicationNum);
			}
			else {
				brands=new string[0];
			}
			if(brands.Length>0) {
				return "You can not delete a medication that has brand names attached.";
			}
			string command="SELECT COUNT(*) FROM medicationpat WHERE MedicationNum="+POut.Long(med.MedicationNum);
			if(PIn.Int(Db.GetCount(command))!=0) {
				return "Not allowed to delete medication because it is in use by a patient";
			}
			command="SELECT COUNT(*) FROM allergydef WHERE MedicationNum="+POut.Long(med.MedicationNum);
			if(PIn.Int(Db.GetCount(command))!=0) {
				return "Not allowed to delete medication because it is in use by an allergy";
			}
			command="SELECT COUNT(*) FROM eduresource WHERE MedicationNum="+POut.Long(med.MedicationNum);
			if(PIn.Int(Db.GetCount(command))!=0) {
				return "Not allowed to delete medication because it is in use by an education resource";
			}
			if(PrefC.GetLong(PrefName.MedicationsIndicateNone)==med.MedicationNum) {
				return "Not allowed to delete medication because it is in use by a medication";
			}
			return "";
		}
コード例 #10
0
		private void butOK_Click(object sender,EventArgs e) {
			//validate--------------------------------------
			DateTime date;
			if(textDate.Text=="") {
				MsgBox.Show(this,"Please enter a date.");
				return;
			}
			try {
				date=DateTime.Parse(textDate.Text);
			}
			catch {
				MsgBox.Show(this,"Please fix date first.");
				return;
			}
			string codeVal="";
			string codeSys="";
			if(gridMain.GetSelectedIndex()==-1) {//no intervention code selected
				MsgBox.Show(this,"You must select a code for this intervention.");
				return;
			}
			else {
				codeVal=listCodes[gridMain.GetSelectedIndex()].CodeValue;
				codeSys=listCodes[gridMain.GetSelectedIndex()].CodeSystem;
				Description=gridMain.Rows[gridMain.GetSelectedIndex()].Cells[2].Text;
			}
			//save--------------------------------------
			//Intervention grid may contain medications, have to insert a new med if necessary and load FormMedPat for user to input data
			if(codeSys=="RXNORM") {
				//codeVal will be RxCui of medication, see if it already exists in Medication table
				Medication medCur=Medications.GetMedicationFromDbByRxCui(PIn.Long(codeVal));
				if(medCur==null) {//no med with this RxCui, create one
					medCur=new Medication();
					Medications.Insert(medCur);//so that we will have the primary key
					medCur.GenericNum=medCur.MedicationNum;
					medCur.RxCui=PIn.Long(codeVal);
					medCur.MedName=RxNorms.GetDescByRxCui(codeVal);
					Medications.Update(medCur);
					Medications.Refresh();//refresh cache to include new medication
				}
				MedicationPat medPatCur=new MedicationPat();
				medPatCur.PatNum=InterventionCur.PatNum;
				medPatCur.ProvNum=InterventionCur.ProvNum;
				medPatCur.MedicationNum=medCur.MedicationNum;
				medPatCur.RxCui=medCur.RxCui;
				medPatCur.DateStart=date;
				FormMedPat FormMP=new FormMedPat();
				FormMP.MedicationPatCur=medPatCur;
				FormMP.IsNew=true;
				FormMP.ShowDialog();
				if(FormMP.DialogResult!=DialogResult.OK) {
					return;
				}
				if(FormMP.MedicationPatCur.DateStart.Date<InterventionCur.DateEntry.AddMonths(-6).Date || FormMP.MedicationPatCur.DateStart.Date>InterventionCur.DateEntry.Date) {
					MsgBox.Show(this,"The medication order just entered is not within the 6 months prior to the date of this intervention.  You can modify the date of the medication order in the patient's medical history section.");
				}
				DialogResult=DialogResult.OK;
				return;
			}
			InterventionCur.DateEntry=date;
			InterventionCur.CodeValue=codeVal;
			InterventionCur.CodeSystem=codeSys;
			InterventionCur.Note=textNote.Text;
			string selectedCodeSet=comboCodeSet.SelectedItem.ToString().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries)[0];
			if(IsAllTypes) {//CodeSet will be set by calling function unless showing all types, in which case we need to determine which InterventionCodeSet to assign
				if(selectedCodeSet=="All") {//All types showing and set to All, have to determine which InterventionCodeSet this code belongs to
					List<string> listVSFound=new List<string>();
					foreach(KeyValuePair<string,string> kvp in dictValueCodeSets) {
						List<EhrCode> listCodes=EhrCodes.GetForValueSetOIDs(new List<string> { kvp.Value },true);
						for(int i=0;i<listCodes.Count;i++) {
							if(listCodes[i].CodeValue==codeVal) {
								listVSFound.Add(kvp.Key);
								break;
							}
						}
					}
					if(listVSFound.Count>1) {//Selected code found in more than one value set, ask the user which InterventionCodeSet to assign to this intervention
						InputBox chooseSet=new InputBox(Lan.g(this,"The selected code belongs to more than one intervention code set.  Select the code set to assign to this intervention from the list below."),listVSFound);
						if(chooseSet.ShowDialog()!=DialogResult.OK) {
							return;
						}
						if(chooseSet.comboSelection.SelectedIndex==-1) {
							MsgBox.Show(this,"You must select an intervention code set for the selected code.");
							return;
						}
						selectedCodeSet=chooseSet.comboSelection.SelectedItem.ToString().Split(new char[] { ' ' },StringSplitOptions.RemoveEmptyEntries)[0];
					}
					else {//the code must belong to at least one value set, since count in listVSFound is not greater than 1, it must be a code from exactly one set, use that for the InterventionCodeSet
						selectedCodeSet=listVSFound[0].Split(new char[] { ' ' },StringSplitOptions.RemoveEmptyEntries)[0];
					}
				}
				InterventionCur.CodeSet=(InterventionCodeSet)Enum.Parse(typeof(InterventionCodeSet),selectedCodeSet);
			}
			//Nutrition is used for both nutrition and physical activity counseling for children, we have to determine which set this code belongs to
			else if(InterventionCur.CodeSet==InterventionCodeSet.Nutrition && selectedCodeSet!="Nutrition") {//Nutrition set by calling form, user is showing all or physical activity codes only
				if(selectedCodeSet=="All") {//showing all codes from Nutrition and PhysicalActivity interventions, determine which set it belongs to
					//No codes exist in both code sets, so if it is not in the PhysicalActivity code set, we can safely assume this is a Nutrition intervention
					List<EhrCode> listCodes=EhrCodes.GetForValueSetOIDs(new List<string> { dictValueCodeSets[InterventionCodeSet.PhysicalActivity.ToString()+" Counseling"] },true);
					for(int i=0;i<listCodes.Count;i++) {
						if(listCodes[i].CodeValue==codeVal) {
							InterventionCur.CodeSet=InterventionCodeSet.PhysicalActivity;
							break;
						}
					}
				}
				else {
					InterventionCur.CodeSet=InterventionCodeSet.PhysicalActivity;
				}
			}
			else {
				//if not all types, and not Nutrition with All or PhysicalActivity selected in combo box, the code set sent in by calling form will remain the code set for this intervention
			}
			if(InterventionCur.IsNew) {
				Interventions.Insert(InterventionCur);
			}
			else {
				Interventions.Update(InterventionCur);
			}
			DialogResult=DialogResult.OK;
		}
コード例 #11
0
ファイル: EhrCCD.cs プロジェクト: mnisl/OD
		///<summary>Fills listAllergies and listAllergyDefs using the information found in the CCD document xmlDocCcd.  Inserts a medication in the db corresponding to the allergy.</summary>
		public static void GetListAllergies(XmlDocument xmlDocCcd,List<Allergy> listAllergies,List<AllergyDef> listAllergyDefs) {
			//The length of listAllergies and listAllergyDefs will be the same. The information in listAllergyDefs might have duplicates.
			//Neither list of objects will be inserted into the db, so there will be no primary or foreign keys.
			List<XmlNode> listAllergyProblemActTemplate=GetNodesByTagNameAndAttributes(xmlDocCcd,"templateId","root","2.16.840.1.113883.10.20.22.4.30");//Allergy problem act template.
			List<XmlNode> listActs=GetParentNodes(listAllergyProblemActTemplate);
			for(int i=0;i<listActs.Count;i++) {
				//We have to start fairly high in the tree so that we can get the effective time if it is available.
				List<XmlNode> xmlNodeEffectiveTimes=GetNodesByTagNameAndAttributes(listActs[i],"effectiveTime");//POCD_HD00040.xls line 492. Not required.
				DateTime dateTimeEffectiveLow=DateTime.MinValue;
				DateTime dateTimeEffectiveHigh=DateTime.MinValue;
				if(xmlNodeEffectiveTimes.Count>0) {
					XmlNode xmlNodeEffectiveTime=xmlNodeEffectiveTimes[0];
					dateTimeEffectiveLow=GetEffectiveTimeLow(xmlNodeEffectiveTime);
					dateTimeEffectiveHigh=GetEffectiveTimeHigh(xmlNodeEffectiveTime);
				}
				List<XmlNode> listAllergyObservationTemplates=GetNodesByTagNameAndAttributes(listActs[i],"templateId","root","2.16.840.1.113883.10.20.22.4.7");//Allergy observation template.
				List<XmlNode> listAllergy=GetParentNodes(listAllergyObservationTemplates);//List of Allergy Observations.
				List<XmlNode> listCodes=GetNodesByTagNameAndAttributesFromList(listAllergy,"value");
				#region Determine if Active
				bool isActive=true;
				string strStatus="";
				List<XmlNode> listAllergyObservationTemplatesActive=GetNodesByTagNameAndAttributes(listActs[i],"templateId","root","2.16.840.1.113883.10.20.22.4.28");//Allergy observation template.
				List<XmlNode> listAllergyActive=GetParentNodes(listAllergyObservationTemplatesActive);//List of Allergy Observations.
				List<XmlNode> listCodesActive=GetNodesByTagNameAndAttributesFromList(listAllergyActive,"value");
				if(listCodesActive.Count>0) {
					listCodes.Remove(listCodesActive[0]);
					XmlNode xmlNodeCode=listCodesActive[0];
					if(xmlNodeCode.Attributes["nullFlavor"]!=null) {
						continue;
					}
					strStatus=xmlNodeCode.Attributes["code"].Value;
					if(xmlNodeCode.Attributes["codeSystem"].Value!=strCodeSystemSnomed) {
						continue;//We can only import Snomeds
					}
					isActive=(strStatus=="55561003");//Active (qualifier value)
				}
				#endregion
				#region Find Reaction Snomed
				List<XmlNode> listAllergyStatusObservationTemplates=GetNodesByTagNameAndAttributes(listActs[i],"templateId","root","2.16.840.1.113883.10.20.22.4.9");//Allergy status observation template.
				List<XmlNode> listAllergyStatus=GetParentNodes(listAllergyStatusObservationTemplates);//List of Allergy Observations.
				List<XmlNode> listAlgCodes=GetNodesByTagNameAndAttributesFromList(listAllergyStatus,"value");
				for(int j=0;j<listAlgCodes.Count;j++) {
					listCodes.Remove(listAlgCodes[j]);
					XmlNode xmlNodeCode=listAlgCodes[j];
					string strCodeReaction=xmlNodeCode.Attributes["code"].Value;
					string strAlgStatusDescript=xmlNodeCode.Attributes["displayName"].Value;
					if(xmlNodeCode.Attributes["codeSystem"].Value!=strCodeSystemSnomed) {
						continue;//We can only import Snomeds
					}
					Allergy allergy=new Allergy();
					allergy.IsNew=true;//Needed for reconcile window to know this record is not in the db yet.
					allergy.SnomedReaction=PIn.String(strCodeReaction);
					allergy.Reaction=PIn.String(strAlgStatusDescript);
					allergy.DateAdverseReaction=dateTimeEffectiveLow;
					allergy.StatusIsActive=isActive;
					listAllergies.Add(allergy);
				}
				#endregion
				#region Remove Severe Reaction
				List<XmlNode> listAllergySevereTemplates=GetNodesByTagNameAndAttributes(listActs[i],"templateId","root","2.16.840.1.113883.10.20.22.4.8");//Allergy observation template.
				List<XmlNode> listAllergySevere=GetParentNodes(listAllergySevereTemplates);//List of Allergy Observations.
				List<XmlNode> listCodesSevere=GetNodesByTagNameAndAttributesFromList(listAllergySevere,"value");
				for(int j=0;j<listCodesSevere.Count;j++) {
					listCodes.Remove(listCodesSevere[j]);
					XmlNode xmlNodeCode=listCodesSevere[j];
					string strCodeReaction=xmlNodeCode.Attributes["code"].Value;
					string strAlgStatusDescript=xmlNodeCode.Attributes["displayName"].Value;
					if(xmlNodeCode.Attributes["codeSystem"].Value!=strCodeSystemSnomed) {
						continue;//We can only import Snomeds
					}
				}
				#endregion
				#region Find RxNorm or Snomed
				string allergyDefName="";
				Medication med=new Medication();
				List<XmlNode> listRxCodes=GetNodesByTagNameAndAttributesFromList(listAllergy,"code");
				List<Medication> allergyMeds=new List<Medication>();
				for(int j=0;j<listRxCodes.Count;j++) {
					XmlNode xmlNodeCode=listRxCodes[j];
					if(xmlNodeCode.Attributes[0].Name!="code") {
						continue;
					}
					if(xmlNodeCode.Attributes["codeSystem"].Value!=strCodeSystemRxNorm) {
						continue;//We only want RxNorms here.
					}
					string strCodeRx=xmlNodeCode.Attributes["code"].Value;
					string strRxName=xmlNodeCode.Attributes["displayName"].Value;//Look into this being required or not.
					allergyDefName=strRxName;
					med=Medications.GetMedicationFromDbByRxCui(PIn.Long(strCodeRx));
					if(med==null) {
						med=new Medication();
						med.MedName=strRxName;
						med.RxCui=PIn.Long(strCodeRx);
						Medications.Insert(med);
						med.GenericNum=med.MedicationNum;
						Medications.Update(med);
					}
					allergyMeds.Add(med);
				}
				#endregion
				for(int j=0;j<listCodes.Count;j++) {
					XmlNode xmlNodeCode=listCodes[j];
					string strCode=xmlNodeCode.Attributes["code"].Value;
					if(xmlNodeCode.Attributes["codeSystem"].Value!=strCodeSystemSnomed) {
						continue;//We can only import Snomeds
					}
					AllergyDef allergyDef=new AllergyDef();
					allergyDef.IsNew=true;//Needed for reconcile window to know this record is not in the db yet.
					if(med.MedicationNum!=0) {
						allergyDef.MedicationNum=med.MedicationNum;
					}
					//else {TODO: Change to Unii
					//	allergyDef.SnomedAllergyTo=PIn.String(strCode);
					//}
					allergyDef.Description=allergyDefName;
					allergyDef.IsHidden=false;
					allergyDef.MedicationNum=allergyMeds[j].MedicationNum;
					#region Snomed type determination
					if(strCode=="419511003") {
						allergyDef.SnomedType=SnomedAllergy.AdverseReactionsToDrug;
					}
					else if(strCode=="418471000") {
						allergyDef.SnomedType=SnomedAllergy.AdverseReactionsToFood;
					}
					else if(strCode=="419199007") {
						allergyDef.SnomedType=SnomedAllergy.AdverseReactionsToSubstance;
					}
					else if(strCode=="418038007") {
						allergyDef.SnomedType=SnomedAllergy.AllergyToSubstance;
					}
					else if(strCode=="416098002") {
						allergyDef.SnomedType=SnomedAllergy.DrugAllergy;
					}
					else if(strCode=="59037007") {
						allergyDef.SnomedType=SnomedAllergy.DrugIntolerance;
					}
					else if(strCode=="414285001") {
						allergyDef.SnomedType=SnomedAllergy.FoodAllergy;
					}
					else if(strCode=="235719002") {
						allergyDef.SnomedType=SnomedAllergy.FoodIntolerance;
					}
					else if(strCode=="420134006") {
						allergyDef.SnomedType=SnomedAllergy.AdverseReactions;
					}
					else {
						allergyDef.SnomedType=SnomedAllergy.None;
					}
					#endregion
					listAllergyDefs.Add(allergyDef);
				}
			}
		}
コード例 #12
0
ファイル: FormReconcileMedication.cs プロジェクト: mnisl/OD
		private void butOK_Click(object sender,EventArgs e) {
			if(_listMedicationPatReconcile.Count==0) {
				if(!MsgBox.Show(this,true,"The reconcile list is empty which will cause all existing medications to be removed.  Continue?")) {
					return;
				}
			}
			MedicationPat medP;
			bool isActive;
			//Discontinue any current medications that are not present in the reconcile list.
			for(int i=0;i<_listMedicationPatCur.Count;i++) {//Start looping through all current medications
				isActive=false;
				medP=_listMedicationPatCur[i];
				for(int j=0;j<_listMedicationPatReconcile.Count;j++) {//Compare each reconcile medication to the current medication
					if(medP.RxCui > 0 && medP.RxCui==_listMedicationPatReconcile[j].RxCui && _listMedicationPatReconcile[j].MedicationNum==_listMedicationPatCur[i].MedicationNum) {//Has an RxNorm code and they are equal
						isActive=true;
						break;
					}
				}
				if(!isActive) {//Update current medications.
					_listMedicationPatCur[i].DateStop=DateTime.Now;//Set the current DateStop to today (to set the medication as discontinued)
					MedicationPats.Update(_listMedicationPatCur[i]);
				}
			}
			//Always update every current medication for the patient so that DateTStamp reflects the last reconcile date.
			if(_listMedicationPatCur.Count>0) {
				MedicationPats.ResetTimeStamps(_patCur.PatNum,true);
			}
			Medication med;
			int index;
			for(int j=0;j<_listMedicationPatReconcile.Count;j++) {
				index=ListMedicationPatNew.IndexOf(_listMedicationPatReconcile[j]);
				if(index<0) {
					continue;
				}
				if(_listMedicationPatReconcile[j]==ListMedicationPatNew[index]) {
					med=Medications.GetMedicationFromDbByRxCui(_listMedicationPatReconcile[j].RxCui);
					if(med==null) {
						med=new Medication();
						med.MedName=ListMedicationPatNew[index].MedDescript;
						med.RxCui=ListMedicationPatNew[index].RxCui;
						ListMedicationPatNew[index].MedicationNum=Medications.Insert(med);
						med.GenericNum=med.MedicationNum;
						Medications.Update(med);
					}
					else {
						ListMedicationPatNew[index].MedicationNum=med.MedicationNum;
					}
					ListMedicationPatNew[index].ProvNum=0;//Since imported, set provnum to 0 so it does not affect CPOE.
					MedicationPats.Insert(ListMedicationPatNew[index]);
				}
			}
			EhrMeasureEvent newMeasureEvent=new EhrMeasureEvent();
			newMeasureEvent.DateTEvent=DateTime.Now;
			newMeasureEvent.EventType=EhrMeasureEventType.MedicationReconcile;
			newMeasureEvent.PatNum=_patCur.PatNum;
			newMeasureEvent.MoreInfo="";
			EhrMeasureEvents.Insert(newMeasureEvent);
			for(int inter=0;inter<_listMedicationPatReconcile.Count;inter++) {
				if(CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS && CDSPermissions.GetForUser(Security.CurUser.UserNum).MedicationCDS) {
					Medication medInter=Medications.GetMedicationFromDbByRxCui(_listMedicationPatReconcile[inter].RxCui);
					FormCDSIntervention FormCDSI=new FormCDSIntervention();
					FormCDSI.ListCDSI=EhrTriggers.TriggerMatch(medInter,_patCur);
					FormCDSI.ShowIfRequired(false);
				}
			}
			DialogResult=DialogResult.OK;
		}
コード例 #13
0
ファイル: FormMedications.cs プロジェクト: nampn/ODental
 private void butAddGeneric_Click(object sender, System.EventArgs e)
 {
     Medication MedicationCur=new Medication();
     Medications.Insert(MedicationCur);//so that we will have the primary key
     MedicationCur.GenericNum=MedicationCur.MedicationNum;
     FormMedicationEdit FormME=new FormMedicationEdit();
     FormME.MedicationCur=MedicationCur;
     FormME.IsNew=true;
     FormME.ShowDialog();
     FillGrid();
 }
コード例 #14
0
ファイル: Medications.cs プロジェクト: mnisl/OD
		public static bool AreMedicationsEqual(Medication medication,Medication medicationOld) {
			//No need to check RemotingRole; no call to db.
			if((medicationOld==null || medication==null)
				|| medicationOld.MedicationNum!=medication.MedicationNum
				|| medicationOld.MedName!=medication.MedName
				|| medicationOld.GenericNum!=medication.GenericNum
				|| medicationOld.Notes!=medication.Notes
				|| medicationOld.RxCui!=medication.RxCui) 
			{
				return false;
			}
			return true;
		}
コード例 #15
0
ファイル: EduResources.cs プロジェクト: steev90/opendental
        ///<summary></summary>
        public static List <EduResource> GenerateForPatient(long patNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <EduResource> >(MethodBase.GetCurrentMethod(), patNum));
            }
            List <Disease>       diseaseList        = Diseases.Refresh(patNum);
            List <MedicationPat> medicationPatList  = MedicationPats.Refresh(patNum, false);
            List <LabResult>     labResultList      = LabResults.GetAllForPatient(patNum);
            List <EhrLabResult>  listEhrLabResults  = EhrLabResults.GetAllForPatient(patNum);
            List <EduResource>   eduResourceListAll = Crud.EduResourceCrud.SelectMany("SELECT * FROM eduresource");
            List <EduResource>   retVal             = new List <EduResource>();

            for (int i = 0; i < eduResourceListAll.Count; i++)
            {
                if (eduResourceListAll[i].DiseaseDefNum != 0)
                {
                    for (int j = 0; j < diseaseList.Count; j++)
                    {
                        if (eduResourceListAll[i].DiseaseDefNum == diseaseList[j].DiseaseDefNum)
                        {
                            retVal.Add(eduResourceListAll[i]);
                        }
                    }
                }
                else if (eduResourceListAll[i].DiseaseDefNum != 0)               //checks against same list as Diseases/Problems
                {
                    for (int j = 0; j < diseaseList.Count; j++)
                    {
                        if (eduResourceListAll[i].DiseaseDefNum == diseaseList[j].DiseaseDefNum)
                        {
                            retVal.Add(eduResourceListAll[i]);
                        }
                    }
                }
                else if (eduResourceListAll[i].MedicationNum != 0)
                {
                    Medication med = Medications.GetMedication(eduResourceListAll[i].MedicationNum);
                    for (int j = 0; j < medicationPatList.Count; j++)
                    {
                        if (eduResourceListAll[i].MedicationNum == medicationPatList[j].MedicationNum || (medicationPatList[j].MedicationNum == 0 && medicationPatList[j].RxCui == med.RxCui))
                        {
                            retVal.Add(eduResourceListAll[i]);
                        }
                    }
                }
                else if (eduResourceListAll[i].LabResultID != "")
                {
                    for (int j = 0; j < labResultList.Count; j++)
                    {
                        if (eduResourceListAll[i].LabResultID != labResultList[j].TestID)
                        {
                            continue;
                        }
                        if (eduResourceListAll[i].LabResultCompare.StartsWith("<"))
                        {
                            //PIn.Int not used because blank not allowed.
                            try{
                                if (int.Parse(labResultList[j].ObsValue) < int.Parse(eduResourceListAll[i].LabResultCompare.Substring(1)))
                                {
                                    retVal.Add(eduResourceListAll[i]);
                                }
                            }
                            catch {
                                //This could only happen if the validation in either input didn't work.
                            }
                        }
                        else if (eduResourceListAll[i].LabResultCompare.StartsWith(">"))
                        {
                            try {
                                if (int.Parse(labResultList[j].ObsValue) > int.Parse(eduResourceListAll[i].LabResultCompare.Substring(1)))
                                {
                                    retVal.Add(eduResourceListAll[i]);
                                }
                            }
                            catch {
                                //This could only happen if the validation in either input didn't work.
                            }
                        }
                    }                                                 //end LabResultList
                    for (int j = 0; j < listEhrLabResults.Count; j++) //matches loinc only.
                    {
                        if (listEhrLabResults[j].ObservationIdentifierID != eduResourceListAll[i].LabResultID)
                        {
                            continue;
                        }
                        if (retVal.Contains(eduResourceListAll[i]))
                        {
                            continue;                            //already added from loop above.
                        }
                        retVal.Add(eduResourceListAll[i]);
                    }                    //end EhrLabResults
                }
            }
            return(retVal);
        }