Exemplo n.º 1
0
		///<summary></summary>
		public static void Update(AllergyDef allergyDef){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				Meth.GetVoid(MethodBase.GetCurrentMethod(),allergyDef);
				return;
			}
			Crud.AllergyDefCrud.Update(allergyDef);
		}
Exemplo n.º 2
0
		///<summary></summary>
		public static long Insert(AllergyDef allergyDef){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				allergyDef.AllergyDefNum=Meth.GetLong(MethodBase.GetCurrentMethod(),allergyDef);
				return allergyDef.AllergyDefNum;
			}
			return Crud.AllergyDefCrud.Insert(allergyDef);
		}
Exemplo n.º 3
0
 ///<summary></summary>
 public static void Update(AllergyDef allergyDef)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), allergyDef);
         return;
     }
     Crud.AllergyDefCrud.Update(allergyDef);
 }
Exemplo n.º 4
0
 ///<summary></summary>
 public static long Insert(AllergyDef allergyDef)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         allergyDef.AllergyDefNum = Meth.GetLong(MethodBase.GetCurrentMethod(), allergyDef);
         return(allergyDef.AllergyDefNum);
     }
     return(Crud.AllergyDefCrud.Insert(allergyDef));
 }
Exemplo n.º 5
0
Arquivo: EhrCCD.cs Projeto: mnisl/OD
		///<summary>Helper for GenerateCCD().</summary>
		private void GenerateCcdSectionAllergies(bool hasAllergy) {
			_w.WriteComment(@"
=====================================================================================================
Allergies
=====================================================================================================");
			AllergyDef allergyDef;
			List<Allergy> listAllergiesFiltered=new List<Allergy>();
			if(!hasAllergy) {
				listAllergiesFiltered=new List<Allergy>();
			}
			else {
				listAllergiesFiltered=_listAllergiesFiltered;
			}
			Start("component");
			Start("section");
			TemplateId("2.16.840.1.113883.10.20.22.2.6.1");//page 230 Allergy template with required entries.
			_w.WriteComment("Allergies section template");
			StartAndEnd("code","code","48765-2","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","Allergies");
			_w.WriteElementString("title","Allergies and Adverse Reactions");
			Start("text");//The following text will be parsed as html with a style sheet to be human readable.
			if(listAllergiesFiltered.Count>0 && hasAllergy) {
				Start("table","width","100%","border","1");
				Start("thead");
				Start("tr");
				_w.WriteElementString("th","Substance");
				_w.WriteElementString("th","Reaction");
				_w.WriteElementString("th","Allergy Type");
				_w.WriteElementString("th","Status");
				End("tr");
				End("thead");
				Start("tbody");
				for(int i=0;i<listAllergiesFiltered.Count;i++) {
					Allergy allergy=listAllergiesFiltered[i];
					if(allergy.PatNum==0) {
						allergyDef=new AllergyDef();
					}
					else {
						allergyDef=AllergyDefs.GetOne(allergy.AllergyDefNum);
					}
					Start("tr");
					//if(allergyDef.SnomedAllergyTo!="") {//Is Snomed allergy.
					//	Snomed snomedAllergyTo=Snomeds.GetByCode(allergyDef.SnomedAllergyTo);
					//	_w.WriteElementString("td",snomedAllergyTo.SnomedCode+" - "+snomedAllergyTo.Description);
					//}
					//else {//Medication allergy
					Medication med;
					if(allergyDef.MedicationNum==0) {
						if(allergyDef.UniiCode=="") {
							_w.WriteElementString("td","");
						}
						else {
							_w.WriteElementString("td",allergyDef.UniiCode+" - "+allergyDef.Description);
						}
					}
					else {
						med=Medications.GetMedication(allergyDef.MedicationNum);
						_w.WriteElementString("td",med.RxCui.ToString()+" - "+med.MedName);
					}
					//}
					_w.WriteElementString("td",allergy.Reaction);
					_w.WriteElementString("td",AllergyDefs.GetSnomedAllergyDesc(allergyDef.SnomedType));
					_w.WriteElementString("td",allergy.StatusIsActive?"Active":"Inactive");
					End("tr");
				}
				End("tbody");
				End("table");
			}
			else {
				_w.WriteString("None");
			}
			End("text");
			if(listAllergiesFiltered.Count==0) {//If there are no entries in the filtered list, then we want to add a dummy entry since at least one is required.
				Allergy al=new Allergy();
				listAllergiesFiltered.Add(al);
			}
			for(int i=0;i<listAllergiesFiltered.Count;i++) {
				Allergy allergy=listAllergiesFiltered[i];
				if(allergy.PatNum==0) {
					allergyDef=new AllergyDef();
				}
				else {
					allergyDef=AllergyDefs.GetOne(allergy.AllergyDefNum);
				}
				string allergyType="";
				string allergyTypeName="";
				#region Allergy Type
				if(allergyDef.SnomedType==SnomedAllergy.AdverseReactionsToDrug) {
					allergyType="419511003";
					allergyTypeName="Propensity to adverse reaction to drug";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.AdverseReactionsToFood) {
					allergyType="418471000";
					allergyTypeName="Propensity to adverse reaction to food";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.AdverseReactionsToSubstance) {
					allergyType="419199007";
					allergyTypeName="Propensity to adverse reaction to substance";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.AllergyToSubstance) {
					allergyType="418038007";
					allergyTypeName="Allergy to substance";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.DrugAllergy) {
					allergyType="416098002";
					allergyTypeName="Drug allergy";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.DrugIntolerance) {
					allergyType="59037007";
					allergyTypeName="Drug intolerance";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.FoodAllergy) {
					allergyType="414285001";
					allergyTypeName="Food allergy";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.FoodIntolerance) {
					allergyType="235719002";
					allergyTypeName="Food intolerance";
				}
				else if(allergyDef.SnomedType==SnomedAllergy.AdverseReactions) {
					allergyType="420134006";
					allergyTypeName="Adverse reaction";
				}
				else {
					allergyType="";
					allergyTypeName="None";
				}
				#endregion
				Start("entry","typeCode","DRIV");
				Start("act","classCode","ACT","moodCode","EVN");
				TemplateId("2.16.840.1.113883.10.20.22.4.30");//Allergy Problem Act template
				Guid();
				StartAndEnd("code","code","48765-2","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","Allergies and adverse reactions");
				//statusCode values allowed: active, suspended, aborted, completed.
				if(allergy.StatusIsActive) {
					StartAndEnd("statusCode","code","active");
				}
				else {
					StartAndEnd("statusCode","code","completed");
				}
				Start("effectiveTime");
				if(allergy.DateTStamp.Year<1880) {
					StartAndEnd("low","nullFlavor","UNK");
					StartAndEnd("high","nullFlavor","UNK");
				}
				else if(allergy.StatusIsActive) {
					StartAndEnd("low","value",allergy.DateTStamp.ToString("yyyyMMdd"));
					StartAndEnd("high","nullFlavor","UNK");
				}
				else {
					StartAndEnd("low","nullFlavor","UNK");
					StartAndEnd("high","value",allergy.DateTStamp.ToString("yyyyMMdd"));
				}
				End("effectiveTime");
				Start("entryRelationship","typeCode","SUBJ");
				Start("observation","classCode","OBS","moodCode","EVN");
				_w.WriteComment("Allergy Observation template");
				TemplateId("2.16.840.1.113883.10.20.22.4.7");
				Guid();
				StartAndEnd("code","code","ASSERTION","codeSystem","2.16.840.1.113883.5.4");//Fixed Value
				StartAndEnd("statusCode","code","completed");//fixed value (required)
				StartAndEnd("effectiveTime","nullFlavor","UNK");//We have no field to store the date the allergy became active. DateTStamp is not the same as the active date.
				Start("value");
				_w.WriteAttributeString("xsi","type",null,"CD");
				if(allergyDef.SnomedType==SnomedAllergy.None) {
					Attribs("nullFlavor","UNK");
				}
				else {
					Attribs("code",allergyType,"displayName",allergyTypeName,"codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed);
				}
				End("value");
				Start("participant","typeCode","CSM");
				Start("participantRole","classCode","MANU");
				Start("playingEntity","classCode","MMAT");
				//pg. 331 item 9:
				//In an allergy to a specific medication the code SHALL be selected from the ValueSet 2.16.840.1.113883.3.88.12.80.16 Medication Brand Name (code system: RxNorm 2.16.840.1.113883.6.88); Example: 205734		RxNorm	Amoxicillin 25 MG/ML Oral Suspension [Amoxil]
				//Or the ValueSet 2.16.840.1.113883.3.88.12.80.17 Medication Clinical Drug (code system: RxNorm 2.16.840.1.113883.6.88). Example: 313850	RxNorm	Amoxicillin 40 MG/ML Oral Suspensionv 
				//In an allergy to a class of medications the code SHALL be selected from the ValueSet 2.16.840.1.113883.3.88.12.80.18 Medication Drug Class (code system: NDF-RT 2.16.840.1.113883.3.26.1.5). Example: 2-Propanol, Inhibitors
				//In an allergy to a food or other substance the code SHALL be selected from the ValueSet 2.16.840.1.113883.3.88.12.80.20 Ingredient Name (code system: Unique Ingredient Identifier (UNII) 2.16.840.1.113883.4.9). Example: Peanut, Red 40
				if(allergyDef.MedicationNum==0) {//Unique Ingredient Identifier (UNII codes)
					if(allergyDef.UniiCode=="") {
						StartAndEnd("code","nullFlavor","UNK");
					}
					else {
						StartAndEnd("code","code",allergyDef.UniiCode,"displayName",allergyDef.Description,"codeSystem",strCodeSystemUnii,"codeSystemName",strCodeSystemNameUnii);
					}
				}
				//else if() {//Medication Drug Class (NDF-RT codes) //TODO: We need a UI box for this in allergy def.
				//Current work around is (per js on 10/02/2013):
				//If using eRx, search for a class such as NSAID.
				//If that's not an option, pick a common medication in that class such as Ibuprofen, and the eRx will automatically list cross-sensitivity and allergy warnings for any other related medication.
				//The allergy alerts built into OD do not have that rich database available.
				//If you are not using paper Rx from within OD, then you could enter the allergy however it makes sense, either NSAID or Ibuprofen.
				//If you are using paper Rx and you are trying to generate allergy warnings, then you also enter any specific medications that you might prescribe.
				//For example, you might enter an allergy for Vicoprofen.
				//}
				else {//Medication Brand Name or Medication Clinical Drug (RxNorm codes)
					Medication med=Medications.GetMedication(allergyDef.MedicationNum);
					StartAndEnd("code","code",med.RxCui.ToString(),"displayName",med.MedName,"codeSystem",strCodeSystemRxNorm,"codeSystemName",strCodeSystemNameRxNorm);
				}
				End("playingEntity");
				End("participantRole");
				End("participant");
				Start("entryRelationship","typeCode","SUBJ","inversionInd","true");
				Start("observation","classCode","OBS","moodCode","EVN");
				_w.WriteComment("Allergy Status Observation template");
				TemplateId("2.16.840.1.113883.10.20.22.4.28");
				StartAndEnd("code","code","33999-4","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","Status");
				StartAndEnd("statusCode","code","completed");//fixed value (required)
				string status=allergy.StatusIsActive?"Active":"Inactive";
				if(allergy.AllergyNum==0) {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CE");
					Attribs("nullFlavor","UNK");
					End("value");
				}
				else if(status=="Active") {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CE");
					Attribs("code","55561003","codeSystem",strCodeSystemSnomed,"displayName",status);
					End("value");
				}
				else {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CE");
					Attribs("code","73425007","codeSystem",strCodeSystemSnomed,"displayName",status);
					End("value");
				}
				End("observation");
				End("entryRelationship");
				Start("entryRelationship","typeCode","SUBJ","inversionInd","true");
				Start("observation","classCode","OBS","moodCode","EVN");
				_w.WriteComment("Reaction Observation template");
				TemplateId("2.16.840.1.113883.10.20.22.4.9");
				Guid();
				StartAndEnd("code","code","ASSERTION","codeSystem","2.16.840.1.113883.5.4");
				StartAndEnd("statusCode","code","completed");//fixed value (required)
				Start("effectiveTime");
				if(allergy.DateTStamp.Year<1880) {
					StartAndEnd("low","nullFlavor","UNK");
				}
				else if(allergy.StatusIsActive) {
					StartAndEnd("low","value",allergy.DateTStamp.ToString("yyyyMMdd"));
				}
				else {
					StartAndEnd("low","nullFlavor","UNK");
				}
				End("effectiveTime");
				if(String.IsNullOrEmpty(allergy.SnomedReaction)) {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CD");
					Attribs("nullFlavor","UNK");
					End("value");
				}
				else {
					Start("value");
					_w.WriteAttributeString("xsi","type",null,"CD");
					Attribs("code",allergy.SnomedReaction,"codeSystem",strCodeSystemSnomed,"displayName",allergy.Reaction);
					End("value");
				}
				End("observation");
				End("entryRelationship");
				End("observation");
				End("entryRelationship");
				End("act");
				End("entry");
			}
			End("section");
			End("component");
		}
Exemplo n.º 6
0
Arquivo: EhrCCD.cs Projeto: 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);
				}
			}
		}
