internal MdoQuery buildCancelRadiologyOrderRequest(String orderId, String reasonIen, String holdDescription)
        {
            VistaQuery vq = new VistaQuery("RAMAG ORDER CANCEL");

            vq.addParameter(vq.LITERAL, orderId);
            vq.addParameter(vq.LITERAL, reasonIen);

            if (!String.IsNullOrEmpty(holdDescription))
            {
                String[]           holdDescrLines = StringUtils.split(holdDescription, StringUtils.CRLF);
                DictionaryHashList miscOptionDHL  = new DictionaryHashList();
                String             currentLineNo  = "1";
                foreach (String line in holdDescrLines)
                {
                    miscOptionDHL.Add(currentLineNo, String.Format("HOLDESC^{0}^{1}", currentLineNo, line));
                    currentLineNo = Convert.ToString(Convert.ToInt32(currentLineNo) + 1);
                }
                vq.addParameter(vq.LIST, miscOptionDHL);
            }
            else
            {
                vq.addParameter(vq.LIST, new DictionaryHashList());
            }

            return(vq);
        }
Exemple #2
0
        internal MdoQuery buildRequest()
        {
            if (String.IsNullOrEmpty(File))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Must have a file!");
            }
            if (String.IsNullOrEmpty(Iens))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Must have an IENS!");
            }
            if (String.IsNullOrEmpty(Fields))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Must have a field!");
            }
            VistaQuery         vq       = new VistaQuery("DDR GETS ENTRY DATA");
            DictionaryHashList paramLst = new DictionaryHashList();

            paramLst.Add("\"FILE\"", File);
            paramLst.Add("\"IENS\"", Iens);
            paramLst.Add("\"FIELDS\"", Fields);
            if (!String.IsNullOrEmpty(Flags))
            {
                paramLst.Add("\"FLAGS\"", Flags);
            }
            vq.addParameter(vq.LIST, paramLst);

            return(vq);
        }
        public string execute()
        {
            if (File == "")
            {
                throw new Exception("Must have a file!");
            }
            if (Iens == "")
            {
                throw new Exception("Must have IENS!");
            }
            if (Field == "")
            {
                throw new Exception("Must have a field!");
            }
            if (Value == "")
            {
                throw new Exception("Must have a value!");
            }
            VistaQuery         vq       = new VistaQuery("DDR VALIDATOR");
            DictionaryHashList paramLst = new DictionaryHashList();

            paramLst.Add("\"FILE\"", File);
            paramLst.Add("\"IENS\"", Iens);
            paramLst.Add("\"FIELD\"", Field);
            paramLst.Add("\"VALUE\"", Value);
            vq.addParameter(vq.LIST, paramLst);
            DdrQuery query    = new DdrQuery(cxn);
            string   response = query.execute(vq);

            return(buildResult(response));
        }
