Inheritance: AbstractTaggedArrayTO
Example #1
0
 public TaggedPatientArrays(IndexedHashtable t)
 {
     if (t.Count == 0)
     {
         return;
     }
     if (t.Count == 1 && MdwsUtils.isException(t.GetValue(0)))
     {
         fault = new FaultTO((Exception)t.GetValue(0));
         return;
     }
     arrays = new TaggedPatientArray[t.Count];
     for (int i = 0; i < t.Count; i++)
     {
         if (t.GetValue(i) == null)
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i));
         }
         else if (MdwsUtils.isException(t.GetValue(i)))
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Exception)t.GetValue(i));
         }
         else if (t.GetValue(i).GetType().IsArray)
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient[])t.GetValue(i));
         }
         else
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient)t.GetValue(i));
         }
     }
     count = t.Count;
 }
 public TaggedPatientArrays(IndexedHashtable t)
 {
     if (t.Count == 0)
     {
         return;
     }
     if (t.Count == 1 && MdwsUtils.isException(t.GetValue(0)))
     {
         fault = new FaultTO((Exception)t.GetValue(0));
         return;
     }
     arrays = new TaggedPatientArray[t.Count];
     for (int i = 0; i < t.Count; i++)
     {
         if (t.GetValue(i) == null)
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i));
         }
         else if (MdwsUtils.isException(t.GetValue(i)))
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Exception)t.GetValue(i));
         }
         else if (t.GetValue(i).GetType().IsArray)
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient[])t.GetValue(i));
         }
         else
         {
             arrays[i] = new TaggedPatientArray((string)t.GetKey(i), (Patient)t.GetValue(i));
         }
     }
     count = t.Count;
 }
Example #3
0
        public TaggedPatientArrays getPatientsWithUpdatedChemHemReports(string username, string pwd, string fromDate)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();
            //if (String.IsNullOrEmpty(username) | String.IsNullOrEmpty(pwd) | String.IsNullOrEmpty(fromDate))
            //{
            //    result.fault = new FaultTO("Must supply all arguments");
            //}
            try
            {
                LabsApi api = new LabsApi();
                DataSource ds = new DataSource { ConnectionString = mySession.MdwsConfiguration.CdwConnectionString };
                AbstractConnection cxn = new gov.va.medora.mdo.dao.sql.cdw.CdwConnection(ds);
                Dictionary<string, HashSet<string>> dict = api.getUpdatedChemHemReports(cxn, DateTime.Parse(fromDate));
                result.arrays = new TaggedPatientArray[dict.Keys.Count];
                int arrayCount = 0;

                foreach (string key in dict.Keys)
                {
                    TaggedPatientArray tpa = new TaggedPatientArray(key);
                    tpa.patients = new PatientTO[dict[key].Count];
                    int patientCount = 0;
                    foreach (string patientICN in dict[key])
                    {
                        PatientTO p = new PatientTO { mpiPid = patientICN };
                        tpa.patients[patientCount] = p;
                        patientCount++;
                    }
                    result.arrays[arrayCount] = tpa;
                    arrayCount++;
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return result;
        }
Example #4
0
 public TaggedPatientArray match(string sitecode, string target)
 {
     TaggedPatientArray result = new TaggedPatientArray();
     if (!mySession.ConnectionSet.IsAuthorized)
     {
         result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
     }
     else if (sitecode == "")
     {
         result.fault = new FaultTO("Missing sitecode");
     }
     if (result.fault != null)
     {
         return result;
     }
     return match(mySession.ConnectionSet.getConnection(sitecode), target);
 }
Example #5
0
        public TaggedPatientArray getPatientsByWard(string sitecode, string wardId)
        {
            TaggedPatientArray result = new TaggedPatientArray();
            string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode);
            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (wardId == "")
            {
                result.fault = new FaultTO("Missing wardId");
            }
            if (result.fault != null)
            {
                return result;
            }

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

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                PatientApi patientApi = new PatientApi();
                Patient[] matches = patientApi.getPatientsByWard(cxn, wardId);
                result = new TaggedPatientArray(sitecode, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Example #6
0
        internal TaggedPatientArray matchByNameCityState(AbstractConnection cxn, string name, string city, string stateAbbr)
        {
            TaggedPatientArray result = new TaggedPatientArray();
            if (name == "")
            {
                result.fault = new FaultTO("Missing name");
            }
            else if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (stateAbbr == "")
            {
                result.fault = new FaultTO("Missing stateAbbr");
            }
            else if (!State.isValidAbbr(stateAbbr))
            {
                result.fault = new FaultTO("Invalid stateAbbr");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                PatientApi api = new PatientApi();
                Patient[] matches = api.matchByNameCityState(cxn, name, city, stateAbbr);
                result = new TaggedPatientArray(cxn.DataSource.SiteId.Id, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Example #7
0
        internal TaggedPatientArray match(AbstractConnection cxn, string target)
        {
            TaggedPatientArray result = new TaggedPatientArray();
            if (!cxn.IsConnected)
            {
                result = new TaggedPatientArray("Connection not open");
            }
            else if (cxn.DataSource.Uid == "")
            {
                result = new TaggedPatientArray("No user authorized for lookup");
            }
            else if (target == "")
            {
                result.fault = new FaultTO("Missing target");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                PatientApi patientApi = new PatientApi();
                Patient[] matches = patientApi.match(cxn, target);
                result = new TaggedPatientArray(cxn.DataSource.SiteId.Id, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }