Exemplo n.º 1
0
        ///<summary>Returns EhrCodes for the specified EhrMeasureEventType ordered by how often and how recently they have been used.  Results are
        ///ordered by applying a weight based on the date diff from current date to DateTEvent of the EhrMeasureEvents.  EhrCodes used most
        ///recently will have the largest weight and help move the EhrCode to the top of the list.  Specify a limit amount if the result set should only
        ///be a certain number of EhrCodes at most.</summary>
        public static List <EhrCode> GetForEventTypeByUse(EhrMeasureEventType ehrMeasureEventTypes)
        {
            List <EhrCode> retVal = new List <EhrCode>();
            //list of CodeValueResults of the specified type ordered by a weight calculated by summing values based on how recently the codes were used
            List <string> listCodes = EhrMeasureEvents.GetListCodesUsedForType(ehrMeasureEventTypes);

            foreach (string codeStr in listCodes)
            {
                EhrCode codeCur = Listt.FirstOrDefault(x => x.CodeValue == codeStr);
                Snomed  sCur    = null;
                if (codeCur == null)
                {
                    sCur = Snomeds.GetByCode(codeStr);
                    if (sCur == null)
                    {
                        continue;
                    }
                    codeCur = new EhrCode {
                        CodeValue = sCur.SnomedCode, Description = sCur.Description
                    };
                }
                retVal.Add(codeCur);
            }
            return(retVal.OrderBy(x => x.Description).ToList());
        }
Exemplo n.º 2
0
		private void FormAllergyEdit_Load(object sender,EventArgs e) {
			int allergyIndex=0;
			allergyDefList=AllergyDefs.GetAll(false);
			if(allergyDefList.Count<1) {
				MsgBox.Show(this,"Need to set up at least one Allergy from EHR setup window.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			for(int i=0;i<allergyDefList.Count;i++) {
				comboAllergies.Items.Add(allergyDefList[i].Description);
				if(!AllergyCur.IsNew && allergyDefList[i].AllergyDefNum==AllergyCur.AllergyDefNum) {
					allergyIndex=i;
				}
			}
			snomedReaction=Snomeds.GetByCode(AllergyCur.SnomedReaction);
			if(snomedReaction!=null) {
				textSnomedReaction.Text=snomedReaction.Description;
			}
			if(!AllergyCur.IsNew) {
				if(AllergyCur.DateAdverseReaction<DateTime.Parse("01-01-1880")) {
					textDate.Text="";
				}
				else {
					textDate.Text=AllergyCur.DateAdverseReaction.ToShortDateString();
				}
				comboAllergies.SelectedIndex=allergyIndex;
				textReaction.Text=AllergyCur.Reaction;
				checkActive.Checked=AllergyCur.StatusIsActive;
			}
			else {
				comboAllergies.SelectedIndex=0;
			}
		}
Exemplo n.º 3
0
        ///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
        public static void ImportSnomed(string tempFileName, ProgressArgs progress, ref bool quit)
        {
            if (tempFileName == null)
            {
                return;
            }
            HashSet <string> codeHash = new HashSet <string>(Snomeds.GetAllCodes());

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arraySnomed;
            Snomed   snomed = new Snomed();

            for (int i = 0; i < lines.Length; i++)       //each loop should read exactly one line of code. and each line of code should be a unique code
            {
                if (quit)
                {
                    return;
                }
                if (i % 100 == 0)
                {
                    progress(i + 1, lines.Length);
                }
                arraySnomed = lines[i].Split('\t');
                if (codeHash.Contains(arraySnomed[0]))                 //code already exists
                {
                    continue;
                }
                snomed.SnomedCode  = arraySnomed[0];
                snomed.Description = arraySnomed[1];
                Snomeds.Insert(snomed);
            }
        }
Exemplo n.º 4
0
		private void listValueType_SelectedIndexChanged(object sender,EventArgs e) {
			textValue.Text="";
			_loincValue=null;
			_snomedValue=null;
			_icd9Value=null;
			_icd10Value=null;
			SetFlags();
		}
Exemplo n.º 5
0
		private void butSnomedGoalSelect_Click(object sender,EventArgs e) {
			FormSnomeds formS=new FormSnomeds();
			formS.IsSelectionMode=true;
			if(formS.ShowDialog()==DialogResult.OK) {
				_snomedGoal=formS.SelectedSnomed;
				textSnomedGoal.Text=_snomedGoal.Description;
			}
		}
Exemplo n.º 6
0
		private void FormEhrCarePlanEdit_Load(object sender,EventArgs e) {
			textDate.Text=_ehrCarePlan.DatePlanned.ToShortDateString();
			_snomedGoal=null;
			if(!String.IsNullOrEmpty(_ehrCarePlan.SnomedEducation)) {//Blank if new
				_snomedGoal=Snomeds.GetByCode(_ehrCarePlan.SnomedEducation);
				textSnomedGoal.Text=_snomedGoal.Description;
			}
			textInstructions.Text=_ehrCarePlan.Instructions;
		}
Exemplo n.º 7
0
		private void FormEhrAptObsEdit_Load(object sender,EventArgs e) {
			_appt=Appointments.GetOneApt(_ehrAptObsCur.AptNum);
			comboObservationQuestion.Items.Clear();
			string[] arrayQuestionNames=Enum.GetNames(typeof(EhrAptObsIdentifier));
			for(int i=0;i<arrayQuestionNames.Length;i++) {
				comboObservationQuestion.Items.Add(arrayQuestionNames[i]);
				EhrAptObsIdentifier ehrAptObsIdentifier=(EhrAptObsIdentifier)i;
				if(_ehrAptObsCur.IdentifyingCode==ehrAptObsIdentifier) {
					comboObservationQuestion.SelectedIndex=i;
				}
			}
			listValueType.Items.Clear();
			string[] arrayValueTypeNames=Enum.GetNames(typeof(EhrAptObsType));
			for(int i=0;i<arrayValueTypeNames.Length;i++) {
				listValueType.Items.Add(arrayValueTypeNames[i]);
				EhrAptObsType ehrAptObsType=(EhrAptObsType)i;
				if(_ehrAptObsCur.ValType==ehrAptObsType) {
					listValueType.SelectedIndex=i;
				}
			}
			if(_ehrAptObsCur.ValType==EhrAptObsType.Coded) {
				_strValCodeSystem=_ehrAptObsCur.ValCodeSystem;
				if(_ehrAptObsCur.ValCodeSystem=="LOINC") {
					_loincValue=Loincs.GetByCode(_ehrAptObsCur.ValReported);
					textValue.Text=_loincValue.NameShort;
				}
				else if(_ehrAptObsCur.ValCodeSystem=="SNOMEDCT") {
					_snomedValue=Snomeds.GetByCode(_ehrAptObsCur.ValReported);
					textValue.Text=_snomedValue.Description;
				}
				else if(_ehrAptObsCur.ValCodeSystem=="ICD9") {
					_icd9Value=ICD9s.GetByCode(_ehrAptObsCur.ValReported);
					textValue.Text=_icd9Value.Description;
				}
				else if(_ehrAptObsCur.ValCodeSystem=="ICD10") {
					_icd10Value=Icd10s.GetByCode(_ehrAptObsCur.ValReported);
					textValue.Text=_icd10Value.Description;
				}
			}
			else {
				textValue.Text=_ehrAptObsCur.ValReported;
			}
			comboUnits.Items.Clear();
			comboUnits.Items.Add("none");
			comboUnits.SelectedIndex=0;
			List<string> listUcumCodes=Ucums.GetAllCodes();
			for(int i=0;i<listUcumCodes.Count;i++) {
				string ucumCode=listUcumCodes[i];
				comboUnits.Items.Add(ucumCode);
				if(ucumCode==_ehrAptObsCur.UcumCode) {
					comboUnits.SelectedIndex=i+1;
				}
			}
			SetFlags();
		}
Exemplo n.º 8
0
        ///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
        public static void ImportSnomed(string tempFileName, ProgressArgs progress, ref bool quit, ref int numCodesImported, ref int numCodesUpdated,
                                        bool updateExisting)
        {
            if (tempFileName == null)
            {
                return;
            }
            Dictionary <string, Snomed> dictSnomeds = Snomeds.GetAll().ToDictionary(x => x.SnomedCode, x => x);

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arraySnomed;
            Snomed   snomed = new Snomed();

            for (int i = 0; i < lines.Length; i++)       //each loop should read exactly one line of code. and each line of code should be a unique code
            {
                if (quit)
                {
                    return;
                }
                if (i % 100 == 0)
                {
                    progress(i + 1, lines.Length);
                }
                arraySnomed = lines[i].Split('\t');
                if (dictSnomeds.ContainsKey(arraySnomed[0]))                 //code already exists
                {
                    snomed = dictSnomeds[arraySnomed[0]];
                    if (updateExisting && snomed.Description != arraySnomed[1])
                    {
                        snomed.Description = arraySnomed[1];
                        Snomeds.Update(snomed);
                        numCodesUpdated++;
                    }
                    continue;
                }
                snomed.SnomedCode  = arraySnomed[0];
                snomed.Description = arraySnomed[1];
                Snomeds.Insert(snomed);
                numCodesImported++;
            }
        }
Exemplo n.º 9
0
		///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
		public static void ImportSnomed(string tempFileName,ProgressArgs progress,ref bool quit) {
			if(tempFileName==null) {
				return;
			}
			HashSet<string> codeHash=new HashSet<string>(Snomeds.GetAllCodes());
			string[] lines=File.ReadAllLines(tempFileName);
			string[] arraySnomed;
			Snomed snomed=new Snomed();
			for(int i=0;i<lines.Length;i++) {//each loop should read exactly one line of code. and each line of code should be a unique code
				if(quit) {
					return;
				}
				if(i%100==0) {
					progress(i+1,lines.Length);
				}
				arraySnomed=lines[i].Split('\t');
				if(codeHash.Contains(arraySnomed[0])) {//code already exists
					continue;
				}
				snomed.SnomedCode		=arraySnomed[0];
				snomed.Description	=arraySnomed[1];
				Snomeds.Insert(snomed);
			}
		}
Exemplo n.º 10
0
Arquivo: Snomeds.cs Projeto: mnisl/OD
		///<summary></summary>
		public static long Insert(Snomed snomed){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				snomed.SnomedNum=Meth.GetLong(MethodBase.GetCurrentMethod(),snomed);
				return snomed.SnomedNum;
			}
			return Crud.SnomedCrud.Insert(snomed);
		}
