///<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()); }
///<summary></summary> public static List<EhrMeasureEvent> GetByType(List<EhrMeasureEvent> listMeasures,EhrMeasureEventType eventType) { //No need to check RemotingRole; no call to db. List<EhrMeasureEvent> retVal=new List<EhrMeasureEvent>(); for(int i=0;i<listMeasures.Count;i++) { if(listMeasures[i].EventType==eventType) { retVal.Add(listMeasures[i]); } } return retVal; }
///<summary>Creates a measure event for the patient and event type passed in. Used by eServices.</summary> public static long CreateEventForPat(long patNum, EhrMeasureEventType measureEventType) { //No need to check RemotingRole; no call to db. EhrMeasureEvent measureEvent = new EhrMeasureEvent(); measureEvent.DateTEvent = DateTime.Now; measureEvent.EventType = measureEventType; measureEvent.PatNum = patNum; measureEvent.MoreInfo = ""; return(Insert(measureEvent)); }
///<summary>Gets a list of MeasureEvents. Primarily used in FormEhrMeasureEvents. Pass in true to get all EhrMeasureEvents for the date range. Passing in true will ignore the specified measure event type.</summary> public static List<EhrMeasureEvent> GetAllByTypeFromDB(DateTime dateStart,DateTime dateEnd,EhrMeasureEventType measureEventType,bool isAll) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { return Meth.GetObject<List<EhrMeasureEvent>>(MethodBase.GetCurrentMethod(),dateStart,dateEnd,measureEventType,isAll); } string command="SELECT * FROM ehrmeasureevent " +"WHERE DateTEvent >= "+POut.DateT(dateStart)+" " +"AND DateTEvent <= "+POut.DateT(dateEnd)+" "; if(!isAll) { command+="AND EventType = "+POut.Int((int)measureEventType)+" "; } command+="ORDER BY EventType,DateTEvent,PatNum"; return Crud.EhrMeasureEventCrud.SelectMany(command); }
///<summary>Gets codes (SNOMEDCT) from CodeValueResult for EhrMeasureEvents with DateTEvent within the last year for the given EhrMeasureEventType. ///Result list is grouped by code.</summary> public static List <string> GetListCodesUsedForType(EhrMeasureEventType eventType) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <string> >(MethodBase.GetCurrentMethod(), eventType)); } string command = "SELECT CodeValueResult FROM ehrmeasureevent " + "WHERE EventType=" + POut.Int((int)eventType) + " " + "AND CodeValueResult!='' " + "AND " + DbHelper.DtimeToDate("DateTEvent") + ">=" + POut.Date(MiscData.GetNowDateTime().AddYears(-1)) + " " + "GROUP BY CodeValueResult"; return(Db.GetListString(command)); }
///<summary>Gets the MoreInfo column from the most recent event of the specified type. Returns blank if none exists.</summary> public static string GetLatestInfoByType(EhrMeasureEventType measureEventType) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetString(MethodBase.GetCurrentMethod(), measureEventType)); } string command = "SELECT * FROM ehrmeasureevent WHERE EventType=" + POut.Int((int)measureEventType) + " ORDER BY DateTEvent DESC LIMIT 1"; EhrMeasureEvent measureEvent = Crud.EhrMeasureEventCrud.SelectOne(command); if (measureEvent == null) { return(""); } else { return(measureEvent.MoreInfo); } }
///<summary></summary> public static List <EhrMeasureEvent> GetByType(List <EhrMeasureEvent> listMeasures, EhrMeasureEventType eventType) { //No need to check RemotingRole; no call to db. List <EhrMeasureEvent> retVal = new List <EhrMeasureEvent>(); for (int i = 0; i < listMeasures.Count; i++) { if (listMeasures[i].EventType == eventType) { retVal.Add(listMeasures[i]); } } return(retVal); }
///<summary>Gets a list of MeasureEvents. Primarily used in FormEhrMeasureEvents. Pass in true to get all EhrMeasureEvents for the date range. Passing in true will ignore the specified measure event type.</summary> public static List <EhrMeasureEvent> GetAllByTypeFromDB(DateTime dateStart, DateTime dateEnd, EhrMeasureEventType measureEventType, bool isAll) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <EhrMeasureEvent> >(MethodBase.GetCurrentMethod(), dateStart, dateEnd, measureEventType, isAll)); } string command = "SELECT * FROM ehrmeasureevent " + "WHERE DateTEvent >= " + POut.DateT(dateStart) + " " + "AND DateTEvent <= " + POut.DateT(dateEnd) + " "; if (!isAll) { command += "AND EventType = " + POut.Int((int)measureEventType) + " "; } command += "ORDER BY EventType,DateTEvent,PatNum"; return(Crud.EhrMeasureEventCrud.SelectMany(command)); }