Exemplo n.º 7
0
		private void FillReconcileGrid() {
			gridAllergyReconcile.BeginUpdate();
			gridAllergyReconcile.Columns.Clear();
			ODGridColumn col=new ODGridColumn("Last Modified",90,HorizontalAlignment.Center);
			gridAllergyReconcile.Columns.Add(col);
			col=new ODGridColumn("Description",400);
			gridAllergyReconcile.Columns.Add(col);
			col=new ODGridColumn("Reaction",300);
			gridAllergyReconcile.Columns.Add(col);
			col=new ODGridColumn("Inactive",80,HorizontalAlignment.Center);
			gridAllergyReconcile.Columns.Add(col);
			col=new ODGridColumn("Is Incoming",100,HorizontalAlignment.Center);
			gridAllergyReconcile.Columns.Add(col);
			gridAllergyReconcile.Rows.Clear();
			ODGridRow row;
			AllergyDef ald=new AllergyDef();
			for(int i=0;i<_listAllergyReconcile.Count;i++) {
				row=new ODGridRow();
				ald=new AllergyDef();
				if(_listAllergyReconcile[i].IsNew) {
					//To find the allergy def for new allergies, get the index of the matching allergy in ListAllergyNew, and use that index in ListAllergyDefNew because they are 1 to 1 lists.
					ald=ListAllergyDefNew[ListAllergyNew.IndexOf(_listAllergyReconcile[i])];
				}
				for(int j=0;j<_listAllergyDefCur.Count;j++) {
					if(_listAllergyReconcile[i].AllergyDefNum > 0 && _listAllergyReconcile[i].AllergyDefNum==_listAllergyDefCur[j].AllergyDefNum) {
						ald=_listAllergyDefCur[j];//Gets the allergydef matching the allergy so we can use it to populate the grid
						break;
					}
				}
				row.Cells.Add(DateTime.Now.ToShortDateString());
				if(ald.Description==null) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add(ald.Description);
				}
				if(_listAllergyReconcile[i].Reaction==null) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add(_listAllergyReconcile[i].Reaction);
				}
				if(_listAllergyReconcile[i].StatusIsActive) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add("X");
				}
				row.Cells.Add(_listAllergyReconcile[i].IsNew?"X":"");
				gridAllergyReconcile.Rows.Add(row);
			}
			gridAllergyReconcile.EndUpdate();
		}