Exemplo n.º 11
0
Arquivo: EhrCCD.cs Projeto: mnisl/OD
		///<summary>Helper for GenerateCCD().</summary>
		private void GenerateCcdSectionPlanOfCare(bool hasPlanOfCare) {
			_w.WriteComment(@"
=====================================================================================================
Care Plan
=====================================================================================================");
			List<EhrCarePlan> listEhrCarePlansAll=EhrCarePlans.Refresh(_patOutCcd.PatNum);
			List<EhrCarePlan> listEhrCarePlansFiltered;
			if(!hasPlanOfCare) {
				listEhrCarePlansFiltered=new List<EhrCarePlan>();
			}
			else {
				listEhrCarePlansFiltered=_listEhrCarePlansFiltered;
			}
			Start("component");
			Start("section");
			TemplateId("2.16.840.1.113883.10.20.22.2.10");//Only one template id allowed (unlike other sections).
			_w.WriteComment("Plan of Care section template");
			StartAndEnd("code","code","18776-5","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","Treatment plan");
			_w.WriteElementString("title","Care Plan");
			Start("text");//The following text will be parsed as html with a style sheet to be human readable.
			if(listEhrCarePlansFiltered.Count>0 && hasPlanOfCare) {
				Start("table","width","100%","border","1");
				Start("thead");
				Start("tr");
				_w.WriteElementString("th","Planned Activity");
				_w.WriteElementString("th","Planned Date");
				End("tr");
				End("thead");
				Start("tbody");
				for(int i=0;i<listEhrCarePlansFiltered.Count;i++) {
					Start("tr");
					Snomed snomedEducation;
					snomedEducation=Snomeds.GetByCode(listEhrCarePlansFiltered[i].SnomedEducation);
					if(snomedEducation==null) {
						snomedEducation=new Snomed();
					}
					if(String.IsNullOrEmpty(snomedEducation.Description)) {
						if(String.IsNullOrEmpty(listEhrCarePlansFiltered[i].Instructions)) {
							_w.WriteElementString("td","");//Planned Activity
						}
						else {
							_w.WriteElementString("td","Goal: ; Instructions: "+listEhrCarePlansFiltered[i].Instructions);//Planned Activity
						}
					}
					else {
						_w.WriteElementString("td","Goal: "+snomedEducation.SnomedCode+" - "+snomedEducation.Description+"; Instructions: "+listEhrCarePlansFiltered[i].Instructions);//Planned Activity
					}
					if(listEhrCarePlansFiltered[i].DatePlanned.Year<1880) {
						_w.WriteElementString("td","");
					}
					else {
						DateText("td",listEhrCarePlansFiltered[i].DatePlanned);//Planned Date
					}
					End("tr");
				}
				End("tbody");
				End("table");
			}
			else {
				_w.WriteString("None");
			}
			End("text");
			if(listEhrCarePlansFiltered.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.
				EhrCarePlan eCP=new EhrCarePlan();
				listEhrCarePlansFiltered.Add(eCP);
			}
			for(int i=0;i<listEhrCarePlansFiltered.Count;i++) {
				Start("entry","typeCode","DRIV");
				Start("act","classCode","ACT","moodCode","INT");
				TemplateId("2.16.840.1.113883.10.20.22.4.20");
				_w.WriteComment("Instructions template");
				Start("code");
				_w.WriteAttributeString("xsi","type",null,"CE");
				Snomed snomedEducation=Snomeds.GetByCode(listEhrCarePlansFiltered[i].SnomedEducation);
				if(snomedEducation==null) {
					Attribs("nullFlavor","UNK");
				}
				else {
					Attribs("code",snomedEducation.SnomedCode,"codeSystem",strCodeSystemSnomed,"displayName",snomedEducation.Description);
				}
				End("code");
				if(listEhrCarePlansFiltered[i].Instructions=="") {
					StartAndEnd("text","nullFlavor","UNK");
				}
				else {
					_w.WriteElementString("text",listEhrCarePlansFiltered[i].Instructions);
				}
				StartAndEnd("statusCode","code","completed");
				End("act");
				End("entry");
			}
			End("section");
			End("component");
		}
Exemplo n.º 12
0
Arquivo: EhrCCD.cs Projeto: mnisl/OD
		///<summary>Helper for GenerateCCD().</summary>
		private void GenerateCcdSectionFunctionalStatus(bool hasFunctionalStatus) {
			_w.WriteComment(@"
=====================================================================================================
Functional and Cognitive Status
=====================================================================================================");
			List<Disease> listProblemsFiltered;
			if(!hasFunctionalStatus) {
				listProblemsFiltered=new List<Disease>();
			}
			else {
				listProblemsFiltered=_listProblemsFuncFiltered;
			}
			Start("component");
			Start("section");
			TemplateId("2.16.840.1.113883.10.20.22.2.14");//Functional Status section. There is only one allowed template id.
			_w.WriteComment("Functional Status section template");//(Page 232)
			StartAndEnd("code","code","47420-5","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","Functional Status");
			_w.WriteElementString("title","Functional Status");
			Start("text");//The following text will be parsed as html with a style sheet to be human readable.
			if(listProblemsFiltered.Count>0 && hasFunctionalStatus) {
				Start("table","width","100%","border","1");
				Start("thead");
				Start("tr");
				_w.WriteElementString("th","Condition");
				_w.WriteElementString("th","Effective Dates");
				_w.WriteElementString("th","Condition Status");
				End("tr");
				End("thead");
				Start("tbody");
				for(int i=0;i<listProblemsFiltered.Count;i++) {
					DiseaseDef diseaseDef=null;
					Snomed snomedProblem=null;
					if(listProblemsFiltered[i].DiseaseDefNum>0) {
						diseaseDef=DiseaseDefs.GetItem(listProblemsFiltered[i].DiseaseDefNum);
						if(diseaseDef!=null && !String.IsNullOrEmpty(diseaseDef.SnomedCode)) {
							snomedProblem=Snomeds.GetByCode(diseaseDef.SnomedCode);
						}
					}
					Start("tr");
					if(diseaseDef==null || snomedProblem==null) {
						_w.WriteElementString("td","");
					}
					else {
						_w.WriteElementString("td",snomedProblem.SnomedCode+" - "+snomedProblem.Description);
					}
					if(listProblemsFiltered[i].FunctionStatus==FunctionalStatus.FunctionalResult || listProblemsFiltered[i].FunctionStatus==FunctionalStatus.CognitiveResult) {
						DateText("td",listProblemsFiltered[i].DateStart);
					}
					else {//functional problem and cognitive problem
						if(listProblemsFiltered[i].DateStop.Year>1880) {
							_w.WriteElementString("td",listProblemsFiltered[i].DateStart.ToString("yyyyMMdd")+" to "+listProblemsFiltered[i].DateStop.ToString("yyyyMMdd"));
						}
						else {
							DateText("td",listProblemsFiltered[i].DateStart);
						}
					}
					_w.WriteElementString("td","Completed");
					End("tr");
				}
				End("tbody");
				End("table");
			}
			else {
				_w.WriteString("None");
			}
			End("text");
			if(listProblemsFiltered.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.
				Disease dis=new Disease();
				dis.FunctionStatus=FunctionalStatus.FunctionalProblem;//Just needs a version other than problem.
				listProblemsFiltered.Add(dis);
			}
			for(int i=0;i<listProblemsFiltered.Count;i++) {
				DiseaseDef diseaseDef=null;
				Snomed snomedProblem=null;
				if(listProblemsFiltered[i].PatNum!=0) {
					diseaseDef=DiseaseDefs.GetItem(listProblemsFiltered[i].DiseaseDefNum);
					snomedProblem=Snomeds.GetByCode(diseaseDef.SnomedCode);
				}
				if(diseaseDef==null) {
					diseaseDef=new DiseaseDef();
				}
				if(snomedProblem==null) {
					snomedProblem=new Snomed();
				}
				Start("entry","typeCode","DRIV");
				Start("observation","classCode","OBS","moodCode","EVN");
				if(listProblemsFiltered[i].FunctionStatus==FunctionalStatus.FunctionalResult) {
					TemplateId("2.16.840.1.113883.10.20.22.4.67");//(Page 383)
					_w.WriteComment("Functional Status Result Observation");
					Guid();
					StartAndEnd("code","code","54744-8","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc);
					StartAndEnd("statusCode","code","completed");
					if(listProblemsFiltered[i].DateStart.Year<1880) {
						StartAndEnd("effectiveTime","nullFlavor","UNK");
					}
					else {
						DateElement("effectiveTime",listProblemsFiltered[i].DateStart);
					}
					if(String.IsNullOrEmpty(snomedProblem.SnomedCode)) {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("nullFlavor","UNK");
						End("value");
					}
					else {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("code",snomedProblem.SnomedCode,"displayName",snomedProblem.Description,"codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed);
						End("value");
					}
				}
				else if(listProblemsFiltered[i].FunctionStatus==FunctionalStatus.CognitiveResult) {
					TemplateId("2.16.840.1.113883.10.20.22.4.74");//(Page 342)
					_w.WriteComment("Cognitive Status Result Observation");
					Guid();
					StartAndEnd("code","code","5249-2","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc);
					StartAndEnd("statusCode","code","completed");
					if(listProblemsFiltered[i].DateStart.Year<1880) {
						StartAndEnd("effectiveTime","nullFlavor","UNK");
					}
					else {
						DateElement("effectiveTime",listProblemsFiltered[i].DateStart);
					}
					if(String.IsNullOrEmpty(snomedProblem.SnomedCode)) {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("nullFlavor","UNK");
						End("value");
					}
					else {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("code",snomedProblem.SnomedCode,"displayName",snomedProblem.Description,"codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed);
						End("value");
					}
				}
				else if(listProblemsFiltered[i].FunctionStatus==FunctionalStatus.FunctionalProblem) {
					TemplateId("2.16.840.1.113883.10.20.22.4.68");//(Page 379)
					_w.WriteComment("Functional Status Problem Observation");
					Guid();
					StartAndEnd("code","code","404684003","codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed,"displayName","Finding of Functional Performance and Activity");
					StartAndEnd("statusCode","code","completed");
					Start("effectiveTime");
					if(listProblemsFiltered[i].DateStart.Year<1880) {
						StartAndEnd("low","nullFlavor","UNK");
					}
					else {
						DateElement("low",listProblemsFiltered[i].DateStart);
					}
					//"If the problem is known to be resolved, but the date of resolution is not known, then the high element SHALL be present, and 
					//the nullFlavor attribute SHALL be set to 'UNK'. Therefore, the existence of an high element within a problem does indicate that the problem has been resolved."
					if(listProblemsFiltered[i].DateStop.Year<1880) {
						StartAndEnd("high","nullFlavor","UNK");
					}
					else {
						DateElement("high",listProblemsFiltered[i].DateStop);
					}
					End("effectiveTime");
					if(String.IsNullOrEmpty(snomedProblem.SnomedCode)) {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("nullFlavor","UNK");
						End("value");
					}
					else {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("code",snomedProblem.SnomedCode,"displayName",snomedProblem.Description,"codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed);
						End("value");
					}
				}
				else if(listProblemsFiltered[i].FunctionStatus==FunctionalStatus.CognitiveProblem) {
					TemplateId("2.16.840.1.113883.10.20.22.4.73");//(Page 336)
					_w.WriteComment("Cognitive Status Problem Observation");
					Guid();
					StartAndEnd("code","code","373930000","codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed,"displayName","Cognitive Function Finding");
					StartAndEnd("statusCode","code","completed");
					//"If the problem is known to be resolved, but the date of resolution is not known, then the high element SHALL be present, and 
					//the nullFlavor attribute SHALL be set to 'UNK'. Therefore, the existence of a high element within a problem does indicate that the problem has been resolved."
					Start("effectiveTime");
					if(listProblemsFiltered[i].DateStart.Year<1880) {
						StartAndEnd("low","nullFlavor","UNK");
					}
					else {
						DateElement("low",listProblemsFiltered[i].DateStart);
					}
					if(listProblemsFiltered[i].DateStop.Year<1880) {
						StartAndEnd("high","nullFlavor","UNK");
					}
					else {
						DateElement("high",listProblemsFiltered[i].DateStop);
					}
					End("effectiveTime");
					if(String.IsNullOrEmpty(snomedProblem.SnomedCode)) {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("nullFlavor","UNK");
						End("value");
					}
					else {
						Start("value");
						_w.WriteAttributeString("xsi","type",null,"CD");
						Attribs("code",snomedProblem.SnomedCode,"displayName",snomedProblem.Description,"codeSystem",strCodeSystemSnomed,"codeSystemName",strCodeSystemNameSnomed);
						End("value");
					}
				}
				End("observation");
				End("entry");
			}
			End("section");
			End("component");
		}
Exemplo n.º 13
0
		private void butNoneSnomedBodySite_Click(object sender,EventArgs e) {
			_snomedBodySite=null;
			textSnomedBodySite.Text="";
		}
Exemplo n.º 14
0
		public void AddCode(Snomed snomed) {
			subject4List.Add(new Subject3(new Value(snomed.SnomedCode,"2.16.840.1.113883.6.96","SNOMEDCT",snomed.Description)));
			subject4List[subject4List.Count-1].mainSearchCriteria.originalText=snomed.Description;
		}
Exemplo n.º 15
0
		private void butNoneSnomedReaction_Click(object sender,EventArgs e) {
			snomedReaction=null;
			textSnomedReaction.Text="";
		}
Exemplo n.º 16
0
		///<summary>ONLY run on startup. Fills the basic controls, except not the ones in the upper left panel which are handled in SetControlsUpperLeft.</summary>
		private void FillControlsOnStartup(){
			comboProcStatus.Items.Clear();
			comboProcStatus.Items.Add(Lan.g(this,"Treatment Planned"));
			comboProcStatus.Items.Add(Lan.g(this,"Complete"));
			if(!PrefC.GetBool(PrefName.EasyHideClinical)) {
				comboProcStatus.Items.Add(Lan.g(this,"Existing-Current Prov"));
				comboProcStatus.Items.Add(Lan.g(this,"Existing-Other Prov"));
				comboProcStatus.Items.Add(Lan.g(this,"Referred Out"));
				//comboProcStatus.Items.Add(Lan.g(this,"Deleted"));
				comboProcStatus.Items.Add(Lan.g(this,"Condition"));
			}
			if(ProcCur.ProcStatus==ProcStat.TP){
				comboProcStatus.SelectedIndex=0;
			}
			if(ProcCur.ProcStatus==ProcStat.C) {
				comboProcStatus.SelectedIndex=1;
			}
			if(!PrefC.GetBool(PrefName.EasyHideClinical)) {
				if(ProcCur.ProcStatus==ProcStat.EC) {
					comboProcStatus.SelectedIndex=2;
				}
				if(ProcCur.ProcStatus==ProcStat.EO) {
					comboProcStatus.SelectedIndex=3;
				}
				if(ProcCur.ProcStatus==ProcStat.R) {
					comboProcStatus.SelectedIndex=4;
				}
				if(ProcCur.ProcStatus==ProcStat.Cn) {
					comboProcStatus.SelectedIndex=5;
				}
			}
			if(ProcCur.ProcStatus==ProcStat.D && ProcCur.IsLocked){//an invalidated proc
				comboProcStatus.Items.Clear();
				comboProcStatus.Items.Add(Lan.g(this,"Invalidated"));
				comboProcStatus.SelectedIndex=0;
				comboProcStatus.Enabled=false;
				butInvalidate.Visible=false;
				butOK.Enabled=false;
				butDelete.Enabled=false;
				butChange.Enabled=false;
				butEditAnyway.Enabled=false;
				butSetComplete.Enabled=false;
				butAddEstimate.Enabled=false;
				butAddAdjust.Enabled=false;
			}
			//if clinical is hidden, then there's a chance that no item is selected at this point.
			comboDx.Items.Clear();
			for(int i=0;i<DefC.Short[(int)DefCat.Diagnosis].Length;i++){
				comboDx.Items.Add(DefC.Short[(int)DefCat.Diagnosis][i].ItemName);
				if(DefC.Short[(int)DefCat.Diagnosis][i].DefNum==ProcCur.Dx)
					comboDx.SelectedIndex=i;
			}
			comboPrognosis.Items.Clear();
			comboPrognosis.Items.Add(Lan.g(this,"no prognosis"));
			comboPrognosis.SelectedIndex=0;
			for(int i=0;i<DefC.Short[(int)DefCat.Prognosis].Length;i++) {
				comboPrognosis.Items.Add(DefC.Short[(int)DefCat.Prognosis][i].ItemName);
				if(DefC.Short[(int)DefCat.Prognosis][i].DefNum==ProcCur.Prognosis)
					comboPrognosis.SelectedIndex=i+1;
			}
			checkHideGraphics.Checked=ProcCur.HideGraphics;
			if(Programs.UsingOrion && this.IsNew && !OrionDentist){
				ProcCur.ProvNum=Providers.GetOrionProvNum(ProcCur.ProvNum);//Returns 0 if logged in as non provider.
			}//ProvNum of 0 will be required to change before closing form.
			comboProvNum.Items.Clear();
			for(int i=0;i<ProviderC.ListShort.Count;i++){
				comboProvNum.Items.Add(ProviderC.ListShort[i].Abbr);
				if(ProviderC.ListShort[i].ProvNum==ProcCur.ProvNum) {
					comboProvNum.SelectedIndex=i;
				}
			}
			comboPriority.Items.Clear();
			comboPriority.Items.Add(Lan.g(this,"no priority"));
			comboPriority.SelectedIndex=0;
			for(int i=0;i<DefC.Short[(int)DefCat.TxPriorities].Length;i++){
				comboPriority.Items.Add(DefC.Short[(int)DefCat.TxPriorities][i].ItemName);
				if(DefC.Short[(int)DefCat.TxPriorities][i].DefNum==ProcCur.Priority)
					comboPriority.SelectedIndex=i+1;
			}
			comboBillingTypeOne.Items.Clear();
			comboBillingTypeOne.Items.Add(Lan.g(this,"none"));
			comboBillingTypeOne.SelectedIndex=0;
			for(int i=0;i<DefC.Short[(int)DefCat.BillingTypes].Length;i++) {
				comboBillingTypeOne.Items.Add(DefC.Short[(int)DefCat.BillingTypes][i].ItemName);
				if(DefC.Short[(int)DefCat.BillingTypes][i].DefNum==ProcCur.BillingTypeOne)
					comboBillingTypeOne.SelectedIndex=i+1;
			}
			comboBillingTypeTwo.Items.Clear();
			comboBillingTypeTwo.Items.Add(Lan.g(this,"none"));
			comboBillingTypeTwo.SelectedIndex=0;
			for(int i=0;i<DefC.Short[(int)DefCat.BillingTypes].Length;i++) {
				comboBillingTypeTwo.Items.Add(DefC.Short[(int)DefCat.BillingTypes][i].ItemName);
				if(DefC.Short[(int)DefCat.BillingTypes][i].DefNum==ProcCur.BillingTypeTwo)
					comboBillingTypeTwo.SelectedIndex=i+1;
			}
			textBillingNote.Text=ProcCur.BillingNote;
			textNotes.Text=ProcCur.Note;
			textNotes.Select(textNotes.Text.Length,0);
			CheckForCompleteNote();
			comboPlaceService.Items.Clear();
			comboPlaceService.Items.AddRange(Enum.GetNames(typeof(PlaceOfService)));
			comboPlaceService.SelectedIndex=(int)ProcCur.PlaceService;
			//checkHideGraphical.Checked=ProcCur.HideGraphical;
			if(PrefC.GetBool(PrefName.EasyNoClinics)) {
				comboClinic.Visible=false;
				labelClinic.Visible=false;
			}
			else {
				comboClinic.Items.Add("none");
				comboClinic.SelectedIndex=0;
				for(int i=0;i<Clinics.List.Length;i++) {
					comboClinic.Items.Add(Clinics.List[i].Description);
					if(Clinics.List[i].ClinicNum==ProcCur.ClinicNum) {
						comboClinic.SelectedIndex=i+1;
					}
				}
			}
			textSite.Text=Sites.GetDescription(ProcCur.SiteNum);
			if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
				if(ProcCur.CanadianTypeCodes==null || ProcCur.CanadianTypeCodes=="") {
					checkTypeCodeX.Checked=true;
				}
				else {
					if(ProcCur.CanadianTypeCodes.Contains("A")) {
						checkTypeCodeA.Checked=true;
					}
					if(ProcCur.CanadianTypeCodes.Contains("B")) {
						checkTypeCodeB.Checked=true;
					}
					if(ProcCur.CanadianTypeCodes.Contains("C")) {
						checkTypeCodeC.Checked=true;
					}
					if(ProcCur.CanadianTypeCodes.Contains("E")) {
						checkTypeCodeE.Checked=true;
					}
					if(ProcCur.CanadianTypeCodes.Contains("L")) {
						checkTypeCodeL.Checked=true;
					}
					if(ProcCur.CanadianTypeCodes.Contains("S")) {
						checkTypeCodeS.Checked=true;
					}
					if(ProcCur.CanadianTypeCodes.Contains("X")) {
						checkTypeCodeX.Checked=true;
					}
				}
			}
			else{
				if(ProcedureCode2.IsProsth){
					listProsth.Items.Add(Lan.g(this,"No"));
					listProsth.Items.Add(Lan.g(this,"Initial"));
					listProsth.Items.Add(Lan.g(this,"Replacement"));
					switch(ProcCur.Prosthesis){
						case "":
							listProsth.SelectedIndex=0;
							break;
						case "I":
							listProsth.SelectedIndex=1;
							break;
						case "R":
							listProsth.SelectedIndex=2;
							break;
					}
					if(ProcCur.DateOriginalProsth.Year>1880){
						textDateOriginalProsth.Text=ProcCur.DateOriginalProsth.ToShortDateString();
					}
				}
				else{
					groupProsth.Visible=false;
				}
			}
			//medical
			textMedicalCode.Text=ProcCur.MedicalCode;
			textDiagnosticCode.Text=ProcCur.DiagnosticCode;
			checkIsPrincDiag.Checked=ProcCur.IsPrincDiag;
			textCodeMod1.Text = ProcCur.CodeMod1;
			textCodeMod2.Text = ProcCur.CodeMod2;
			textCodeMod3.Text = ProcCur.CodeMod3;
			textCodeMod4.Text = ProcCur.CodeMod4;
			textUnitQty.Text = ProcCur.UnitQty.ToString();
			comboUnitType.Items.Clear();
			_snomedBodySite=Snomeds.GetByCode(ProcCur.SnomedBodySite);
			if(_snomedBodySite==null) {
				textSnomedBodySite.Text="";
			}
			else {
				textSnomedBodySite.Text=_snomedBodySite.Description;
			}
			for(int i=0;i<Enum.GetNames(typeof(ProcUnitQtyType)).Length;i++) {
				comboUnitType.Items.Add(Enum.GetNames(typeof(ProcUnitQtyType))[i]);
			}
			comboUnitType.SelectedIndex=(int)ProcCur.UnitQtyType;
			textRevCode.Text = ProcCur.RevCode;
			//DrugNDC is handled in SetControlsUpperLeft
			comboDrugUnit.Items.Clear();
			for(int i=0;i<Enum.GetNames(typeof(EnumProcDrugUnit)).Length;i++){
				comboDrugUnit.Items.Add(Enum.GetNames(typeof(EnumProcDrugUnit))[i]);
			}
			comboDrugUnit.SelectedIndex=(int)ProcCur.DrugUnit;
			if(ProcCur.DrugQty!=0){
				textDrugQty.Text=ProcCur.DrugQty.ToString();
			}
			textClaimNote.Text=ProcCur.ClaimNote;
			textUser.Text=Userods.GetName(ProcCur.UserNum);//might be blank. Will change automatically if user changes note or alters sig.
			labelInvalidSig.Visible=false;
			sigBox.Visible=true;
			if(ProcCur.SigIsTopaz) {
				if(ProcCur.Signature!="") {
					//if(allowTopaz){
					sigBox.Visible=false;
					sigBoxTopaz.Visible=true;
					CodeBase.TopazWrapper.ClearTopaz(sigBoxTopaz);
					CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz,0);
					CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz,0);
					CodeBase.TopazWrapper.SetTopazKeyString(sigBoxTopaz,"0000000000000000");
					CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz,2);//high encryption
					CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz,2);//high compression
					CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz,ProcCur.Signature);
					//older notes may have been signed with zeros due to a bug.  We still want to show the sig in that case.
					//but if a sig is not showing, then set the key string to try to get it to show.
					if(CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz)==0) {
						CodeBase.TopazWrapper.SetTopazAutoKeyData(sigBoxTopaz,ProcCur.Note+ProcCur.UserNum.ToString());
						CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz,ProcCur.Signature);
					}
					//If sig is not showing, then try encryption mode 3 for signatures signed with old SigPlusNet.dll.
					if(CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz)==0) {
						CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz,3);//Unknown mode (told to use via TopazSystems)
						CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz,ProcCur.Signature);
					}
					//if still not showing, then it must be invalid
					if(CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz)==0) {
						labelInvalidSig.Visible=true;
					}
					CodeBase.TopazWrapper.SetTopazState(sigBoxTopaz,0);
					//}
				}
			}
			else {
				if(ProcCur.Signature!=null && ProcCur.Signature!="") {
					sigBox.Visible=true;
					if(sigBoxTopaz!=null) {
						sigBoxTopaz.Visible=false;
					}
					sigBox.ClearTablet();
					//sigBox.SetSigCompressionMode(0);
					//sigBox.SetEncryptionMode(0);
					sigBox.SetKeyString("0000000000000000");
					sigBox.SetAutoKeyData(ProcCur.Note+ProcCur.UserNum.ToString());
					//sigBox.SetEncryptionMode(2);//high encryption
					//sigBox.SetSigCompressionMode(2);//high compression
					sigBox.SetSigString(ProcCur.Signature);
					if(sigBox.NumberOfTabletPoints()==0) {
						labelInvalidSig.Visible=true;
					}
					sigBox.SetTabletState(0);//not accepting input.  To accept input, change the note, or clear the sig.
				}
			}
			if(Programs.UsingOrion) {//panelOrion.Visible) {
				comboDPC.Items.Clear();
				//comboDPC.Items.AddRange(Enum.GetNames(typeof(OrionDPC)));
				comboDPC.Items.Add("Not Specified");
				comboDPC.Items.Add("None");
				comboDPC.Items.Add("1A-within 1 day");
				comboDPC.Items.Add("1B-within 30 days");
				comboDPC.Items.Add("1C-within 60 days");
				comboDPC.Items.Add("2-within 120 days");
				comboDPC.Items.Add("3-within 1 year");
				comboDPC.Items.Add("4-no further treatment/appt");
				comboDPC.Items.Add("5-no appointment needed");
				comboDPCpost.Items.Clear();
				comboDPCpost.Items.Add("Not Specified");
				comboDPCpost.Items.Add("None");
				comboDPCpost.Items.Add("1A-within 1 day");
				comboDPCpost.Items.Add("1B-within 30 days");
				comboDPCpost.Items.Add("1C-within 60 days");
				comboDPCpost.Items.Add("2-within 120 days");
				comboDPCpost.Items.Add("3-within 1 year");
				comboDPCpost.Items.Add("4-no further treatment/appt");
				comboDPCpost.Items.Add("5-no appointment needed");
				comboStatus.Items.Clear();
				comboStatus.Items.Add("TP-treatment planned");
				comboStatus.Items.Add("C-completed");
				comboStatus.Items.Add("E-existing prior to incarceration");
				comboStatus.Items.Add("R-refused treatment");
				comboStatus.Items.Add("RO-referred out to specialist");
				comboStatus.Items.Add("CS-completed by specialist");
				comboStatus.Items.Add("CR-completed by registry");
				comboStatus.Items.Add("CA_Tx-cancelled, tx plan changed");
				comboStatus.Items.Add("CA_EPRD-cancelled, eligible parole");
				comboStatus.Items.Add("CA_P/D-cancelled, parole/discharge");
				comboStatus.Items.Add("S-suspended, unacceptable plaque");
				comboStatus.Items.Add("ST-stop clock, multi visit");
				comboStatus.Items.Add("W-watch");
				comboStatus.Items.Add("A-alternative");
				comboStatus.SelectedIndex=0;
				ProcedureCode pc=ProcedureCodes.GetProcCodeFromDb(ProcCur.CodeNum);
				checkIsRepair.Visible=pc.IsProsth;
				//DateTP doesn't get set sometimes and calculations are made based on the DateTP. So set it to the current date as fail-safe.
				if(ProcCur.DateTP.Year<1880) {
					textDateTP.Text=MiscData.GetNowDateTime().ToShortDateString();
				}
				else {
					textDateTP.Text=ProcCur.DateTP.ToShortDateString();
				}
				BitArray ba=new BitArray(new int[] { (int)OrionProcCur.Status2 });//should nearly always be non-zero
				for(int i=0;i<ba.Length;i++) {
					if(ba[i]) {
						comboStatus.SelectedIndex=i;
						break;
					}
				}
				if(!IsNew) {
					OrionProcOld=OrionProcCur.Copy();
					comboDPC.SelectedIndex=(int)OrionProcCur.DPC;
					comboDPCpost.SelectedIndex=(int)OrionProcCur.DPCpost;
					if(OrionProcCur.DPC==OrionDPC.NotSpecified ||
						OrionProcCur.DPC==OrionDPC.None ||
						OrionProcCur.DPC==OrionDPC._4 ||
						OrionProcCur.DPC==OrionDPC._5) {
						labelScheduleBy.Visible=true;
					}
					if(OrionProcCur.DateScheduleBy.Year>1880) {
						textDateScheduled.Text=OrionProcCur.DateScheduleBy.ToShortDateString();
					}
					if(OrionProcCur.DateStopClock.Year>1880) {
						textDateStop.Text=OrionProcCur.DateStopClock.ToShortDateString();
					}
					checkIsOnCall.Checked=OrionProcCur.IsOnCall;
					checkIsEffComm.Checked=OrionProcCur.IsEffectiveComm;
					checkIsRepair.Checked=OrionProcCur.IsRepair;
				}
				else {
					labelScheduleBy.Visible=true;
					comboDPC.SelectedIndex=0;
					comboDPCpost.SelectedIndex=0;
					textDateStop.Text="";
				}
			}
		}