Exemple #4
0
        public TaggedText getTeams(string sitecode)
        {
            TaggedText result = new TaggedText();
            string     msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn   = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api   = new EncounterApi();
                DictionaryHashList teams = api.getTeams(cxn);
                result = new TaggedText(sitecode, teams);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
        internal MdoQuery buildCancelExamRequest(String examIdentifier, String reasonIen, bool cancelAssociatedOrder, String holdDescription)
        {
            VistaQuery vq = new VistaQuery("RAMAG EXAM CANCEL");

            vq.addParameter(vq.LITERAL, examIdentifier);
            vq.addParameter(vq.LITERAL, reasonIen);

            if (!String.IsNullOrEmpty(holdDescription))
            {
                String[]           holdDescrLines = StringUtils.split(holdDescription, StringUtils.CRLF);
                DictionaryHashList miscOptionDHL  = new DictionaryHashList();
                String             currentLineNo  = "1";
                foreach (String line in holdDescrLines)
                {
                    miscOptionDHL.Add(currentLineNo, String.Format("HOLDESC^{0}^{1}", currentLineNo, line));
                    currentLineNo = Convert.ToString(Convert.ToInt32(currentLineNo) + 1);
                }
                vq.addParameter(vq.LIST, miscOptionDHL);
            }
            else
            {
                vq.addParameter(vq.LIST, new DictionaryHashList());
            }

            if (cancelAssociatedOrder)
            {
                vq.addParameter(vq.LITERAL, "O");
            }
            else
            {
                vq.addParameter(vq.LITERAL, "A");
            }

            return(vq);
        }
Exemple #6
0
 public TaggedText(string tag, DictionaryHashList dict)
 {
     this.tag           = tag;
     this.taggedResults = new TaggedText[dict.Count];
     for (int i = 0; i < dict.Count; i++)
     {
         this.taggedResults[i] = new TaggedText(dict[i]);
     }
 }
Exemple #7
0
        public void doDictionaryHashList(DictionaryHashList hl, string objPath)
        {
            Console.WriteLine("Assert.AreEqual({0},{1});", hl.Count, objPath + ".Count");

            foreach (string key in hl.Keys)
            {
                Console.WriteLine("Assert.AreEqual(\"{0}\", {1}[\"{2}\"]);", hl[key], objPath, key);
            }
        }
Exemple #8
0
 internal MdoQuery buildRequest()
 {
     if (Operation == null || Operation == "")
     {
         throw new ArgumentNullException("Must have an operation");
     }
     VistaQuery vq = new VistaQuery("DDR FILER");
     vq.addParameter(vq.LITERAL, Operation);
     DictionaryHashList lst = new DictionaryHashList();
     for (int i = 0; i < Args.Length; i++)
     {
         lst.Add(Convert.ToString(i+1), Args[i]);
     }
     vq.addParameter(vq.LIST, lst);
     return vq;
 }
        internal MdoQuery buildSetSymbolTableRequest(Dictionary <string, object> sessionTable)
        {
            VistaQuery         request = new VistaQuery("XWB DESERIALIZE");
            DictionaryHashList dhl     = new DictionaryHashList();

            string[] allKeys = new string[sessionTable.Count];
            sessionTable.Keys.CopyTo(allKeys, 0);

            for (int i = 0; i < sessionTable.Count; i++)
            {
                dhl.Add((i + 1).ToString(), (object)String.Concat(allKeys[i], '\x1e', sessionTable[allKeys[i]]));
            }

            request.addParameter(request.LIST, dhl);
            return(request);
        }
        internal MdoQuery buildRequest()
        {
            if (Operation == null || Operation == "")
            {
                throw new ArgumentNullException("Must have an operation");
            }
            VistaQuery vq = new VistaQuery("DDR FILER");

            vq.addParameter(vq.LITERAL, Operation);
            DictionaryHashList lst = new DictionaryHashList();

            for (int i = 0; i < Args.Length; i++)
            {
                lst.Add(Convert.ToString(i + 1), Args[i]);
            }
            vq.addParameter(vq.LIST, lst);
            return(vq);
        }
Exemple #11
0
        internal MdoQuery buildRequest()
        {
            if (String.IsNullOrEmpty(this.Operation))
            {
                throw new ArgumentNullException("Must have an operation");
            }
            VistaQuery vq = new VistaQuery("DDR FILER");

            vq.addParameter(vq.LITERAL, Operation);
            DictionaryHashList lst = new DictionaryHashList();

            for (int i = 0; i < Args.Length; i++)
            {
                lst.Add(Convert.ToString(i + 1), Args[i]);
            }
            vq.addParameter(vq.LIST, lst);
            //vq.addParameter(vq.LITERAL, "E"); // this is where we'd put the flags if they seemed to be useful - tried a few combinations but they seemed to only cause issues
            return(vq);
        }
        internal MdoQuery buildRegisterExamRequest(String orderId, String examDateTime, String examCategory, String hospitalLocation,
                                                   String wardLocation, String service, String techComment)
        {
            VistaQuery vq = new VistaQuery("RAMAG EXAM REGISTER");

            vq.addParameter(vq.LITERAL, orderId);
            vq.addParameter(vq.LITERAL, examDateTime);
            DictionaryHashList miscParams = new DictionaryHashList();
            Int32 miscParamCount          = 1;

            miscParams.Add(miscParamCount.ToString(), "FLAGS^^A");
            miscParamCount++;

            miscParams.Add(miscParamCount.ToString(), "EXAMCAT^^" + examCategory);
            miscParamCount++;


            if (!String.IsNullOrEmpty(hospitalLocation))
            {
                miscParams.Add(miscParamCount.ToString(), "PRINCLIN^^" + hospitalLocation);
                miscParamCount++;
            }
            if (!String.IsNullOrEmpty(wardLocation))
            {
                miscParams.Add(miscParamCount.ToString(), "WARD^^" + wardLocation);
                miscParamCount++;
            }
            if (!String.IsNullOrEmpty(service))
            {
                miscParams.Add(miscParamCount.ToString(), "SERVICE^^" + service);
                miscParamCount++;
            }
            if (!String.IsNullOrEmpty(techComment))
            {
                miscParams.Add(miscParamCount.ToString(), "TECHCOMM^^" + techComment);
                miscParamCount++;
            }

            vq.addParameter(vq.LIST, miscParams);

            return(vq);
        }
Exemple #13
0
        internal string list2string(DictionaryHashList lst)
        {
            if (lst == null || lst.Count == 0)
            {
                return(StringUtils.LPack("", 3) + 'f');
            }
            string result = "";

            for (int i = 0; i < lst.Count; i++)
            {
                DictionaryEntry entry = lst[i];
                string          key   = (string)entry.Key;
                string          value = (string)entry.Value;
                if (String.IsNullOrEmpty(value))
                {
                    value = "\u0001";
                }
                result += StringUtils.LPack(key, 3) + StringUtils.LPack(value, 3) + 't';
            }
            result = result.Substring(0, result.Length - 1) + 'f';
            return(result);
        }
Exemple #14
0
 public string execute()
 {
     if (File == "")
     {
         throw new Exception("Must have a file!");
     }
     if (Iens == "")
     {
         throw new Exception("Must have IENS!");
     }
     if (Field == "")
     {
         throw new Exception("Must have a field!");
     }
     if (Value == "")
     {
         throw new Exception("Must have a value!");
     }
     VistaQuery vq = new VistaQuery("DDR VALIDATOR");
     DictionaryHashList paramLst = new DictionaryHashList();
     paramLst.Add("\"FILE\"", File);
     paramLst.Add("\"IENS\"", Iens);
     paramLst.Add("\"FIELD\"", Field);
     paramLst.Add("\"VALUE\"", Value);
     vq.addParameter(vq.LIST, paramLst);
     DdrQuery query = new DdrQuery(cxn);
     string response = query.execute(vq);
     return buildResult(response);
 }
Exemple #15
0
 public Order writeSimpleOrderByPolicy(
     Patient patient,
     String duz,
     String esig,
     String locationIen,
     String orderIen,
     DateTime startDate,
     string reason)
 {
     OrderDialog dlg = bldQRSP(patient, duz, locationIen, orderIen, "0;C;0;0", "", "0", "0");
     dlg.Responses = getOrderResponses(dlg.ResponseId);
     OrderDialogName dlgName = getOrderDialogName(orderIen);
     VistaQuery vq = new VistaQuery("ORWDX SAVE");
     vq.addParameter(vq.LITERAL, patient.LocalPid);
     vq.addParameter(vq.LITERAL, duz);
     vq.addParameter(vq.LITERAL, locationIen);
     vq.addParameter(vq.LITERAL, dlgName.BaseName);
     vq.addParameter(vq.LITERAL, dlg.DisplayGrp);
     vq.addParameter(vq.LITERAL, orderIen);
     vq.addParameter(vq.LITERAL, "");
     DictionaryHashList lst = new DictionaryHashList();
     OrderResponse[] responses = dlg.Responses;
     for (int i = 0; i < responses.Length; i++)
     {
         if (responses[i].PromptId == "6")
         {
             String vistaTS = VistaTimestamp.fromDateTime(startDate);
             lst.Add(responses[i].PromptId + ',' + responses[i].Instance, vistaTS);
         }
         else
         {
             lst.Add(responses[i].PromptId + ',' + responses[i].Instance, responses[i].Ivalue);
         }
     }
     lst.Add("\"ORCHECK\"", "0");
     lst.Add("\"ORTS\"", "0");
     vq.addParameter(vq.LIST, lst);
     vq.addParameter(vq.LITERAL, "");
     vq.addParameter(vq.LITERAL, "");
     vq.addParameter(vq.LITERAL, "");
     vq.addParameter(vq.LITERAL, "0");
     String rtn = (String)cxn.query(vq);
     if (StringUtils.isEmpty(rtn))
     {
         return null;
     }
     String[] flds = StringUtils.split(rtn, StringUtils.CARET);
     Order order = new Order();
     order.Id = flds[0].Substring(1);
     order.Timestamp = VistaTimestamp.toDateTime(flds[2]);
     order.StartDate = VistaTimestamp.toDateTime(flds[3]);
     order.StopDate = VistaTimestamp.toDateTime(flds[4]);
     order.Status = flds[5];
     order.SigStatus = flds[6];
     order.VerifyingNurse = flds[7];
     order.VerifyingClerk = flds[8];
     User provider = new User();
     provider.Uid = flds[9];
     provider.Name = new PersonName(flds[10]);
     order.Provider = provider;
     releaseOrderByPolicy(patient.LocalPid, duz, locationIen, esig, order);
     return order;
 }
Exemple #16
0
 private void setProps(IndexedHashtable t)
 {
     this.results = new TaggedText[t.Count];
     for (int i = 0; i < t.Count; i++)
     {
         this.results[i]     = new TaggedText();
         this.results[i].tag = (string)t.GetKey(i);
         if (t.GetValue(i) == null)
         {
             continue;
         }
         Type vType = t.GetValue(i).GetType();
         if (vType == typeof(string))
         {
             this.results[i].text = (string)t.GetValue(i);
         }
         else if (vType == typeof(string[]))
         {
             string[] a = (string[])t.GetValue(i);
             this.results[i].taggedResults = new TaggedText[a.Length];
             for (int j = 0; j < a.Length; j++)
             {
                 if (textOnly)
                 {
                     this.results[i].taggedResults[j] = new TaggedText("", a[j]);
                 }
                 else
                 {
                     this.results[i].taggedResults[j] = new TaggedText(a[j]);
                 }
             }
         }
         else if (vType == typeof(Dictionary <string, ArrayList>))
         {
             Dictionary <string, ArrayList> d = (Dictionary <string, ArrayList>)t.GetValue(i);
             this.results[i].taggedResults = new TaggedText[d.Count];
             int j = 0;
             foreach (KeyValuePair <string, ArrayList> kvp in d)
             {
                 this.results[i].taggedResults[j++] = new TaggedText(kvp);
             }
         }
         else if (vType == typeof(IndexedHashtable))
         {
             IndexedHashtable tbl = (IndexedHashtable)t.GetValue(i);
             this.results[i].taggedResults = new TaggedText[tbl.Count];
             for (int j = 0; j < tbl.Count; j++)
             {
                 this.results[i].taggedResults[j] = new TaggedText((string)tbl.GetKey(j), (string)tbl.GetValue(j));
             }
         }
         else if (vType == typeof(DictionaryHashList))
         {
             DictionaryHashList d = (DictionaryHashList)t.GetValue(i);
             this.results[i].taggedResults = new TaggedText[d.Count];
             for (int j = 0; j < d.Count; j++)
             {
                 this.results[i].taggedResults[j] = new TaggedText(d[j]);
             }
         }
         else if (vType == typeof(KeyValuePair <int, string>))
         {
             if (t.Count == 1)
             {
                 this.results = new TaggedText[] { new TaggedText((KeyValuePair <int, string>)t.GetValue(i)) };
             }
             else
             {
                 this.results[i].taggedResults = new TaggedText[] { new TaggedText((KeyValuePair <int, string>)t.GetValue(i)) };
             }
         }
         else if (vType == typeof(DateTime))
         {
             string s = ((DateTime)t.GetValue(i)).ToString("yyyyMMdd.HHmmss");
             if (t.Count == 1)
             {
                 this.results = new TaggedText[] { new TaggedText(t.GetKey(i).ToString(), s) };
             }
             else
             {
                 this.results[i].taggedResults = new TaggedText[] { new TaggedText(t.GetKey(i).ToString(), s) };
             }
         }
         else if (vType == typeof(StringDictionary))
         {
             StringDictionary sd = (StringDictionary)t.GetValue(i);
             this.results[i] = new TaggedText(this.results[i].tag, sd);
         }
         else if (vType == typeof(OrderedDictionary))
         {
             OrderedDictionary d = (OrderedDictionary)t.GetValue(i);
             this.results[i] = new TaggedText(this.results[i].tag, d);
         }
         else if (vType == typeof(User))
         {
             string s = ((User)t.GetValue(i)).Uid;
             this.results[i].text = s;
         }
         else if (MdwsUtils.isException(t.GetValue(i)))
         {
             this.results[i].fault = new FaultTO((Exception)t.GetValue(i));
         }
         else if (vType == typeof(gov.va.medora.mdo.domain.ccd.ContinuityOfCareRecord))
         {
             // serialize CCR as XML
             MemoryStream  memStream  = new MemoryStream();
             XmlSerializer serializer = new XmlSerializer(typeof(ContinuityOfCareRecord));
             serializer.Serialize(memStream, new ContinuityOfCareRecord());
             this.results[i] = new TaggedText(this.results[i].tag, "<![CDATA[" + System.Text.Encoding.UTF8.GetString(memStream.ToArray()) + "]]>");
         }
     }
     this.count = t.Count;
 }
Exemple #17
0
        internal MdoQuery buildRequest()
        {
            if (String.IsNullOrEmpty(File))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Must have a file!");
            }
            if (String.IsNullOrEmpty(Iens))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Must have an IENS!");
            }
            if (String.IsNullOrEmpty(Fields))
            {
                throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Must have a field!");
            }
            VistaQuery vq = new VistaQuery("DDR GETS ENTRY DATA");
            DictionaryHashList paramLst = new DictionaryHashList();
            paramLst.Add("\"FILE\"", File);
            paramLst.Add("\"IENS\"", Iens);
            paramLst.Add("\"FIELDS\"", Fields);
            if (!String.IsNullOrEmpty(Flags))
            {
                paramLst.Add("\"FLAGS\"", Flags);
            }
            vq.addParameter(vq.LIST, paramLst);

            return vq;
        }
Exemple #18
0
 public Parameter(int type, DictionaryHashList lst)
 {
     Type  = type;
     Value = ".x";
     List  = lst;
 }
Exemple #19
0
        internal MdoQuery buildSetSymbolTableRequest(Dictionary<string, object> sessionTable)
        {
            VistaQuery request = new VistaQuery("XWB DESERIALIZE");
            DictionaryHashList dhl = new DictionaryHashList();
            string[] allKeys = new string[sessionTable.Count];
            sessionTable.Keys.CopyTo(allKeys, 0);

            for (int i = 0; i < sessionTable.Count; i++)
            {
                dhl.Add((i + 1).ToString(), (object)String.Concat(allKeys[i], '\x1e', sessionTable[allKeys[i]]));
            }

            request.addParameter(request.LIST, dhl);
            return request;
        }
Exemple #20
0
        // Use this builder for the old broker...
        public string buildMessage_DirectBroker()
        {
            const string PREFIX = "{XWB}";
            const string HDR    = "007XWB;;;;";

            string             sParams = "";
            DictionaryHashList lst     = null;
            string             text    = null;

            for (int i = 0; i < parameters.Count; i++)
            {
                Parameter vp    = (Parameter)parameters[i];
                int       pType = vp.Type;
                if (pType == LITERAL)
                {
                    sParams += StringUtils.strPack('0' + vp.Value, 3);
                }
                else if (pType == REFERENCE)
                {
                    sParams += StringUtils.strPack('1' + vp.Value, 3);
                }
                else if (pType == LIST)
                {
                    sParams += StringUtils.strPack('2' + vp.Value, 3);
                    lst      = vp.List;
                }
                else if (pType == WORDPROC)
                {
                    sParams += StringUtils.strPack('2' + vp.Value, 3);
                    text     = vp.Text;
                }
            }
            string msg = "";

            if (lst == null && text == null)
            {
                msg = StringUtils.strPack(HDR + buildApi(rpcName, sParams, "0"), 5);
            }
            else if (lst != null)
            {
                msg = StringUtils.strPack(HDR + buildApi(rpcName, sParams, "1"), 5);
                for (int j = 0; j < lst.Count; j++)
                {
                    DictionaryEntry entry = lst[j];
                    string          key   = (string)entry.Key;
                    string          value = (string)entry.Value;
                    if (value == null || value == "")
                    {
                        value = "\u0001";
                    }
                    msg += StringUtils.strPack(key, 3) + StringUtils.strPack(value, 3);
                }
                msg += "000";
            }
            else
            {
                msg = StringUtils.strPack(HDR + buildApi(rpcName, sParams, "1"), 5);
                string[] lines = StringUtils.split(text, StringUtils.CRLF);
                for (int i = 0; i < lines.Length; i++)
                {
                    msg += StringUtils.strPack(i.ToString(), 3) +
                           StringUtils.strPack(lines[i] + StringUtils.CRLF, 3);
                }
                msg += "000";
            }
            msg = getVersion() + msg;
            msg = PREFIX + StringUtils.strPack(msg, 5);
            return(msg);
        }
