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

            if (!useExistingPK && isRandomKeys)
            {
                snomed.SnomedNum = ReplicationServers.GetKeyNoCache("snomed", "SnomedNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SnomedNum,";
            }
            command += "SnomedCode,Description) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(snomed.SnomedNum) + ",";
            }
            command +=
                "'" + POut.String(snomed.SnomedCode) + "',"
                + "'" + POut.String(snomed.Description) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                snomed.SnomedNum = Db.NonQ(command, true, "SnomedNum", "snomed");
            }
            return(snomed.SnomedNum);
        }
コード例 #2
0
        ///<summary>Inserts one Snomed into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(Snomed snomed, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                snomed.SnomedNum = ReplicationServers.GetKey("snomed", "SnomedNum");
            }
            string command = "INSERT INTO snomed (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "SnomedNum,";
            }
            command += "SnomedCode,Description) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(snomed.SnomedNum) + ",";
            }
            command +=
                "'" + POut.String(snomed.SnomedCode) + "',"
                + "'" + POut.String(snomed.Description) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                snomed.SnomedNum = Db.NonQ(command, true, "SnomedNum", "snomed");
            }
            return(snomed.SnomedNum);
        }
コード例 #3
0
        private void FillGridAssessments()
        {
            gridAssessments.BeginUpdate();
            gridAssessments.Columns.Clear();
            gridAssessments.Columns.Add(new ODGridColumn("Date", 70));
            gridAssessments.Columns.Add(new ODGridColumn("Type", 170));
            gridAssessments.Columns.Add(new ODGridColumn("Description", 170));
            gridAssessments.Columns.Add(new ODGridColumn("Documentation", 170));
            gridAssessments.Rows.Clear();
            ODGridRow row;
            List <EhrMeasureEvent> listEvents = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.TobaccoUseAssessed);

            foreach (EhrMeasureEvent eventCur in listEvents)
            {
                row = new ODGridRow();
                row.Cells.Add(eventCur.DateTEvent.ToShortDateString());
                Loinc lCur = Loincs.GetByCode(eventCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                row.Cells.Add(lCur != null?lCur.NameLongCommon:eventCur.EventType.ToString());
                Snomed sCur = Snomeds.GetByCode(eventCur.CodeValueResult);
                row.Cells.Add(sCur != null?sCur.Description:"");
                row.Cells.Add(eventCur.MoreInfo);
                row.Tag = eventCur;
                gridAssessments.Rows.Add(row);
            }
            gridAssessments.EndUpdate();
        }
コード例 #4
0
 ///<summary>Inserts one Snomed into the database.  Returns the new priKey.</summary>
 public static long Insert(Snomed snomed)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         snomed.SnomedNum = DbHelper.GetNextOracleKey("snomed", "SnomedNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(snomed, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     snomed.SnomedNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(snomed, false));
     }
 }
コード例 #5
0
ファイル: FormEhrSettings.cs プロジェクト: kjb7749/testImport
 private void comboPregCodes_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.SecurityAdmin, false))
     {
         comboPregCodes.SelectedIndex = OldPregListSelectedIdx;
         return;
     }
     NewPregCodeSystem      = "SNOMEDCT";
     textPregCodeValue.Text = "";
     if (comboPregCodes.SelectedIndex == 0)           //none
     {
         textPregCodeDescript.Clear();
         labelPregWarning.Visible = true;
     }
     else
     {
         Snomed sPreg = Snomeds.GetByCode(comboPregCodes.SelectedItem.ToString());
         if (sPreg == null)
         {
             MsgBox.Show(this, "The snomed table does not contain this code.  The code should be added to the snomed table by running the Code System Importer tool.");
         }
         else
         {
             textPregCodeDescript.Text = sPreg.Description;
         }
         labelPregWarning.Visible = false;
     }
 }