Exemplo n.º 8
0
		private void FillExistingGrid() {
			gridAllergyExisting.BeginUpdate();
			gridAllergyExisting.Columns.Clear();
			ODGridColumn col=new ODGridColumn("Last Modified",90,HorizontalAlignment.Center);
			gridAllergyExisting.Columns.Add(col);
			col=new ODGridColumn("Description",200);
			gridAllergyExisting.Columns.Add(col);
			col=new ODGridColumn("Reaction",100);
			gridAllergyExisting.Columns.Add(col);
			col=new ODGridColumn("Inactive",80,HorizontalAlignment.Center);
			gridAllergyExisting.Columns.Add(col);
			gridAllergyExisting.Rows.Clear();
			_listAllergyCur=Allergies.GetAll(_patCur.PatNum,false);
			List<long> allergyDefNums=new List<long>();
			for(int h=0;h<_listAllergyCur.Count;h++) {
				if(_listAllergyCur[h].AllergyDefNum > 0) {
					allergyDefNums.Add(_listAllergyCur[h].AllergyDefNum);
				}
			}
			_listAllergyDefCur=AllergyDefs.GetMultAllergyDefs(allergyDefNums);
			ODGridRow row;
			AllergyDef ald;
			for(int i=0;i<_listAllergyCur.Count;i++) {
				row=new ODGridRow();
				ald=new AllergyDef();
				ald=AllergyDefs.GetOne(_listAllergyCur[i].AllergyDefNum,_listAllergyDefCur);
				row.Cells.Add(_listAllergyCur[i].DateTStamp.ToShortDateString());
				if(ald.Description==null) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add(ald.Description);
				}
				if(_listAllergyCur[i].Reaction==null) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add(_listAllergyCur[i].Reaction);
				}
				if(_listAllergyCur[i].StatusIsActive) {
					row.Cells.Add("");
				}
				else {
					row.Cells.Add("X");
				}
				gridAllergyExisting.Rows.Add(row);
			}
			gridAllergyExisting.EndUpdate();
		}