Exemple #21
0
 internal MdoQuery buildSendOrderByPolicyRequest(string dfn, string locIen, string esig, Order order)
 {
     VistaQuery vq = new VistaQuery("ORWDX SEND");
     vq.addParameter(vq.LITERAL, dfn);
     vq.addParameter(vq.LITERAL, "0");
     vq.addParameter(vq.LITERAL, locIen);
     vq.addEncryptedParameter(vq.LITERAL, ' ' + esig);	//' ' apparently needed to avoid a bug in Vista?  See CPRS.
     DictionaryHashList lst = new DictionaryHashList();
     String value = order.Id + '^' +
         VistaConstants.SS_ESIGNED + '^' +
         VistaConstants.RS_RELEASE + '^' +
         VistaConstants.NO_POLICY;
     lst.Add("1", value);
     vq.addParameter(vq.LIST, lst);
     return vq;
 }
Exemple #22
0
        internal void sendOrder(String locIen, String esig, Order order)
        {
            VistaQuery vq = new VistaQuery("ORWDX SEND");
            vq.addParameter(vq.LITERAL, cxn.Pid);
            vq.addParameter(vq.LITERAL, "0");
            vq.addParameter(vq.LITERAL, locIen);
            vq.addEncryptedParameter(vq.LITERAL, ' ' + esig);	//' ' apparently needed to avoid a bug in Vista?  See CPRS.
            DictionaryHashList lst = new DictionaryHashList();
            string value = order.Id + '^' +
                VistaConstants.SS_ESIGNED + '^' +
                VistaConstants.RS_RELEASE + '^' +
                VistaConstants.NO_POLICY;
            lst.Add("1", value);
            vq.addParameter(vq.LIST, lst);
            string rtn = (string)cxn.query(vq);
            string[] flds = StringUtils.split(rtn, StringUtils.CARET);
            flds[1] = flds[1].TrimEnd(null);
            if (flds[1] == "RS")
            {
                order.Status = "Released";
            }
            else
            {
                order.Status = "Error: " + flds[3];
                throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "Error: This order has been signed!");

            }
        }
Exemple #23
0
        internal ChemHemReport[] toChemHemReports(string response)
        {
            if (response == "")
            {
                return null;
            }
            DictionaryHashList lst = new DictionaryHashList();
            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);

            ChemHemReport rpt = null;
            LabResult rslt = null;
            string ts = "";
            string facilityTag = "";
            string facilityName = "";
            for (int i = 0; i < lines.Length; i++)
            {
                string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
                if (!StringUtils.isNumeric(flds[0]))
                {
                    throw new DataMisalignedException("Invalid fldnum: " + flds[0] + " in lines[" + i + "]");
                }
                int fldnum = Convert.ToInt32(flds[0]);
                switch (fldnum)
                {
                    case 1:
                        string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                        if (parts.Length == 2)
                        {
                            facilityTag = parts[1];
                            facilityName = parts[0];
                        }
                        else if (flds[1] != "")
                        {
                            facilityTag = cxn.DataSource.SiteId.Id;
                            facilityName = flds[1];
                        }
                        else
                        {
                            facilityTag = cxn.DataSource.SiteId.Id;
                            facilityName = cxn.DataSource.SiteId.Name;
                        }
                        break;
                    case 2:
                        if (rpt != null)
                        {
                            if (StringUtils.isEmpty(rslt.Test.RefRange))
                            {
                                if (!StringUtils.isEmpty(rslt.Test.LowRef) &&
                                    !StringUtils.isEmpty(rslt.Test.HiRef))
                                {
                                    rslt.Test.RefRange = rslt.Test.LowRef + " - " + rslt.Test.HiRef;
                                }
                            }
                            rpt.AddResult(rslt);
                        }
                        rslt = new LabResult();
                        rslt.Test = new LabTest();
                        ts = VistaTimestamp.toUtcFromRdv(flds[1]);
                        if (lst[ts] == null)
                        {
                            rpt = new ChemHemReport();
                            rpt.Facility = new SiteId(facilityTag, facilityName);
                            rpt.Timestamp = ts;
                            lst.Add(ts, rpt);
                        }
                        break;
                    case 3:
                        if (flds.Length == 2)
                        {
                            rslt.Test.Name = flds[1];
                        }
                        break;
                    case 4:
                        if (flds.Length == 2)
                        {
                            if (null != rslt)
                                rslt.SpecimenType = flds[1];
                        }
                        break;
                    case 5:
                        if (flds.Length == 2)
                        {
                            rslt.Value = flds[1];
                        }
                        break;
                    case 6:
                        if (flds.Length == 2)
                        {
                            rslt.BoundaryStatus = flds[1];
                        }
                        break;
                    case 7:
                        if (flds.Length == 2)
                        {
                            rslt.Test.Units = flds[1];
                        }
                        break;
                    case 8:
                        if (flds.Length == 2)
                        {
                            rslt.Test.LowRef = flds[1];
                        }
                        break;
                    case 9:
                        if (flds.Length == 2)
                        {
                            rslt.Test.HiRef = flds[1];
                        }
                        break;
                    case 10:
                        if (flds.Length == 2)
                        {
                            rslt.Comment += flds[1] + '\n';
                        }
                        break;
                }
            }

            if (rpt != null)
            {
                if (StringUtils.isEmpty(rslt.Test.RefRange))
                {
                    if (!StringUtils.isEmpty(rslt.Test.LowRef) &&
                        !StringUtils.isEmpty(rslt.Test.HiRef))
                    {
                        rslt.Test.RefRange = rslt.Test.LowRef + " - " + rslt.Test.HiRef;
                    }
                }
                rpt.AddResult(rslt);
            }

            ChemHemReport[] result = new ChemHemReport[lst.Count];
            for (int i = 0; i < lst.Count; i++)
            {
                DictionaryEntry de = lst[i];
                result[i] = (ChemHemReport)de.Value;
            }
            return result;
        }