コード例 #6
0
        private void FillCarePlans()
        {
            gridCarePlans.BeginUpdate();
            gridCarePlans.Columns.Clear();
            int colDatePixCount         = 66;
            int variablePixCount        = gridCarePlans.Width - 10 - colDatePixCount;
            int colGoalPixCount         = variablePixCount / 2;
            int colInstructionsPixCount = variablePixCount - colGoalPixCount;

            gridCarePlans.Columns.Add(new UI.ODGridColumn("Date", colDatePixCount));
            gridCarePlans.Columns.Add(new UI.ODGridColumn("Goal", colGoalPixCount));
            gridCarePlans.Columns.Add(new UI.ODGridColumn("Instructions", colInstructionsPixCount));
            gridCarePlans.EndUpdate();
            gridCarePlans.BeginUpdate();
            gridCarePlans.Rows.Clear();
            _listCarePlans = EhrCarePlans.Refresh(_patCur.PatNum);
            for (int i = 0; i < _listCarePlans.Count; i++)
            {
                UI.ODGridRow row = new UI.ODGridRow();
                row.Cells.Add(_listCarePlans[i].DatePlanned.ToShortDateString());                //Date
                Snomed snomedEducation = Snomeds.GetByCode(_listCarePlans[i].SnomedEducation);
                if (snomedEducation == null)
                {
                    row.Cells.Add("");                    //We allow blank or "NullFlavor" SNOMEDCT codes when exporting CCDAs, so we allow them to be blank when displaying here as well.
                }
                else
                {
                    row.Cells.Add(snomedEducation.Description);               //GoalDescript
                }
                row.Cells.Add(_listCarePlans[i].Instructions);                //Instructions
                gridCarePlans.Rows.Add(row);
            }
            gridCarePlans.EndUpdate();
        }
コード例 #7
0
ファイル: FormEhrSettings.cs プロジェクト: kjb7749/testImport
 private void comboEncCodes_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.SecurityAdmin, false))
     {
         comboEncCodes.SelectedIndex = OldEncListSelectedIdx;
         return;
     }
     NewEncCodeSystem      = "SNOMEDCT";
     textEncCodeValue.Text = "";
     if (comboEncCodes.SelectedIndex == 0)           //none
     {
         textEncCodeDescript.Clear();
         labelEncWarning.Visible = true;
     }
     else
     {
         Snomed sEnc = Snomeds.GetByCode(comboEncCodes.SelectedItem.ToString());
         if (sEnc == null)               //this check may not be necessary now that we are not adding the code to the list to be selected if they do not have it in the snomed table.  Harmelss and safe.
         {
             MsgBox.Show(this, "The snomed table does not contain this code.  The code should be added to the snomed table by running the Code System Importer tool.");
         }
         else
         {
             textEncCodeDescript.Text = sEnc.Description;
         }
         labelEncWarning.Visible = false;
     }
 }
コード例 #8
0
        ///<summary>Updates one Snomed in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(Snomed snomed, Snomed oldSnomed)
        {
            string command = "";

            if (snomed.SnomedCode != oldSnomed.SnomedCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SnomedCode = '" + POut.String(snomed.SnomedCode) + "'";
            }
            if (snomed.Description != oldSnomed.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(snomed.Description) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE snomed SET " + command
                      + " WHERE SnomedNum = " + POut.Long(snomed.SnomedNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #9
0
        public UpdateSNOMEDPage(Snomed snomed)
        {
            InitializeComponent();
            var updateIcdoViewModel = new UpdateSNOMEDViewModel();

            updateIcdoViewModel.Snomed = snomed;
            BindingContext             = updateIcdoViewModel;
        }
コード例 #10
0
        ///<summary>Updates one Snomed in the database.</summary>
        public static void Update(Snomed snomed)
        {
            string command = "UPDATE snomed SET "
                             + "SnomedCode = '" + POut.String(snomed.SnomedCode) + "', "
                             + "Description= '" + POut.String(snomed.Description) + "' "
                             + "WHERE SnomedNum = " + POut.Long(snomed.SnomedNum);

            Db.NonQ(command);
        }
コード例 #11
0
        private void comboEncCodes_SelectionChangeCommitted(object sender, EventArgs e)
        {
            EncCodeSystem         = "SNOMEDCT";
            textEncCodeValue.Text = "";
            Snomed sEnc = Snomeds.GetByCode(comboEncCodes.SelectedItem.ToString());

            textEncCodeDescript.Text = sEnc.Description;
            labelEncWarning.Visible  = false;
        }
コード例 #12
0
 private void listValueType_SelectedIndexChanged(object sender, EventArgs e)
 {
     textValue.Text = "";
     _loincValue    = null;
     _snomedValue   = null;
     _icd9Value     = null;
     _icd10Value    = null;
     SetFlags();
 }
コード例 #13
0
ファイル: FormSnomeds.cs プロジェクト: kjb7749/testImport
 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;
     }
 }
コード例 #14
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;
 }
コード例 #15
0
ファイル: FormAllergyEdit.cs プロジェクト: royedwards/DRDNet
        private void butSnomedReactionSelect_Click(object sender, EventArgs e)
        {
            FormSnomeds formS = new FormSnomeds();

            formS.IsSelectionMode = true;
            if (formS.ShowDialog() == DialogResult.OK)
            {
                snomedReaction          = formS.SelectedSnomed;
                textSnomedReaction.Text = snomedReaction.Description;
            }
        }
コード例 #16
0
ファイル: SnomedCrud.cs プロジェクト: mnisl/OD
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Snomed> TableToList(DataTable table){
			List<Snomed> retVal=new List<Snomed>();
			Snomed snomed;
			for(int i=0;i<table.Rows.Count;i++) {
				snomed=new Snomed();
				snomed.SnomedNum  = PIn.Long  (table.Rows[i]["SnomedNum"].ToString());
				snomed.SnomedCode = PIn.String(table.Rows[i]["SnomedCode"].ToString());
				snomed.Description= PIn.String(table.Rows[i]["Description"].ToString());
				retVal.Add(snomed);
			}
			return retVal;
		}
コード例 #17
0
 ///<summary>Returns true if Update(Snomed,Snomed) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(Snomed snomed, Snomed oldSnomed)
 {
     if (snomed.SnomedCode != oldSnomed.SnomedCode)
     {
         return(true);
     }
     if (snomed.Description != oldSnomed.Description)
     {
         return(true);
     }
     return(false);
 }
コード例 #18
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";
            }
        }
コード例 #19
0
        private void FormEhrMeasureEventEdit_Load(object sender, EventArgs e)
        {
            textDateTime.Text = _measureEventCur.DateTEvent.ToString();
            Patient patCur = Patients.GetPat(_measureEventCur.PatNum);

            if (patCur != null)
            {
                textPatient.Text = patCur.GetNameFL();
            }
            if (!String.IsNullOrWhiteSpace(MeasureDescript))
            {
                labelMoreInfo.Text = MeasureDescript;
            }
            if (_measureEventCur.EventType == EhrMeasureEventType.TobaccoUseAssessed)
            {
                Loinc lCur = Loincs.GetByCode(_measureEventCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                if (lCur != null)
                {
                    textType.Text = lCur.NameLongCommon;                           //Example: History of tobacco use Narrative
                }
                Snomed sCur = Snomeds.GetByCode(_measureEventCur.CodeValueResult); //TobaccoUseAssessed results can be any SNOMEDCT code, we recommend one of 8 codes, but the CQM measure allows 54 codes and we let the user select any SNOMEDCT they want
                if (sCur != null)
                {
                    textResult.Text = sCur.Description;                  //Examples: Non-smoker (finding) or Smoker (finding)
                }
                //only visible if event is a tobacco use assessment
                textTobaccoDesireToQuit.Visible  = true;
                textTobaccoDuration.Visible      = true;
                textTobaccoStartDate.Visible     = true;
                labelTobaccoDesireToQuit.Visible = true;
                labelTobaccoDesireScale.Visible  = true;
                labelTobaccoStartDate.Visible    = true;
                textTobaccoDesireToQuit.Text     = _measureEventCur.TobaccoCessationDesire.ToString();
                if (_measureEventCur.DateStartTobacco.Year >= 1880)
                {
                    textTobaccoStartDate.Text = _measureEventCur.DateStartTobacco.ToShortDateString();
                }
                CalcTobaccoDuration();
            }
            else
            {
                //Currently, the TobaccoUseAssessed events are the only ones that can be deleted.
                butDelete.Enabled = false;
            }
            if (textType.Text == "")          //if not set by LOINC name above, then either not a TobaccoUseAssessed event or the code was not in the LOINC table, fill with EventType
            {
                textType.Text = _measureEventCur.EventType.ToString();
            }
            textMoreInfo.Text = _measureEventCur.MoreInfo;
        }
コード例 #20
0
        public async void EditSNOMED()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Warning,
                    Languages.CheckConnection,
                    Languages.Ok);

                return;
            }
            if (string.IsNullOrEmpty(Snomed.code) || string.IsNullOrEmpty(Snomed.description))
            {
                Value = true;
                return;
            }
            var snomed = new Snomed
            {
                id          = Snomed.id,
                code        = Snomed.code,
                description = Snomed.description
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Put <Snomed>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/snomed/update",
                res,
                snomed);

            Debug.WriteLine("********responseIn ViewModel*************");
            Debug.WriteLine(response);
            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            SNOMEDViewModel.GetInstance().Update(snomed);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "SNOMED Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
コード例 #21
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Snomed> TableToList(DataTable table)
        {
            List <Snomed> retVal = new List <Snomed>();
            Snomed        snomed;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                snomed             = new Snomed();
                snomed.SnomedNum   = PIn.Long(table.Rows[i]["SnomedNum"].ToString());
                snomed.SnomedCode  = PIn.String(table.Rows[i]["SnomedCode"].ToString());
                snomed.Description = PIn.String(table.Rows[i]["Description"].ToString());
                retVal.Add(snomed);
            }
            return(retVal);
        }
コード例 #22
0
 ///<summary>Inserts one Snomed into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(Snomed snomed)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(snomed, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             snomed.SnomedNum = DbHelper.GetNextOracleKey("snomed", "SnomedNum");                  //Cacheless method
         }
         return(InsertNoCache(snomed, true));
     }
 }
コード例 #23
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Snomed> TableToList(DataTable table)
        {
            List <Snomed> retVal = new List <Snomed>();
            Snomed        snomed;

            foreach (DataRow row in table.Rows)
            {
                snomed             = new Snomed();
                snomed.SnomedNum   = PIn.Long(row["SnomedNum"].ToString());
                snomed.SnomedCode  = PIn.String(row["SnomedCode"].ToString());
                snomed.Description = PIn.String(row["Description"].ToString());
                retVal.Add(snomed);
            }
            return(retVal);
        }
コード例 #24
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;
        }
コード例 #25
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();
        }