Exemplo n.º 17
0
		private void butPickValueSnomedct_Click(object sender,EventArgs e) {
			FormSnomeds formS=new FormSnomeds();
			formS.IsSelectionMode=true;
			if(formS.ShowDialog()==DialogResult.OK) {
				_snomedValue=formS.SelectedSnomed;
				textValue.Text=_snomedValue.Description;
				_strValCodeSystem="SNOMEDCT";
				labelValue.Text=_strValCodeSystem+" Value";
			}
		}
Exemplo n.º 18
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(IsSelectionMode || IsMultiSelectMode) {
				SelectedSnomed=(Snomed)gridMain.Rows[e.Row].Tag;
				ListSelectedSnomeds=new List<Snomed>();
				ListSelectedSnomeds.Add((Snomed)gridMain.Rows[e.Row].Tag);
				DialogResult=DialogResult.OK;
				return;
			}
		}
Exemplo n.º 19
0
Arquivo: Snomeds.cs Projeto: mnisl/OD
		///<summary></summary>
		public static void Update(Snomed snomed) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				Meth.GetVoid(MethodBase.GetCurrentMethod(),snomed);
				return;
			}
			Crud.SnomedCrud.Update(snomed);
		}
Exemplo n.º 20
0
		///<summary>Helper for GenerateCCD().</summary>
		private void GenerateCcdSectionProcedures(bool hasProcedure) {
			_w.WriteComment(@"
=====================================================================================================
Procedures
=====================================================================================================");
			List<Procedure> listProcsFiltered;
			if(!hasProcedure) {
				listProcsFiltered=new List<Procedure>();
			}
			else {
				listProcsFiltered=_listProcsFiltered;
			}
			Start("component");
			Start("section");
			TemplateId("2.16.840.1.113883.10.20.22.2.7.1");//Procedures section with coded entries required (Page 285).
			_w.WriteComment("Procedures section template");
			StartAndEnd("code","code","47519-4","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","History of procedures");
			_w.WriteElementString("title","Procedures");
			Start("text");//The following text will be parsed as html with a style sheet to be human readable.
			if(listProcsFiltered.Count>0 && hasProcedure) {
				Start("table","width","100%","border","1");
				Start("thead");
				Start("tr");
				_w.WriteElementString("th","Procedure");
				_w.WriteElementString("th","Body Site");
				_w.WriteElementString("th","Date");
				End("tr");
				End("thead");
				Start("tbody");
				for(int i=0;i<listProcsFiltered.Count;i++) {
					ProcedureCode procCode;
					Snomed bodySite=Snomeds.GetByCode(listProcsFiltered[i].SnomedBodySite);
					Snomed procCodeSnomed;
					if(listProcsFiltered[i].CodeNum==0) {
						procCode=new ProcedureCode();
						procCodeSnomed=new Snomed();
					}
					else {
						procCode=ProcedureCodes.GetProcCode(listProcsFiltered[i].CodeNum);
						procCodeSnomed=Snomeds.GetByCode(procCode.ProcCode);
					}
					if(procCodeSnomed==null) {
						procCodeSnomed=new Snomed();
					}
					Start("tr");
					if(!String.IsNullOrEmpty(procCodeSnomed.SnomedCode)) {
						_w.WriteElementString("td",procCodeSnomed.SnomedCode+" - "+procCode.Descript);
					}
					else if(!String.IsNullOrEmpty(procCode.MedicalCode)) {
						_w.WriteElementString("td",procCode.MedicalCode+" - "+procCode.Descript);
					}
					else {
						_w.WriteElementString("td","");
					}
					if(bodySite==null || String.IsNullOrEmpty(bodySite.SnomedCode)) {
						_w.WriteElementString("td","");
					}
					else {
						_w.WriteElementString("td",bodySite.SnomedCode+" - "+bodySite.Description);
					}
					if(listProcsFiltered[i].ProcDate.Year<1880) {
						_w.WriteElementString("td","");
					}
					else {
						DateText("td",listProcsFiltered[i].ProcDate);
					}
					End("tr");
				}
				End("tbody");
				End("table");
			}
			else {
				_w.WriteString("None");
			}
			End("text");
			if(listProcsFiltered.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.
				Procedure proc=new Procedure();
				listProcsFiltered.Add(proc);
			}
			for(int i=0;i<listProcsFiltered.Count;i++) {
				ProcedureCode procCode;
				Snomed procCodeSnomed;
				if(listProcsFiltered[i].CodeNum==0) {
					procCode=new ProcedureCode();
					procCodeSnomed=new Snomed();
				}
				else {
					procCode=ProcedureCodes.GetProcCode(listProcsFiltered[i].CodeNum);
					procCodeSnomed=Snomeds.GetByCode(procCode.ProcCode);
				}
				if(procCodeSnomed==null) {
					procCodeSnomed=new Snomed();
				}
				Start("entry","typeCode","DRIV");
				Start("procedure","classCode","PROC","moodCode","EVN");
				TemplateId("2.16.840.1.113883.10.20.22.4.14");//Procedure Activity Section (Page 487).
				_w.WriteComment("Procedure Activity Template");
				Guid();
				//"This code in a procedure activity SHOULD be selected from LOINC (codeSystem 2.16.840.1.113883.6.1) or SNOMED CT (CodeSystem: 2.16.840.1.113883.6.96),
				//and MAY be selected from CPT-4 (CodeSystem: 2.16.840.1.113883.6.12), ICD9 Procedures (CodeSystem: 2.16.840.1.113883.6.104),
				//ICD10 Procedure Coding System (CodeSystem: 2.16.840.1.113883.6.4) (CONF:7657)."
				//We already have a place for CPT codes, and that is ProcedureCode.MedicalCode. We will simply use this field for now.
				if(!String.IsNullOrEmpty(procCodeSnomed.SnomedCode)) {
					StartAndEnd("code","code",procCodeSnomed.SnomedCode,"codeSystem",strCodeSystemSnomed,"displayName",procCode.Descript,"codeSystemName",strCodeSystemNameSnomed);
				}
				else if(!String.IsNullOrEmpty(procCode.MedicalCode)) {
					StartAndEnd("code","code",procCode.MedicalCode,"codeSystem",strCodeSystemCpt4,"displayName",procCode.Descript,"codeSystemName",strCodeSystemNameCpt4);
				}
				else {
					StartAndEnd("code","nullFlavor","UNK");
				}
				StartAndEnd("statusCode","code","completed");//Allowed values: completed, active, aborted, cancelled.
				if(listProcsFiltered[i].ProcDate.Year<1880) {
					StartAndEnd("effectiveTime","nullFlavor","UNK");
				}
				else {
					DateElement("effectiveTime",listProcsFiltered[i].ProcDate);
				}
				End("procedure");
				End("entry");
			}
			End("section");
			End("component");
		}
Exemplo n.º 21
0
//		private void butRSIT_Click(object sender,EventArgs e) {//Ryan's Snomed Import Tool
//			if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"This tool is being used by Ryan to process the raw SNOMED data. Push Cancel if you do not know what this tool is doing.")) {
//				return;
//			}
//			Cursor=Cursors.WaitCursor;
//						string command="DROP TABLE IF EXISTS snomedonly.snomedusraw";
//						DataCore.NonQ(command);	
//						command=@"CREATE TABLE snomedonly.snomedusraw ("
//									//snomedrawNum bigint NOT NULL auto_increment PRIMARY KEY,
//								+@"id VarChar(20) NOT NULL,
//									effectiveTime VarChar(8) NOT NULL,
//									active VarChar(1) NOT NULL,
//									moduleId VarChar(20) NOT NULL,
//									conceptId VarChar(20) NOT NULL,
//									languageCode VarChar(2) NOT NULL,
//									typeId VarChar(20) NOT NULL,
//									term text NOT NULL,
//									caseSignificanceId VarChar(20) NOT NULL,"
//								//INDEX(snomedrawNum),
//								+@"INDEX(id),
//									INDEX(active),
//									INDEX(moduleId),
//									INDEX(conceptId),
//									INDEX(languageCode),
//									INDEX(typeId),
//									INDEX(caseSignificanceId)
//									) DEFAULT CHARSET=utf8";
//						DataCore.NonQ(command);
//						//Load raw data into DB
//						string[] lines=File.ReadAllLines(@"C:\Docs\SNOMEDUS.TXT");
//						for(int i=1;i<lines.Length;i++) {//each loop should read exactly one line of code. and each line of code should be a unique code
//						//foreach(string line in lines){
//							string[] arraysnomed=lines[i].Split(new string[] { "\t" },StringSplitOptions.None);
//							command=@"INSERT INTO snomedonly.snomedusraw VALUES (";
//								for(int j=0;j<arraysnomed.Length;j++){
//									command+="'"+POut.String(arraysnomed[j])+"'"+",";
//								}
//							command=command.Trim(',')+")";
//							DataCore.NonQ(command);
//						}
//			//Manipulate here.
//			//900000000000013009 is synonym
//			//900000000000003001 is Fully specified name
//			command="DROP TABLE IF EXISTS snomedonly.snomed";
//			DataCore.NonQ(command);
//			command=@"CREATE TABLE snomedonly.snomed (
//						SnomedNum bigint NOT NULL auto_increment PRIMARY KEY,
//						SnomedCode VarChar(255) NOT NULL,
//						Description VarChar(255) NOT NULL,
//						INDEX(SnomedCode)
//						) DEFAULT CHARSET=utf8";
//			DataCore.NonQ(command);
//			//Load raw data into DB
//			//command="INSERT INTO snomedonly.snomed (SnomedCode,Description) SELECT t.* FROM (SELECT conceptID, term FROM snomedonly.snomedusraw WHERE GROUP BY conceptid) t";
//			command="SELECT t.* FROM (SELECT conceptID, term FROM snomedonly.snomedusraw WHERE typeid='900000000000003001' ORDER BY Cast(conceptid as unsigned) asc) t";
//			//DataCore.NonQ(command);
//			DataTable Table=DataCore.GetTable(command);
//			HashSet<string> hss=new HashSet<string>();
//			//string[] 
//			lines=File.ReadAllLines(@"C:\Docs\SNOMEDUS.TXT");
//			for(int i=1;i<lines.Length;i++) {//each loop should read exactly one line of code. and each line of code should be a unique code
//				//foreach(string line in lines){
//				string[] arraysnomed=lines[i].Split(new string[] { "\t" },StringSplitOptions.None);
//				//if(arraysnomed[6]!="900000000000003001") {
//				//	continue;//not equal to a fully specified name.
//				//}
//				if(hss.Contains(arraysnomed[4])) {
//					continue;//snomedcode already added.
//				}
//				hss.Add(arraysnomed[4]);
//				command=@"INSERT INTO snomedonly.snomed VALUES ("+i+",'"+POut.String(arraysnomed[4])+"','"+POut.String(arraysnomed[7])+"')";
//				DataCore.NonQ(command);
//			}
//			Cursor=Cursors.Default;
//			MsgBox.Show(this,"Done.");
//		}

		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;
			}
			SelectedSnomed=(Snomed)gridMain.Rows[gridMain.GetSelectedIndex()].Tag;
			ListSelectedSnomeds=new List<Snomed>();
			for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
				ListSelectedSnomeds.Add((Snomed)gridMain.Rows[gridMain.SelectedIndices[i]].Tag);
			}
			DialogResult=DialogResult.OK;
		}