Exemple #24
0
 internal MdoQuery buildRequest()
 {
     if (File == "")
     {
         throw new ArgumentNullException("Must have a file!");
     }
     VistaQuery vq = new VistaQuery("DDR LISTER");
     DictionaryHashList paramLst = new DictionaryHashList();
     paramLst.Add("\"FILE\"", File);
     if (Iens != "")
     {
         paramLst.Add("\"IENS\"", Iens);
     }
     if (requestedFields.Length > 0)
     {
         paramLst.Add("\"FIELDS\"", getFieldsArg());
     }
     if (Flags != "")
     {
         paramLst.Add("\"FLAGS\"", Flags);
     }
     if (Max != "")
     {
         paramLst.Add("\"MAX\"", Max);
     }
     if (From != "")
     {
         paramLst.Add("\"FROM\"", From);
     }
     if (Part != "")
     {
         paramLst.Add("\"PART\"", Part);
     }
     if (Xref != "")
     {
         paramLst.Add("\"XREF\"", Xref);
     }
     if (Screen != "")
     {
         paramLst.Add("\"SCREEN\"", Screen);
     }
     if (Id != "")
     {
         paramLst.Add("\"ID\"", Id);
     }
     if (Options != "")
     {
         paramLst.Add("\"OPTIONS\"", Options);
     }
     if (moreFrom != "")
     {
         paramLst.Add("\"FROM\"", moreFrom);
     }
     if (moreIens != "")
     {
         paramLst.Add("\"IENS\"", moreIens);
     }
     vq.addParameter(vq.LIST, paramLst);
     return vq;
 }
        internal ChemHemReport[] toChemHemReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            DictionaryHashList lst = new DictionaryHashList();

            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);

            ChemHemReport rpt          = null;
            LabResult     rslt         = null;
            string        ts           = "";
            string        facilityTag  = "";
            string        facilityName = "";

            for (int i = 0; i < lines.Length; i++)
            {
                string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
                if (!StringUtils.isNumeric(flds[0]))
                {
                    throw new DataMisalignedException("Invalid fldnum: " + flds[0] + " in lines[" + i + "]");
                }
                int fldnum = Convert.ToInt32(flds[0]);
                switch (fldnum)
                {
                case 1:
                    string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                    if (parts.Length == 2)
                    {
                        facilityTag  = parts[1];
                        facilityName = parts[0];
                    }
                    else if (flds[1] != "")
                    {
                        facilityTag  = cxn.DataSource.SiteId.Id;
                        facilityName = flds[1];
                    }
                    else
                    {
                        facilityTag  = cxn.DataSource.SiteId.Id;
                        facilityName = cxn.DataSource.SiteId.Name;
                    }
                    break;

                case 2:
                    if (rpt != null)
                    {
                        if (StringUtils.isEmpty(rslt.Test.RefRange))
                        {
                            if (!StringUtils.isEmpty(rslt.Test.LowRef) &&
                                !StringUtils.isEmpty(rslt.Test.HiRef))
                            {
                                rslt.Test.RefRange = rslt.Test.LowRef + " - " + rslt.Test.HiRef;
                            }
                        }
                        rpt.AddResult(rslt);
                    }
                    rslt      = new LabResult();
                    rslt.Test = new LabTest();
                    ts        = VistaTimestamp.toUtcFromRdv(flds[1]);
                    if (lst[ts] == null)
                    {
                        rpt           = new ChemHemReport();
                        rpt.Facility  = new SiteId(facilityTag, facilityName);
                        rpt.Timestamp = ts;
                        lst.Add(ts, rpt);
                    }
                    break;

                case 3:
                    if (flds.Length == 2)
                    {
                        rslt.Test.Name = flds[1];
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        if (null != rslt)
                        {
                            rslt.SpecimenType = flds[1];
                        }
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        rslt.Value = flds[1];
                    }
                    break;

                case 6:
                    if (flds.Length == 2)
                    {
                        rslt.BoundaryStatus = flds[1];
                    }
                    break;

                case 7:
                    if (flds.Length == 2)
                    {
                        rslt.Test.Units = flds[1];
                    }
                    break;

                case 8:
                    if (flds.Length == 2)
                    {
                        rslt.Test.LowRef = flds[1];
                    }
                    break;

                case 9:
                    if (flds.Length == 2)
                    {
                        rslt.Test.HiRef = flds[1];
                    }
                    break;

                case 10:
                    if (flds.Length == 2)
                    {
                        rslt.Comment += flds[1] + '\n';
                    }
                    break;
                }
            }

            if (rpt != null)
            {
                if (StringUtils.isEmpty(rslt.Test.RefRange))
                {
                    if (!StringUtils.isEmpty(rslt.Test.LowRef) &&
                        !StringUtils.isEmpty(rslt.Test.HiRef))
                    {
                        rslt.Test.RefRange = rslt.Test.LowRef + " - " + rslt.Test.HiRef;
                    }
                }
                rpt.AddResult(rslt);
            }

            ChemHemReport[] result = new ChemHemReport[lst.Count];
            for (int i = 0; i < lst.Count; i++)
            {
                DictionaryEntry de = lst[i];
                result[i] = (ChemHemReport)de.Value;
            }
            return(result);
        }