コード例 #26
0
        private void FillGridEdu()
        {
            gridEdu.BeginUpdate();
            gridEdu.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Criteria", 300);

            gridEdu.Columns.Add(col);
            col = new ODGridColumn("Link", 100);
            gridEdu.Columns.Add(col);
            eduResourceList = EduResources.GenerateForPatient(patCur.PatNum);
            gridEdu.Rows.Clear();
            ODGridRow row;

            foreach (EduResource eduResCur in eduResourceList)
            {
                row = new ODGridRow();
                if (eduResCur.DiseaseDefNum != 0)
                {
                    row.Cells.Add("Problem: " + DiseaseDefs.GetItem(eduResCur.DiseaseDefNum).DiseaseName);
                    //row.Cells.Add("ICD9: "+DiseaseDefs.GetItem(eduResCur.DiseaseDefNum).ICD9Code);
                }
                else if (eduResCur.MedicationNum != 0)
                {
                    row.Cells.Add("Medication: " + Medications.GetDescription(eduResCur.MedicationNum));
                }
                else if (eduResCur.SmokingSnoMed != "")
                {
                    Snomed sCur        = Snomeds.GetByCode(eduResCur.SmokingSnoMed);
                    string criteriaCur = "Tobacco Use Assessment: ";
                    if (sCur != null)
                    {
                        criteriaCur += sCur.Description;
                    }
                    row.Cells.Add(criteriaCur);
                }
                else
                {
                    row.Cells.Add("Lab Results: " + eduResCur.LabResultName);
                }
                row.Cells.Add(eduResCur.ResourceUrl);
                gridEdu.Rows.Add(row);
            }
            gridEdu.EndUpdate();
        }
コード例 #27
0
ファイル: FormAllergyEdit.cs プロジェクト: royedwards/DRDNet
        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;
            }
        }
コード例 #28
0
 private void FormEhrMeasureEventEdit_Load(object sender, EventArgs e)
 {
     textDateTime.Text = MeasCur.DateTEvent.ToString();
     if (MeasCur.EventType == EhrMeasureEventType.TobaccoUseAssessed)
     {
         Loinc lCur = Loincs.GetByCode(MeasCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
         if (lCur != null)
         {
             textType.Text = lCur.NameLongCommon;                  //Example: History of tobacco use Narrative
         }
         Snomed sCur = Snomeds.GetByCode(MeasCur.CodeValueResult); //TobaccoUseAssessed results can be any SNOMEDCT code, we recommend one of 8 codes, but the CQM measure allows 54 codes and we let the user select any SNOMEDCT they want
         if (sCur != null)
         {
             textResult.Text = sCur.Description;                  //Examples: Non-smoker (finding) or Smoker (finding)
         }
     }
     if (textType.Text == "")          //if not set by LOINC name above, then either not a TobaccoUseAssessed event or the code was not in the LOINC table, fill with EventType
     {
         textType.Text = MeasCur.EventType.ToString();
     }
     textMoreInfo.Text = MeasCur.MoreInfo;
 }
コード例 #29
0
ファイル: SnomedCrud.cs プロジェクト: mnisl/OD
		///<summary>Inserts one Snomed into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(Snomed snomed,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				snomed.SnomedNum=ReplicationServers.GetKey("snomed","SnomedNum");
			}
			string command="INSERT INTO snomed (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="SnomedNum,";
			}
			command+="SnomedCode,Description) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(snomed.SnomedNum)+",";
			}
			command+=
				 "'"+POut.String(snomed.SnomedCode)+"',"
				+"'"+POut.String(snomed.Description)+"')";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				snomed.SnomedNum=Db.NonQ(command,true);
			}
			return snomed.SnomedNum;
		}
コード例 #30
0
ファイル: SnomedCrud.cs プロジェクト: mnisl/OD
		///<summary>Inserts one Snomed into the database.  Returns the new priKey.</summary>
		public static long Insert(Snomed snomed){
			if(DataConnection.DBtype==DatabaseType.Oracle) {
				snomed.SnomedNum=DbHelper.GetNextOracleKey("snomed","SnomedNum");
				int loopcount=0;
				while(loopcount<100){
					try {
						return Insert(snomed,true);
					}
					catch(Oracle.DataAccess.Client.OracleException ex){
						if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
							snomed.SnomedNum++;
							loopcount++;
						}
						else{
							throw ex;
						}
					}
				}
				throw new ApplicationException("Insert failed.  Could not generate primary key.");
			}
			else {
				return Insert(snomed,false);
			}
		}
コード例 #31
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();
        }
