fromUtcString() public static method

Turns UTC string into VistA timestamp (year - 1700)
public static fromUtcString ( String ts ) : String
ts String
return String
Beispiel #1
0
        public static string buildFromToDateScreenParam(string fromDate, string toDate, int node, int pieceNum)
        {
            if (fromDate == "")
            {
                return("");
            }
            DateUtils.CheckDateRange(fromDate, toDate);

            // Need test for valid dates.
            fromDate = VistaTimestamp.fromUtcFromDate(fromDate);
            toDate   = VistaTimestamp.fromUtcString(toDate);
            return("S FD=" + fromDate + ",TD=" + toDate + ",CDT=$P(^(" + node + "),U," + pieceNum + ") I CDT>=FD,CDT<TD");
        }
Beispiel #2
0
        public static MdoQuery buildReportTextRequest(string dfn, string fromDate, string toDate, int nrpts, string arg)
        {
            if (String.IsNullOrEmpty(fromDate) || fromDate.Equals("0"))
            {
                fromDate = DateUtils.MinDate;
            }

            if (String.IsNullOrEmpty(toDate))
            {
                toDate = "0";
            }

            CheckRpcParams(dfn, fromDate, toDate);

            if (String.IsNullOrEmpty(arg))
            {
                throw new NullOrEmptyParamException("routine name");
            }

            VistaQuery vq = new VistaQuery("ORWRP REPORT TEXT");

            vq.addParameter(vq.LITERAL, dfn);
            if (nrpts != 0)
            {
                arg += nrpts.ToString();
            }
            vq.addParameter(vq.LITERAL, arg);
            vq.addParameter(vq.LITERAL, "");
            vq.addParameter(vq.LITERAL, "");
            vq.addParameter(vq.LITERAL, "");
            if (fromDate != "0")
            {
                fromDate = VistaTimestamp.fromUtcString(fromDate);
            }
            vq.addParameter(vq.LITERAL, fromDate);
            if (toDate != "0")
            {
                toDate = VistaTimestamp.fromUtcString(toDate);
            }
            vq.addParameter(vq.LITERAL, toDate);
            return(vq);
        }
Beispiel #3
0
 public static string getVisitString(Encounter encounter)
 {
     return(encounter.LocationId + ';' +
            VistaTimestamp.fromUtcString(encounter.Timestamp) + ';' +
            encounter.Type);
 }
        /*
         * In order to get the correct results with the correct reports using the DDR calls and RPCs
         * available, we are going to use the user specified fromDate but use today as the toDate (like
         * CPRS does) and retrieve all the specimens with in that time period. Then, we will find the
         * reports, match them up with their specimens and lastly filter those results using our original
         * date range
         */
        public ChemHemReport[] getChemHemReports(string dfn, string fromDate, string toDate)
        {
            if (!String.IsNullOrEmpty(toDate) && toDate.IndexOf(".") == -1)
            {
                toDate += ".235959";
            }

            IndexedHashtable specimens = getChemHemSpecimens(dfn, fromDate, toDate, "3");

            if (specimens == null || specimens.Count == 0)
            {
                return(null);
            }

            ArrayList lst = new ArrayList();
            //string nextDate = VistaTimestamp.fromUtcString(today);
            string nextDate = VistaTimestamp.fromUtcString(toDate);

            // Due to comment above, we want to loop through "ORWLRR INTERIMG" RPC until we
            // get as many reports as the DDR call above told us we would
            // TBD - this while statement screams infinite loop (i.e. what happens if we don't get all the
            // reports the DDR call above said we would?) Should we put an arbitrarily large stop in here?
            // e.g. if count > 1,000,000 then throw an exception that we didn't get what VistA said we should?
            int i = 0;

            while (lst.Count < specimens.Count)
            {
                LabSpecimen specimen = (LabSpecimen)specimens.GetValue(i);
                // ORWLRR INTERIMG rpc and function below updates nextDate for subsequent calls so LEAVE REF ALONE
                string        nextDateBefore = nextDate;
                ChemHemReport rpt            = getChemHemReport(dfn, ref nextDate);
                if (rpt != null)
                {
                    if ((rpt.Specimen != null) && (rpt.Specimen.AccessionNumber == specimen.AccessionNumber))
                    {
                        i++;
                        rpt.Id        = specimen.Id;
                        rpt.Facility  = specimen.Facility;
                        rpt.Specimen  = specimen;
                        rpt.Timestamp = specimen.ReportDate;
                        lst.Add(rpt);
                    }
                }
                // if the next date variable was not changed below, it means we are no longer looping through
                // the reports so we should go ahead and break out of this loop - should take care of
                // infinite loop concerns
                if (nextDate.Equals(nextDateBefore))
                {
                    break;
                }
            }
            // At last, filter the reports based on their timestamps
            ArrayList filteredList = new ArrayList();
            double    startDate    = Convert.ToDouble(fromDate);
            double    stopDate     = Convert.ToDouble(toDate);

            ChemHemReport[] rpts = (ChemHemReport[])lst.ToArray(typeof(ChemHemReport));
            foreach (ChemHemReport report in rpts)
            {
                // if the report doesn't have a timestamp, we will just add it to our list
                if (String.IsNullOrEmpty(report.Timestamp))
                {
                    filteredList.Add(report);
                    continue;
                }
                double reportTimeStamp = Convert.ToDouble(report.Timestamp);
                if (startDate <= reportTimeStamp && reportTimeStamp <= stopDate)
                {
                    filteredList.Add(report);
                }
            }
            return((ChemHemReport[])filteredList.ToArray(typeof(ChemHemReport)));
        }