Exemple #26
0
 public DictionaryHashList getTeams()
 {
     VistaQuery vq = new VistaQuery("ORQPT TEAMS");
     string response = (string)cxn.query(vq);
     if (response == "")
     {
         return null;
     }
     DictionaryHashList result = new DictionaryHashList();
     string[] lines = StringUtils.split(response, StringUtils.CRLF);
     lines = StringUtils.trimArray(lines);
     for (int i = 0; i < lines.Length; i++)
     {
         string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
         result.Add(flds[0], flds[1]);
     }
     return result;
 }
Exemple #27
0
 public TaggedText(string tag, DictionaryHashList dict)
 {
     this.tag = tag;
     this.taggedResults = new TaggedText[dict.Count];
     for (int i=0; i<dict.Count; i++)
     {
         this.taggedResults[i] = new TaggedText(dict[i]);
     }
 }
Exemple #28
0
 public Parameter(int type, DictionaryHashList lst)
 {
     Type = type;
     Value = ".x";
     List = lst;
 }
Exemple #29
0
 internal MdoQuery buildGetOrdersRequest(IndexedHashtable t)
 {
     VistaQuery vq = new VistaQuery("ORWORR GET4LST");
     vq.addParameter(vq.LITERAL, "2");
     vq.addParameter(vq.LITERAL, VistaTimestamp.fromDateTime(DateTime.Now));
     DictionaryHashList lst = new DictionaryHashList();
     for (int i = 0; i < t.Count; i++)
     {
         lst.Add(Convert.ToString(i + 1), ((Order)t.GetValue(i)).Id);
     }
     vq.addParameter(vq.LIST, lst);
     return vq;
 }
Exemple #30
0
        public void addParameter(int type, DictionaryHashList lst)
        {
            Parameter vp = new Parameter(type, lst);

            parameters.Add(vp);
        }
Exemple #31
0
 internal void sendOrders(String providerId, String locIen, String esig, Order[] orders)
 {
     VistaQuery vq = new VistaQuery("ORWDX SEND");
     vq.addParameter(vq.LITERAL, cxn.Pid);
     vq.addParameter(vq.LITERAL, providerId);
     vq.addParameter(vq.LITERAL, locIen);
     vq.addParameter(vq.LITERAL, ' ' + esig);	//' ' apparently needed to avoid a bug in Vista?  See CPRS.
     DictionaryHashList lst = new DictionaryHashList();
     for (int i = 0; i < orders.Length; i++)
     {
         string value = orders[i].Id + '^' +
             VistaConstants.SS_ESIGNED + '^' +
             VistaConstants.RS_RELEASE + '^' +
             VistaConstants.NO_POLICY;
         lst.Add(Convert.ToString(i), value);
     }
     string rtn = (string)cxn.query(vq);
     string[] rex = StringUtils.split(rtn, StringUtils.CRLF);
     for (int i = 0; i < rex.Length; i++)
     {
         string[] flds = StringUtils.split(rex[i], StringUtils.CARET);
         if (orders[i].Id != flds[0])
         {
             orders[i].ErrMsg = "ID mismatch returning from send: expected " + orders[i].Id + ", found " + flds[0];
             continue;
         }
         if (flds[1] == "RS")
         {
             orders[i].Status = "Released";
         }
         else
         {
             orders[i].Status = "Error: " + flds[3];
         }
     }
 }