コード例 #32
0
        public static string Validate(Appointment appt)
        {
            StringBuilder sb           = new StringBuilder();
            Provider      provFacility = Providers.GetProv(PrefC.GetInt(PrefName.PracticeDefaultProv));

            if (!Regex.IsMatch(provFacility.NationalProvID, "^(80840)?[0-9]{10}$"))
            {
                WriteError(sb, "Invalid NPI for provider '" + provFacility.Abbr + "'");
            }
            if (PrefC.HasClinicsEnabled && appt.ClinicNum != 0)           //Using clinics and a clinic is assigned.
            {
                Clinic clinic = Clinics.GetClinic(appt.ClinicNum);
                if (clinic.Description == "")
                {
                    WriteError(sb, "Missing clinic description for clinic attached to appointment.");
                }
            }
            else              //Not using clinics for this patient
            {
                if (PrefC.GetString(PrefName.PracticeTitle) == "")
                {
                    WriteError(sb, "Missing practice title.");
                }
            }
            Patient pat = Patients.GetPat(appt.PatNum);

            if (pat.PatStatus == PatientStatus.Deceased && pat.DateTimeDeceased.Year < 1880)
            {
                WriteError(sb, "Missing date time deceased.");
            }
            List <EhrAptObs> listObservations = EhrAptObses.Refresh(appt.AptNum);

            if (listObservations.Count == 0)
            {
                WriteError(sb, "Missing observation.");
            }
            for (int i = 0; i < listObservations.Count; i++)
            {
                EhrAptObs obs = listObservations[i];
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    if (obs.ValCodeSystem.Trim().ToUpper() == "LOINC")
                    {
                        Loinc loincVal = Loincs.GetByCode(obs.ValReported);
                        if (loincVal == null)
                        {
                            WriteError(sb, "Loinc code not found '" + loincVal.LoincCode + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "SNOMEDCT")
                    {
                        Snomed snomedVal = Snomeds.GetByCode(obs.ValReported);
                        if (snomedVal == null)
                        {
                            WriteError(sb, "Snomed code not found '" + snomedVal.SnomedCode + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD9")
                    {
                        ICD9 icd9Val = ICD9s.GetByCode(obs.ValReported);
                        if (icd9Val == null)
                        {
                            WriteError(sb, "ICD9 code not found '" + icd9Val.ICD9Code + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD10")
                    {
                        Icd10 icd10Val = Icd10s.GetByCode(obs.ValReported);
                        if (icd10Val == null)
                        {
                            WriteError(sb, "ICD10 code not found '" + icd10Val.Icd10Code + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                }
                else if (obs.ValType == EhrAptObsType.Numeric && obs.UcumCode != "")             //We only validate the ucum code if it will be sent out.  Blank units allowed.
                {
                    Ucum ucum = Ucums.GetByCode(obs.UcumCode);
                    if (ucum == null)
                    {
                        WriteError(sb, "Invalid unit code '" + obs.UcumCode + "' for observation (must be UCUM code).");
                    }
                }
            }
            return(sb.ToString());
        }
コード例 #33
0
        ///<summary>Observation/result segment.  Used to transmit observations related to the patient and visit.  Guide page 64.</summary>
        private void OBX()
        {
            List <EhrAptObs> listObservations = EhrAptObses.Refresh(_appt.AptNum);

            for (int i = 0; i < listObservations.Count; i++)
            {
                EhrAptObs obs = listObservations[i];
                _seg = new SegmentHL7(SegmentNameHL7.OBX);
                _seg.SetField(0, "OBX");
                _seg.SetField(1, (i + 1).ToString());             //OBX-1 Set ID - OBX.  Required (length 1..4).  Must start at 1 and increment.
                //OBX-2 Value Type.  Required (length 1..3).  Cardinality [1..1].  Identifies the structure of data in observation value OBX-5.  Values allowed: TS=Time Stamp (Date and/or Time),TX=Text,NM=Numeric,CWE=Coded with exceptions,XAD=Address.
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    _seg.SetField(2, "CWE");
                }
                else if (obs.ValType == EhrAptObsType.DateAndTime)
                {
                    _seg.SetField(2, "TS");
                }
                else if (obs.ValType == EhrAptObsType.Numeric)
                {
                    _seg.SetField(2, "NM");
                }
                else                  //obs.ValType==EhrAptObsType.Text
                {
                    _seg.SetField(2, "TX");
                }
                //OBX-3 Observation Identifier.  Required (length up to 478).  Cardinality [1..1].  Value set is HL7 table named "Observation Identifier".  Type CE.  We use LOINC codes because the testing tool used LOINC codes and so do vaccines.
                string obsIdCode         = "";
                string obsIdCodeDescript = "";
                string obsIdCodeSystem   = "LN";
                if (obs.IdentifyingCode == EhrAptObsIdentifier.BodyTemp)
                {
                    obsIdCode         = "11289-6";
                    obsIdCodeDescript = "Body temperature:Temp:Enctrfrst:Patient:Qn:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.CheifComplaint)
                {
                    obsIdCode         = "8661-1";
                    obsIdCodeDescript = "Chief complaint:Find:Pt:Patient:Nom:Reported";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.DateIllnessOrInjury)
                {
                    obsIdCode         = "11368-8";
                    obsIdCodeDescript = "Illness or injury onset date and time:TmStp:Pt:Patient:Qn:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.OxygenSaturation)
                {
                    obsIdCode         = "59408-5";
                    obsIdCodeDescript = "Oxygen saturation:MFr:Pt:BldA:Qn:Pulse oximetry";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.PatientAge)
                {
                    obsIdCode         = "21612-7";
                    obsIdCodeDescript = "Age Time Patient Reported";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.PrelimDiag)
                {
                    obsIdCode         = "44833-2";
                    obsIdCodeDescript = "Diagnosis.preliminary:Imp:Pt:Patient:Nom:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TreatFacilityID)
                {
                    obsIdCode         = "SS001";
                    obsIdCodeDescript = "Treating Facility Identifier";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TreatFacilityLocation)
                {
                    obsIdCode         = "SS002";
                    obsIdCodeDescript = "Treating Facility Location";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TriageNote)
                {
                    obsIdCode         = "54094-8";
                    obsIdCodeDescript = "Triage note:Find:Pt:Emergency department:Doc:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.VisitType)
                {
                    obsIdCode         = "SS003";
                    obsIdCodeDescript = "Facility / Visit Type";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                WriteCE(3, obsIdCode, obsIdCodeDescript, obsIdCodeSystem);
                //OBX-4 Observation Sub-ID.  No longer used.
                //OBX-5 Observation Value.  Required if known (length 1..99999).  Value must match type in OBX-2.
                if (obs.ValType == EhrAptObsType.Address)
                {
                    WriteXAD(5, _sendingFacilityAddress1, _sendingFacilityAddress2, _sendingFacilityCity, _sendingFacilityState, _sendingFacilityZip);
                }
                else if (obs.ValType == EhrAptObsType.Coded)
                {
                    string codeDescript     = "";
                    string codeSystemAbbrev = "";
                    if (obs.ValCodeSystem.Trim().ToUpper() == "LOINC")
                    {
                        Loinc loincVal = Loincs.GetByCode(obs.ValReported);
                        codeDescript     = loincVal.NameShort;
                        codeSystemAbbrev = "LN";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "SNOMEDCT")
                    {
                        Snomed snomedVal = Snomeds.GetByCode(obs.ValReported);
                        codeDescript     = snomedVal.Description;
                        codeSystemAbbrev = "SCT";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD9")
                    {
                        ICD9 icd9Val = ICD9s.GetByCode(obs.ValReported);
                        codeDescript     = icd9Val.Description;
                        codeSystemAbbrev = "I9";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD10")
                    {
                        Icd10 icd10Val = Icd10s.GetByCode(obs.ValReported);
                        codeDescript     = icd10Val.Description;
                        codeSystemAbbrev = "I10";
                    }
                    WriteCE(5, obs.ValReported.Trim(), codeDescript, codeSystemAbbrev);
                }
                else if (obs.ValType == EhrAptObsType.DateAndTime)
                {
                    DateTime dateVal    = DateTime.Parse(obs.ValReported.Trim());
                    string   strDateOut = dateVal.ToString("yyyyMMdd");
                    //The testing tool threw errors when there were trailing zeros, even though technically valid.
                    if (dateVal.Second > 0)
                    {
                        strDateOut += dateVal.ToString("HHmmss");
                    }
                    else if (dateVal.Minute > 0)
                    {
                        strDateOut += dateVal.ToString("HHmm");
                    }
                    else if (dateVal.Hour > 0)
                    {
                        strDateOut += dateVal.ToString("HH");
                    }
                    _seg.SetField(5, strDateOut);
                }
                else if (obs.ValType == EhrAptObsType.Numeric)
                {
                    _seg.SetField(5, obs.ValReported.Trim());
                }
                else                   //obs.ValType==EhrAptObsType.Text
                {
                    _seg.SetField(5, obs.ValReported);
                }
                //OBX-6 Units.  Required if OBX-2 is NM=Numeric.  Cardinality [0..1].  Type CE.  The guide suggests value sets: Pulse Oximetry Unit, Temperature Unit, or Age Unit.  However, the testing tool used UCUM, so we will use UCUM.
                if (obs.ValType == EhrAptObsType.Numeric)
                {
                    if (String.IsNullOrEmpty(obs.UcumCode))                      //If units are required but known, we must send a null flavor.
                    {
                        WriteCE(6, "UNK", "", "NULLFL");
                    }
                    else
                    {
                        Ucum ucum = Ucums.GetByCode(obs.UcumCode);
                        WriteCE(6, ucum.UcumCode, ucum.Description, "UCUM");
                    }
                }
                //OBX-7 References Range.  No longer used.
                //OBX-8 Abnormal Flags.  No longer used.
                //OBX-9 Probability.  No longer used.
                //OBX-10 Nature of Abnormal Test.  No longer used.
                _seg.SetField(11, "F");               //OBX-11 Observation Result Status.  Required (length 1..1).  Expected value is "F".
                //OBX-12 Effective Date of Reference Range.  No longer used.
                //OBX-13 User Defined Access Checks.  No longer used.
                //OBX-14 Date/Time of the Observation.  Optional.
                //OBX-15 Producer's ID.  No longer used.
                //OBX-16 Responsible Observer.  No longer used.
                //OBX-17 Observation Method.  No longer used.
                //OBX-18 Equipment Instance Identifier.  No longer used.
                //OBX-19 Date/Time of the Analysis.  No longer used.
                _msg.Segments.Add(_seg);
            }
        }
コード例 #34
0
ファイル: SnomedCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one Snomed in the database.</summary>
		public static void Update(Snomed snomed){
			string command="UPDATE snomed SET "
				+"SnomedCode = '"+POut.String(snomed.SnomedCode)+"', "
				+"Description= '"+POut.String(snomed.Description)+"' "
				+"WHERE SnomedNum = "+POut.Long(snomed.SnomedNum);
			Db.NonQ(command);
		}
コード例 #35
0
ファイル: SnomedCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one Snomed in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(Snomed snomed,Snomed oldSnomed){
			string command="";
			if(snomed.SnomedCode != oldSnomed.SnomedCode) {
				if(command!=""){ command+=",";}
				command+="SnomedCode = '"+POut.String(snomed.SnomedCode)+"'";
			}
			if(snomed.Description != oldSnomed.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(snomed.Description)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE snomed SET "+command
				+" WHERE SnomedNum = "+POut.Long(snomed.SnomedNum);
			Db.NonQ(command);
			return true;
		}