Exemplo n.º 22
0
		//private void butImport_Click(object sender,EventArgs e) {
		//	if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"Snomed Codes will be cleared and and completely replaced with the codes in the file you are importing.  This will not damage patient records, but will reset any Snomed descriptions that had been changed.  Continue anyway?")) {
		//		return;
		//	}
		//	Cursor=Cursors.WaitCursor;
		//	OpenFileDialog Dlg=new OpenFileDialog();
		//	if(Directory.Exists(PrefC.GetString(PrefName.ExportPath))) {
		//		Dlg.InitialDirectory=PrefC.GetString(PrefName.ExportPath);
		//	}
		//	else if(Directory.Exists("C:\\")) {
		//		Dlg.InitialDirectory="C:\\";
		//	}
		//	if(Dlg.ShowDialog()!=DialogResult.OK) {
		//		Cursor=Cursors.Default;
		//		return;
		//	}
		//	if(!File.Exists(Dlg.FileName)) {
		//		Cursor=Cursors.Default;
		//		MsgBox.Show(this,"File not found");
		//		return;
		//	}
		//	string[] fields;
		//	Snomed snomed;
		//	using(StreamReader sr=new StreamReader(Dlg.FileName)) {
		//		//string line=sr.ReadLine();
		//		//Fields are: 0-id, 1-effectiveTime, 2-active, 3-moduleId, 4-conceptId, 5-languageCode, 6-typeId, 7-term, 8-caseSignificanceId
		//		fields=sr.ReadLine().Split(new string[] { "\t" },StringSplitOptions.None);
		//		if(fields.Length<8) {//We will attempt to access fields 4 - conceptId (SnomedCode) and 7 - term (Description). 0 indexed so field 7 is the 8th field.
		//			MsgBox.Show(this,"You have selected the wrong file. There should be 9 columns in this file.");
		//			return;
		//		}
		//		if(fields[4]!="conceptId" || fields[7]!="term") {//Headers in first line have the wrong names.
		//			MsgBox.Show(this,"You have selected the wrong file: \"conceptId\" and \"term\" are not columns 5 and 8.");
		//			return;//Headers are not right. Wrong file.
		//		}
		//		Cursor=Cursors.WaitCursor;
		//		Cursor=Cursors.WaitCursor;
		//		Snomeds.DeleteAll();//Last thing we do before looping through and adding new snomeds is to delete all the old snomeds.
		//		while(!sr.EndOfStream) {					//line=sr.ReadLine();
		//			//Fields are: 0-id, 1-effectiveTime, 2-active, 3-moduleId, 4-conceptId, 5-languageCode, 6-typeId, 7-term, 8-caseSignificanceId
		//			fields=sr.ReadLine().Split(new string[1] { "\t" },StringSplitOptions.None);
		//			if(fields.Length<8) {//We will attempt to access fieds 4 - conceptId (SnomedCode) and 7 - term (Description).
		//				sr.ReadLine();
		//				continue;
		//			}
		//			if(fields[6]!="900000000000003001") {//full qualified name(FQN), alternative is "900000000000013009", "Synonym"
		//				continue;//skip anything that is not an FQN
		//			}
		//			snomed=new Snomed();
		//			snomed.SnomedCode=fields[4];
		//			snomed.Description=fields[7];
		//			//snomed.DateOfStandard=DateTime.MinValue();//=PIn.Date(""+fields[1].Substring(4,2)+"/"+fields[1].Substring(6,2)+"/"+fields[1].Substring(0,4));//format from yyyyMMdd to MM/dd/yyyy
		//			//snomed.IsActive=(fields[2]=="1");//true if column equals 1, false if column equals 0 or anything else.
		//			Snomeds.Insert(snomed);
		//		}
		//	}
		//	Cursor=Cursors.Default;
		//	MsgBox.Show(this,"Import successful.");
		//}

		//private void listMain_DoubleClick(object sender,System.EventArgs e) {
		//  if(listMain.SelectedIndex==-1) {
		//    return;
		//  }
		//  if(IsSelectionMode) {
		//    SelectedSnomed=SnomedList[listMain.SelectedIndex];
		//    DialogResult=DialogResult.OK;
		//    return;
		//  }
		//  changed=true;
		//  FormSnomedEdit FormI=new FormSnomedEdit(SnomedList[listMain.SelectedIndex]);
		//  FormI.ShowDialog();
		//  if(FormI.DialogResult!=DialogResult.OK) {
		//    return;
		//  }
		//  FillGrid();
		//}

		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(IsSelectionMode || IsMultiSelectMode) {
				SelectedSnomed=(Snomed)gridMain.Rows[e.Row].Tag;
				ListSelectedSnomeds=new List<Snomed>();
				ListSelectedSnomeds.Add((Snomed)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.º 23
0
		//public bool IsNew;

		public FormSnomedEdit(Snomed snomedCur) {
			InitializeComponent();
			Lan.F(this);
			SnomedCur=snomedCur;
		}