Exemple #32
0
 internal string list2string(DictionaryHashList lst)
 {
     if (lst == null || lst.Count == 0)
     {
         return StringUtils.LPack("", 3) + 'f';
     }
     string result = "";
     for (int i = 0; i < lst.Count; i++)
     {
         DictionaryEntry entry = lst[i];
         string key = (string)entry.Key;
         string value = (string)entry.Value;
         if (String.IsNullOrEmpty(value))
         {
             value = "\u0001";
         }
         result += StringUtils.LPack(key, 3) + StringUtils.LPack(value, 3) + 't';
     }
     result = result.Substring(0, result.Length - 1) + 'f';
     return result;
 }
Exemple #33
0
 internal MdoQuery buildCheckReleaseOrderRequest(Order order, string dfn)
 {
     VistaQuery vq = new VistaQuery("ORWDXC SESSION");
     vq.addParameter(vq.LITERAL, dfn);
     DictionaryHashList lst = new DictionaryHashList();
     lst.Add("1", order.Id + "^^1");
     vq.addParameter(vq.LIST, lst);
     return vq;
 }
Exemple #34
0
 public void addParameter(int type, DictionaryHashList lst)
 {
     Parameter vp = new Parameter(type,lst);
     parameters.Add(vp);
 }
Exemple #35
0
 internal MdoQuery buildSaveOrderRequest(
     string pid,
     string duz,
     string locationIEN,
     string dlgBaseName,
     OrderDialog dlg,
     string orderIEN,
     string startDate)
 {
     VistaQuery vq = new VistaQuery("ORWDX SAVE");
     vq.addParameter(vq.LITERAL, pid);
     vq.addParameter(vq.LITERAL, duz);
     vq.addParameter(vq.LITERAL, locationIEN);
     vq.addParameter(vq.LITERAL, dlgBaseName);
     vq.addParameter(vq.LITERAL, dlg.DisplayGrp);
     vq.addParameter(vq.LITERAL, orderIEN);
     vq.addParameter(vq.LITERAL, "");
     DictionaryHashList lst = new DictionaryHashList();
     OrderResponse[] responses = dlg.Responses;
     for (int i = 0; i < responses.Length; i++)
     {
         lst.Add(responses[i].Index, responses[i].Ivalue);
     }
     vq.addParameter(vq.LIST, lst);
     vq.addParameter(vq.LITERAL, "");
     vq.addParameter(vq.LITERAL, "");
     vq.addParameter(vq.LITERAL, "");
     vq.addParameter(vq.LITERAL, "0");
     return vq;
 }
Exemple #36
0
        internal MdoQuery buildRequest()
        {
            if (File == "")
            {
                throw new ArgumentNullException("Must have a file!");
            }
            VistaQuery         vq       = new VistaQuery("DDR LISTER");
            DictionaryHashList paramLst = new DictionaryHashList();

            paramLst.Add("\"FILE\"", File);
            if (Iens != "")
            {
                paramLst.Add("\"IENS\"", Iens);
            }
            if (_requestedFields.Length > 0)
            {
                paramLst.Add("\"FIELDS\"", getFieldsArg());
            }
            if (Flags != "")
            {
                paramLst.Add("\"FLAGS\"", Flags);
            }
            if (Max != "")
            {
                paramLst.Add("\"MAX\"", Max);
            }
            if (From != "")
            {
                paramLst.Add("\"FROM\"", From);
            }
            if (Part != "")
            {
                paramLst.Add("\"PART\"", Part);
            }
            if (Xref != "")
            {
                paramLst.Add("\"XREF\"", Xref);
            }
            if (Screen != "")
            {
                paramLst.Add("\"SCREEN\"", Screen);
            }
            if (Id != "")
            {
                paramLst.Add("\"ID\"", Id);
            }
            if (Options != "")
            {
                paramLst.Add("\"OPTIONS\"", Options);
            }
            if (moreFrom != "")
            {
                paramLst.Add("\"FROM\"", moreFrom);
            }
            if (moreIens != "")
            {
                paramLst.Add("\"IENS\"", moreIens);
            }
            vq.addParameter(vq.LIST, paramLst);
            return(vq);
        }
Exemple #37
0
 internal string checkReleaseOrder(Order order)
 {
     VistaQuery vq = new VistaQuery("ORWDXC SESSION");
     vq.addParameter(vq.LITERAL, cxn.Pid);
     DictionaryHashList lst = new DictionaryHashList();
     lst.Add("1", order.Id + "^^1");
     vq.addParameter(vq.LIST, lst);
     return (string)cxn.query(vq);
 }
Exemple #38
0
 internal MdoQuery buildGetAdHocHealthSummaryRequest(string DFN, string IEN, string title)
 {
     VistaQuery vq = new VistaQuery("ORWRP2 HS REPORT TEXT");
     DictionaryHashList lst = new DictionaryHashList();
     lst.Add("1", IEN + "^^^" + title + "^^^");
     vq.addParameter(vq.LIST, lst);
     vq.addParameter(vq.LITERAL, DFN);
     return vq;
 }