/* #region CachePattern //This region can be eliminated if this is not a table type with cached data. //If leaving this region in place, be sure to add RefreshCache and FillCache //to the Cache.cs file with all the other Cache types. ///<summary>A list of all Loincs.</summary> private static List<Loinc> listt; ///<summary>A list of all Loincs.</summary> public static List<Loinc> Listt{ get { if(listt==null) { RefreshCache(); } return listt; } set { listt=value; } } ///<summary></summary> public static DataTable RefreshCache(){ //No need to check RemotingRole; Calls GetTableRemotelyIfNeeded(). string command="SELECT * FROM loinc ORDER BY ItemOrder";//stub query probably needs to be changed DataTable table=Cache.GetTableRemotelyIfNeeded(MethodBase.GetCurrentMethod(),command); table.TableName="Loinc"; FillCache(table); return table; } ///<summary></summary> public static void FillCache(DataTable table){ //No need to check RemotingRole; no call to db. listt=Crud.LoincCrud.TableToList(table); } #endregion*/ ///<summary></summary> public static long Insert(Loinc lOINC){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ lOINC.LoincNum=Meth.GetLong(MethodBase.GetCurrentMethod(),lOINC); return lOINC.LoincNum; } return Crud.LoincCrud.Insert(lOINC); }
private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(IsSelectionMode) { SelectedLoinc=listLoincSearch[e.Row]; DialogResult=DialogResult.OK; } //Nothing to do if not selection mode }
private void listValueType_SelectedIndexChanged(object sender,EventArgs e) { textValue.Text=""; _loincValue=null; _snomedValue=null; _icd9Value=null; _icd10Value=null; SetFlags(); }
///<summary></summary> public static void Update(Loinc loinc) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), loinc); return; } Crud.LoincCrud.Update(loinc); }
/* #region CachePattern * * private class LoincCache : CacheListAbs<Loinc> { * protected override List<Loinc> GetCacheFromDb() { * string command="SELECT * FROM Loinc ORDER BY ItemOrder"; * return Crud.LoincCrud.SelectMany(command); * } * protected override List<Loinc> TableToList(DataTable table) { * return Crud.LoincCrud.TableToList(table); * } * protected override Loinc Copy(Loinc Loinc) { * return Loinc.Clone(); * } * protected override DataTable ListToTable(List<Loinc> listLoincs) { * return Crud.LoincCrud.ListToTable(listLoincs,"Loinc"); * } * protected override void FillCacheIfNeeded() { * Loincs.GetTableFromCache(false); * } * protected override bool IsInListShort(Loinc Loinc) { * return !Loinc.IsHidden; * } * } * * ///<summary>The object that accesses the cache in a thread-safe manner.</summary> * private static LoincCache _LoincCache=new LoincCache(); * * ///<summary>A list of all Loincs. Returns a deep copy.</summary> * public static List<Loinc> ListDeep { * get { * return _LoincCache.ListDeep; * } * } * * ///<summary>A list of all visible Loincs. Returns a deep copy.</summary> * public static List<Loinc> ListShortDeep { * get { * return _LoincCache.ListShortDeep; * } * } * * ///<summary>A list of all Loincs. Returns a shallow copy.</summary> * public static List<Loinc> ListShallow { * get { * return _LoincCache.ListShallow; * } * } * * ///<summary>A list of all visible Loincs. Returns a shallow copy.</summary> * public static List<Loinc> ListShort { * get { * return _LoincCache.ListShallowShort; * } * } * * ///<summary>Refreshes the cache and returns it as a DataTable. This will refresh the ClientWeb's cache and the ServerWeb's cache.</summary> * public static DataTable RefreshCache() { * return GetTableFromCache(true); * } * * ///<summary>Fills the local cache with the passed in DataTable.</summary> * public static void FillCacheFromTable(DataTable table) { * _LoincCache.FillCacheFromTable(table); * } * * ///<summary>Always refreshes the ClientWeb's cache.</summary> * public static DataTable GetTableFromCache(bool doRefreshCache) { * if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { * DataTable table=Meth.GetTable(MethodBase.GetCurrentMethod(),doRefreshCache); * _LoincCache.FillCacheFromTable(table); * return table; * } * return _LoincCache.GetTableFromCache(doRefreshCache); * } * #endregion*/ ///<summary></summary> public static long Insert(Loinc lOINC) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { lOINC.LoincNum = Meth.GetLong(MethodBase.GetCurrentMethod(), lOINC); return(lOINC.LoincNum); } return(Crud.LoincCrud.Insert(lOINC)); }
private void butOK_Click(object sender,EventArgs e) { if(gridMain.GetSelectedIndex()==-1) { MsgBox.Show(this,"Please select a Loinc code from the list."); return; } if(IsSelectionMode) { SelectedLoinc=listLoincSearch[gridMain.GetSelectedIndex()]; } DialogResult=DialogResult.OK; }
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(); }
///<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 ImportLoinc(string tempFileName, ProgressArgs progress, ref bool quit) { if (tempFileName == null) { return; } HashSet <string> codeHash = new HashSet <string>(Loincs.GetAllCodes()); string[] lines = File.ReadAllLines(tempFileName); string[] arrayLoinc; Loinc loinc = new Loinc(); 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); } arrayLoinc = lines[i].Split('\t'); if (codeHash.Contains(arrayLoinc[0])) //code already exists { continue; } loinc.LoincCode = arrayLoinc[0]; loinc.Component = arrayLoinc[1]; loinc.PropertyObserved = arrayLoinc[2]; loinc.TimeAspct = arrayLoinc[3]; loinc.SystemMeasured = arrayLoinc[4]; loinc.ScaleType = arrayLoinc[5]; loinc.MethodType = arrayLoinc[6]; loinc.StatusOfCode = arrayLoinc[7]; loinc.NameShort = arrayLoinc[8]; loinc.ClassType = arrayLoinc[9]; loinc.UnitsRequired = arrayLoinc[10] == "Y"; loinc.OrderObs = arrayLoinc[11]; loinc.HL7FieldSubfieldID = arrayLoinc[12]; loinc.ExternalCopyrightNotice = arrayLoinc[13]; loinc.NameLongCommon = arrayLoinc[14]; loinc.UnitsUCUM = arrayLoinc[15]; loinc.RankCommonTests = PIn.Int(arrayLoinc[16]); loinc.RankCommonOrders = PIn.Int(arrayLoinc[17]); Loincs.Insert(loinc); } }
///<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 ImportLoinc(string tempFileName, ProgressArgs progress, ref bool quit, ref int numCodesImported, ref int numCodesUpdated, bool updateExisting) { if (tempFileName == null) { return; } Dictionary <string, Loinc> dictLoincs = Loincs.GetAll().ToDictionary(x => x.LoincCode, x => x); string[] lines = File.ReadAllLines(tempFileName); string[] arrayLoinc; Loinc oldLoinc = new Loinc(); Loinc newLoinc = new Loinc(); 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); } arrayLoinc = lines[i].Split('\t'); newLoinc.LoincCode = arrayLoinc[0]; newLoinc.Component = arrayLoinc[1]; newLoinc.PropertyObserved = arrayLoinc[2]; newLoinc.TimeAspct = arrayLoinc[3]; newLoinc.SystemMeasured = arrayLoinc[4]; newLoinc.ScaleType = arrayLoinc[5]; newLoinc.MethodType = arrayLoinc[6]; newLoinc.StatusOfCode = arrayLoinc[7]; newLoinc.NameShort = arrayLoinc[8]; newLoinc.ClassType = arrayLoinc[9]; newLoinc.UnitsRequired = arrayLoinc[10] == "Y"; newLoinc.OrderObs = arrayLoinc[11]; newLoinc.HL7FieldSubfieldID = arrayLoinc[12]; newLoinc.ExternalCopyrightNotice = arrayLoinc[13]; newLoinc.NameLongCommon = arrayLoinc[14]; newLoinc.UnitsUCUM = arrayLoinc[15]; newLoinc.RankCommonTests = PIn.Int(arrayLoinc[16]); newLoinc.RankCommonOrders = PIn.Int(arrayLoinc[17]); if (dictLoincs.ContainsKey(arrayLoinc[0])) //code already exists; arrayLoinc[0]==Loinc Code { oldLoinc = dictLoincs[arrayLoinc[0]]; if (updateExisting && (oldLoinc.LoincCode != arrayLoinc[0] || oldLoinc.Component != arrayLoinc[1] || oldLoinc.PropertyObserved != arrayLoinc[2] || oldLoinc.TimeAspct != arrayLoinc[3] || oldLoinc.SystemMeasured != arrayLoinc[4] || oldLoinc.ScaleType != arrayLoinc[5] || oldLoinc.MethodType != arrayLoinc[6] || oldLoinc.StatusOfCode != arrayLoinc[7] || oldLoinc.NameShort != arrayLoinc[8] || oldLoinc.ClassType != arrayLoinc[9] || oldLoinc.UnitsRequired != (arrayLoinc[10] == "Y") || oldLoinc.OrderObs != arrayLoinc[11] || oldLoinc.HL7FieldSubfieldID != arrayLoinc[12] || oldLoinc.ExternalCopyrightNotice != arrayLoinc[13] || oldLoinc.NameLongCommon != arrayLoinc[14] || oldLoinc.UnitsUCUM != arrayLoinc[15] || oldLoinc.RankCommonTests != PIn.Int(arrayLoinc[16]) || oldLoinc.RankCommonOrders != PIn.Int(arrayLoinc[17]))) { Loincs.Update(newLoinc); numCodesUpdated++; } continue; } Loincs.Insert(newLoinc); numCodesImported++; } }
///<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 ImportLoinc(string tempFileName,ProgressArgs progress,ref bool quit) { if(tempFileName==null) { return; } HashSet<string> codeHash=new HashSet<string>(Loincs.GetAllCodes()); string[] lines=File.ReadAllLines(tempFileName); string[] arrayLoinc; Loinc loinc=new Loinc(); 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); } arrayLoinc=lines[i].Split('\t'); if(codeHash.Contains(arrayLoinc[0])) {//code already exists continue; } loinc.LoincCode =arrayLoinc[0]; loinc.Component =arrayLoinc[1]; loinc.PropertyObserved =arrayLoinc[2]; loinc.TimeAspct =arrayLoinc[3]; loinc.SystemMeasured =arrayLoinc[4]; loinc.ScaleType =arrayLoinc[5]; loinc.MethodType =arrayLoinc[6]; loinc.StatusOfCode =arrayLoinc[7]; loinc.NameShort =arrayLoinc[8]; loinc.ClassType =arrayLoinc[9]; loinc.UnitsRequired =arrayLoinc[10]=="Y"; loinc.OrderObs =arrayLoinc[11]; loinc.HL7FieldSubfieldID =arrayLoinc[12]; loinc.ExternalCopyrightNotice =arrayLoinc[13]; loinc.NameLongCommon =arrayLoinc[14]; loinc.UnitsUCUM =arrayLoinc[15]; loinc.RankCommonTests =PIn.Int(arrayLoinc[16]); loinc.RankCommonOrders =PIn.Int(arrayLoinc[17]); Loincs.Insert(loinc); } }
public void AddCode(Loinc loinc) { //TODO: lab values? no, add LabResult Instead subject4List.Add(new Subject3(new Value(loinc.LoincCode,"2.16.840.1.113883.6.1","LOINC",loinc.NameShort))); subject4List[subject4List.Count-1].mainSearchCriteria.originalText=loinc.NameShort; }
private void butPickValueLoinc_Click(object sender,EventArgs e) { FormLoincs formL=new FormLoincs(); formL.IsSelectionMode=true; if(formL.ShowDialog()==DialogResult.OK) { _loincValue=formL.SelectedLoinc; textValue.Text=_loincValue.NameShort; _strValCodeSystem="LOINC"; labelValue.Text=_strValCodeSystem+" Value"; } }