Inheritance: AbstractArrayTO
Exemple #1
0
 public StateSites(State mdoState)
 {
     this.name = mdoState.Name;
     this.abbr = mdoState.Abbr;
     SortedList lst = new SortedList();
     foreach (DictionaryEntry de in mdoState.Sites)
     {
         Site s = (Site)de.Value;
         if (s.ChildSites != null)
         {
             for (int i = 0; i < s.ChildSites.Length; i++)
             {
                 lst.Add(s.ChildSites[i].Name, s.ChildSites[i]);
             }
         }
         Site clone = new Site();
         clone.Id = s.Id;
         clone.Name = s.Name;
         clone.State = s.State;
         clone.City = s.City;
         clone.DisplayName = s.DisplayName;
         clone.ParentSiteId = s.ParentSiteId;
         clone.RegionId = s.RegionId;
         lst.Add(clone.Name, clone);
     }
     this.sites = new SiteArray(lst);
 }
Exemple #2
0
 public SiteTO(Site mdoSite)
 {
     if (mdoSite == null)
     {
         return;
     }
     this.sitecode           = mdoSite.Id;
     this.name               = mdoSite.Name;
     this.displayName        = mdoSite.DisplayName;
     this.moniker            = mdoSite.Moniker;
     this.regionID           = mdoSite.RegionId;
     this.lastEventTimestamp = mdoSite.LastEventTimestamp;
     this.lastEventReason    = mdoSite.LastEventReason;
     if (mdoSite.Sources != null && mdoSite.Sources.Length != 0)
     {
         this.dataSources = new DataSourceArray(mdoSite.Sources);
     }
     this.parentSiteId = mdoSite.ParentSiteId;
     this.address      = mdoSite.Address;
     this.city         = mdoSite.City;
     this.state        = mdoSite.State;
     this.systemName   = mdoSite.SystemName;
     this.siteType     = mdoSite.SiteType;
     if (mdoSite.ChildSites != null && mdoSite.ChildSites.Length != 0)
     {
         this.childSites = new SiteArray(mdoSite.ChildSites);
     }
 }
Exemple #3
0
 public SiteTO(Site mdoSite)
 {
     if (mdoSite == null)
     {
         return;
     }
     this.sitecode = mdoSite.Id;
     this.name = mdoSite.Name;
     this.displayName = mdoSite.DisplayName;
     this.moniker = mdoSite.Moniker;
     this.regionID = mdoSite.RegionId;
     this.lastEventTimestamp = mdoSite.LastEventTimestamp;
     this.lastEventReason = mdoSite.LastEventReason;
     if (mdoSite.Sources != null && mdoSite.Sources.Length != 0)
     {
         this.dataSources = new DataSourceArray(mdoSite.Sources);
     }
     this.parentSiteId = mdoSite.ParentSiteId;
     this.address = mdoSite.Address;
     this.city = mdoSite.City;
     this.state = mdoSite.State;
     this.systemName = mdoSite.SystemName;
     this.siteType = mdoSite.SiteType;
     if (mdoSite.ChildSites != null && mdoSite.ChildSites.Length != 0)
     {
         this.childSites = new SiteArray(mdoSite.ChildSites);
     }
 }
Exemple #4
0
        public StateSites(State mdoState)
        {
            this.name = mdoState.Name;
            this.abbr = mdoState.Abbr;
            SortedList lst = new SortedList();

            foreach (DictionaryEntry de in mdoState.Sites)
            {
                Site s = (Site)de.Value;
                if (s.ChildSites != null)
                {
                    for (int i = 0; i < s.ChildSites.Length; i++)
                    {
                        lst.Add(s.ChildSites[i].Name, s.ChildSites[i]);
                    }
                }
                Site clone = new Site();
                clone.Id           = s.Id;
                clone.Name         = s.Name;
                clone.State        = s.State;
                clone.City         = s.City;
                clone.DisplayName  = s.DisplayName;
                clone.ParentSiteId = s.ParentSiteId;
                clone.RegionId     = s.RegionId;
                lst.Add(clone.Name, clone);
            }
            this.sites = new SiteArray(lst);
        }
Exemple #5
0
 public StateTO(State mdoState)
 {
     this.name = mdoState.Name;
     this.abbr = mdoState.Abbr;
     this.fips = mdoState.Fips;
     if (mdoState.Sites != null)
     {
         for (int i = 0; i < mdoState.Sites.Count; i++)
         {
             this.sites = new SiteArray(mdoState.Sites);
         }
     }
     if (mdoState.Cities != null)
     {
         for (int i = 0; i < mdoState.Cities.Count; i++)
         {
             this.cities = new CityArray(mdoState.Cities);
         }
     }
 }
Exemple #6
0
 public StateTO(State mdoState)
 {
     this.name = mdoState.Name;
     this.abbr = mdoState.Abbr;
     this.fips = mdoState.Fips;
     if (mdoState.Sites != null)
     {
         for (int i = 0; i < mdoState.Sites.Count; i++)
         {
             this.sites = new SiteArray(mdoState.Sites);
         }
     }
     if (mdoState.Cities != null)
     {
         for (int i = 0; i < mdoState.Cities.Count; i++)
         {
             this.cities = new CityArray(mdoState.Cities);
         }
     }
 }
Exemple #7
0
        /// <summary>
        /// After selecting a patient at one site, make subsequent queries multi-site.
        /// </summary>
        /// <remarks>
        /// This function will detect and visit all the other sites at which the patient 
        /// has been seen. Subsequent queries, then, will return data from all these sources.
        /// This method requires a previous login or visit to have set the credentials in
        /// mySession, as well as a previous patient select to have set the patient in 
        /// mySession.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="context">If blank defaults to CPRS context</param>
        /// <returns>SiteArray: the sources subsequent queries will read from</returns>
        public SiteArray setupMultiSourcePatientQuery(string pwd, string context)
        {
            SiteArray result = new SiteArray();

            //Make sure we have all the args we need
            if (mySession == null || mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No site table");
            }
            else if (mySession.Patient == null)
            {
                result.fault = new FaultTO("No patient", "Need to select a patient?");
            }
            else if (String.IsNullOrEmpty(mySession.Patient.MpiPid))
            {
                result.fault = new FaultTO("Patient has no ICN", "Need to select the patient?");
            }
            else if (mySession.Patient.SiteIDs == null || mySession.Patient.SiteIDs.Length == 0)
            {
                result.fault = new FaultTO("Patient has no sites", "Need to select the patient?");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (String.IsNullOrEmpty(context))
            {
                context = mySession.DefaultPermissionString;
            }

            try
            {
                Site[] sites = mySession.SiteTable.getSites(mySession.Patient.SiteIDs);
                List<DataSource> sources = new List<DataSource>(sites.Length);
                for (int i = 0; i < sites.Length; i++)
                {
                    if (sites[i] == null)
                    {
                        continue;
                    }
                    DataSource src = sites[i].getDataSourceByModality("HIS");
                    if (src != null)
                    {
                        sources.Add(src);
                    }
                }

                TaggedTextArray tta = setupMultiSourceQuery(pwd, sources, context);

                PatientApi patientApi = new PatientApi();
                IndexedHashtable t = patientApi.setLocalPids(mySession.ConnectionSet, mySession.Patient.MpiPid);

                // we need to check confidentiality everywhere and issue bulletin if found at any site
                IndexedHashtable confidentialResults = patientApi.getConfidentiality(mySession.ConnectionSet);
                if (confidentialResults != null && confidentialResults.Count > 0)
                {
                    KeyValuePair<int, string> highestConfidentialityResult = new KeyValuePair<int,string>(0, "");
                    for (int i = 0; i < confidentialResults.Count; i++)
                    {
                        KeyValuePair<int, string> siteResult = (KeyValuePair<int, string>)confidentialResults.GetValue(i);
                        if (siteResult.Key > highestConfidentialityResult.Key)
                        {
                            highestConfidentialityResult = siteResult;
                        }
                    }
                    if (highestConfidentialityResult.Key == 1)
                    {
                        // do nothing here - M code takes care of this per documentation
                    }
                    else if (highestConfidentialityResult.Key == 2)
                    {
                        patientApi.issueConfidentialityBulletin(mySession.ConnectionSet);
                    }
                    else if (highestConfidentialityResult.Key > 2)
                    {
                        // catch block below takes care of disconnecting all sites
                        throw new ApplicationException(highestConfidentialityResult.Value);
                    }
                }
                // end confidentiality
                result = new SiteArray(sites);
                for (int i = 0; i < result.sites.Length; i++)
                {
                    if (mySession.ConnectionSet.ExcludeSite200 && result.sites[i].sitecode == "200")
                    {
                        result.sites[i].fault = new FaultTO("Site excluded");
                    }
                    else if (t.ContainsKey(result.sites[i].sitecode))
                    {
                        // TBD: fault in t?
                        result.sites[i].pid = (string)t.GetValue(result.sites[i].sitecode);
                    }
                }
                // copy faults over if any found
                foreach (TaggedText tt in tta.results)
                {
                    if (tt.fault != null)
                    {
                        foreach (SiteTO s in result.sites)
                        {
                            if (String.Equals(s.sitecode, tt.tag))
                            {
                                s.fault = tt.fault;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                result = new SiteArray();
                result.fault = new FaultTO(e.Message);
                mySession.ConnectionSet.disconnectAll();
            }
            return result;
        }
Exemple #8
0
        /// <summary>
        /// patientVisit
        /// This method is used by MHV and will probably be used by other PHR apps.
        /// </summary>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="homeSitecode">Station number</param>
        /// <param name="mpiPid">ICN</param>
        /// <param name="multiSite">Set to false for now</param>
        /// <returns>SiteArray: Nothing really in it though, except error messages</returns>
        public SiteArray patientVisit(string pwd, string homeSitecode, string mpiPid, bool multiSite)
        {
            SiteArray result = new SiteArray();

            //Make sure we have all the args we need
            if (mySession == null || mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No session has been started");
            }
            else if (String.IsNullOrEmpty(homeSitecode))
            {
                result.fault = new FaultTO("No homeSitecode");
            }
            else if (mySession.SiteTable.getSite(homeSitecode) == null)
            {
                result.fault = new FaultTO("No site " + homeSitecode + " in the site table");
            }
            else if (mySession.ConnectionSet != null &&
                     mySession.ConnectionSet.Count > 0 &&
                     mySession.ConnectionSet.HasConnection(homeSitecode))
            {
                result.fault = new FaultTO("Site " + homeSitecode + " already connected");
            }
            else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0)
            {
                result.fault = new FaultTO("This session has pre-existing connections and this method should be the base connection.", "Do a disconnect?");
            }
            else if (mpiPid == "")
            {
                result.fault = new FaultTO("No MPI PID");
            }
            if (result.fault != null)
            {
                return result;
            }

            Site homeSite = mySession.SiteTable.getSite(homeSitecode);
            mySession.Credentials = getAdministrativeCredentials(homeSite);

            mySession.Credentials.SecurityPhrase = pwd;

            string context = MdwsConstants.MDWS_CONTEXT;
            if (mySession.DefaultVisitMethod == MdwsConstants.NON_BSE_CREDENTIALS)
            {
                context = MdwsConstants.CPRS_CONTEXT;
            }
            mySession.PrimaryPermission = new MenuOption(context);

            try
            {
                mySession.User = doTheVisit(homeSitecode, mySession.Credentials, mySession.PrimaryPermission);

                PatientApi patientApi = new PatientApi();
                string localPid = patientApi.getLocalPid(myCxn, mpiPid);
                if (localPid == "")
                {
                    myCxn.disconnect();
                    result.fault = new FaultTO("No such patient at this site");
                    return result;
                }
                mySession.Patient = patientApi.select(myCxn, localPid);
                addMyCxn2CxnSet();
            }
            catch (Exception e)
            {
                myCxn.disconnect();
                result.fault = new FaultTO(e.Message);
                return result;
            }
            return result;
        }
Exemple #9
0
        public SiteArray getSitesForCounty(string fips)
        {
            SiteArray result = new SiteArray();
            if (fips == "")
            {
                result.fault = new FaultTO("Missing fips");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                SitesApi api = new SitesApi();
                Site[] sites = api.getClosestFacilities(fips, mySession.MdwsConfiguration.SqlConnectionString);
                result = new SiteArray(sites);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Exemple #10
0
 public SiteArray getConnectedSites()
 {
     if (mySession.ConnectionSet == null || mySession.ConnectionSet.Count == 0)
     {
         return null;
     }
     SiteArray result = new SiteArray();
     result.sites = new SiteTO[mySession.ConnectionSet.Count];
     result.count = mySession.ConnectionSet.Count;
     int i = 0;
     foreach (KeyValuePair<string, gov.va.medora.mdo.dao.AbstractConnection> cxn in mySession.ConnectionSet.Connections)
     {
         result.sites[i] = new SiteTO();
         result.sites[i].displayName = cxn.Value.DataSource.SiteId.Name;
         i++;
     }
     return result;
 }
Exemple #11
0
 public RegionTO(Region mdoRegion)
 {
     this.name = mdoRegion.Name;
     this.id = Convert.ToString(mdoRegion.Id);
     this.sites = new SiteArray(mdoRegion.Sites);
 }
Exemple #12
0
 public RegionTO(Region mdoRegion)
 {
     this.name  = mdoRegion.Name;
     this.id    = Convert.ToString(mdoRegion.Id);
     this.sites = new SiteArray(mdoRegion.Sites);
 }
Exemple #13
0
        public SiteArray getSiteDivisions(string sitecode)
        {
            SiteArray result = new SiteArray();
            if (sitecode == "")
            {
                result.fault = new FaultTO("Missing sitecode");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                EncounterApi api = new EncounterApi();
                Site[] sites = api.getSiteDivisions(mySession.ConnectionSet.getConnection(sitecode), sitecode);
                result = new SiteArray(sites);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Exemple #14
0
 public CityTO(City mdo)
 {
     this.name  = mdo.Name;
     this.state = mdo.State;
     this.sites = new SiteArray(mdo.Sites);
 }
Exemple #15
0
 public CityTO(City mdo)
 {
     this.name = mdo.Name;
     this.state = mdo.State;
     this.sites = new SiteArray(mdo.Sites);
 }
Exemple #16
0
 /// <summary>
 /// Allow a client application to specifiy their sites file by name
 /// </summary>
 /// <param name="sitesFileName">The name of the sites file</param>
 /// <returns>SiteArray of parsed sites file</returns>
 public SiteArray setSites(string sitesFileName)
 {
     SiteArray result = new SiteArray();
     try
     {
         _siteTable = new mdo.SiteTable(_mdwsConfig.ResourcesPath + "xml\\" + sitesFileName);
         _mdwsConfig.FacadeConfiguration.SitesFileName = sitesFileName;
         watchSitesFile(_mdwsConfig.ResourcesPath + "xml\\");
         result = new SiteArray(_siteTable.Sites);
     }
     catch (Exception)
     {
         result.fault = new FaultTO("A sites file with that name does not exist on the server!");
     }
     return result;
 }
Exemple #17
0
        public PatientTO(Patient mdo)
        {
            if (mdo == null)
            {
                return;
            }
            this.name        = this.patientName = mdo.Name == null ? "" : mdo.Name.getLastNameFirst();
            this.ssn         = mdo.SSN == null ? "" : mdo.SSN.toString();
            this.dob         = mdo.DOB;
            this.gender      = mdo.Gender;
            this.mpiPid      = mdo.MpiPid;
            this.mpiChecksum = mdo.MpiChecksum;
            this.localPid    = mdo.LocalPid;
            this.sitePids    = mdo.SitePids == null || mdo.SitePids.Count == 0 ? null : new TaggedTextArray(mdo.SitePids);
            this.vendorPid   = mdo.VendorPid;
            this.location    = new HospitalLocationTO(mdo.Location);
            this.age         = mdo.Age;
            this.cwad        = mdo.Cwad;
            this.restricted  = mdo.IsRestricted;
            //this.admitTimestamp = mdo.AdmitTimestamp.Year == 1 ? "" : mdo.AdmitTimestamp.ToString("yyyyMMdd.HHmmss");
            this.admitTimestamp   = mdo.AdmitTimestamp;
            this.serviceConnected = mdo.IsServiceConnected;
            this.scPercent        = mdo.ScPercent;
            this.inpatient        = mdo.IsInpatient;
            //this.deceasedDate = mdo.DeceasedDate.Year == 1 ? "" : mdo.DeceasedDate.ToString("yyyyMMdd.HHmmss");
            this.deceasedDate            = mdo.DeceasedDate;
            this.confidentiality         = new TaggedText(mdo.Confidentiality);
            this.needsMeansTest          = mdo.NeedsMeansTest;
            this.cmorSiteId              = mdo.CmorSiteId;
            this.activeInsurance         = mdo.ActiveInsurance;
            this.isTestPatient           = mdo.IsTestPatient;
            this.maritalStatus           = mdo.MaritalStatus;
            this.ethnicity               = mdo.Ethnicity;
            this.currentMeansStatus      = mdo.CurrentMeansStatus;
            this.hasInsurance            = mdo.HasInsurance;
            this.preferredFacility       = new TaggedText(mdo.PreferredFacility);
            this.patientType             = mdo.PatientType;
            this.isVeteran               = mdo.IsVeteran;
            this.patientFlags            = new TaggedTextArray(mdo.PatientFlags);
            this.isLocallyAssignedMpiPid = mdo.IsLocallyAssignedMpiPid;
            if (mdo.HomeAddress != null)
            {
                this.homeAddress = new AddressTO(mdo.HomeAddress);
            }
            if (mdo.HomePhone != null)
            {
                this.homePhone = new PhoneNumTO(mdo.HomePhone);
            }
            if (mdo.CellPhone != null)
            {
                this.cellPhone = new PhoneNumTO(mdo.CellPhone);
            }
            if (mdo.SiteIDs != null)
            {
                Site[] a = new Site[mdo.SiteIDs.Length];
                for (int i = 0; i < mdo.SiteIDs.Length; i++)
                {
                    a[i] = new Site(mdo.SiteIDs[i].Id, mdo.SiteIDs[i].Name);
                    a[i].LastEventTimestamp = mdo.SiteIDs[i].LastSeenDate;
                    a[i].LastEventReason    = mdo.SiteIDs[i].LastEvent;
                }
                this.sites = new SiteArray(a);
            }
            if (mdo.Team != null)
            {
                this.team = new TeamTO(mdo.Team);
            }

            if (mdo.Demographics != null && mdo.Demographics.Count > 0)
            {
                this.demographics = new DemographicSetTO[mdo.Demographics.Count];
                string[] keys = new string[mdo.Demographics.Count];
                mdo.Demographics.Keys.CopyTo(keys, 0);
                for (int i = 0; i < mdo.Demographics.Count; i++)
                {
                    this.demographics[i] = new DemographicSetTO(keys[i], mdo.Demographics[keys[i]]);
                }
            }
        }
Exemple #18
0
        public PatientTO(Patient mdo)
        {
            if (mdo == null)
            {
                return;
            }
            this.name = this.patientName = mdo.Name == null ? "" : mdo.Name.getLastNameFirst();
            this.ssn = mdo.SSN == null ? "" : mdo.SSN.toString();
            this.dob = mdo.DOB;
            this.gender = mdo.Gender;
            this.mpiPid = mdo.MpiPid;
            this.mpiChecksum = mdo.MpiChecksum;
            this.localPid = mdo.LocalPid;
            this.sitePids = mdo.SitePids == null || mdo.SitePids.Count == 0 ? null : new TaggedTextArray(mdo.SitePids);
            this.vendorPid = mdo.VendorPid;
            this.location = new HospitalLocationTO(mdo.Location);
            this.age = mdo.Age;
            this.cwad = mdo.Cwad;
            this.restricted = mdo.IsRestricted;
            //this.admitTimestamp = mdo.AdmitTimestamp.Year == 1 ? "" : mdo.AdmitTimestamp.ToString("yyyyMMdd.HHmmss");
            this.admitTimestamp = mdo.AdmitTimestamp;
            this.serviceConnected = mdo.IsServiceConnected;
            this.scPercent = mdo.ScPercent;
            this.inpatient = mdo.IsInpatient;
            //this.deceasedDate = mdo.DeceasedDate.Year == 1 ? "" : mdo.DeceasedDate.ToString("yyyyMMdd.HHmmss");
            this.deceasedDate = mdo.DeceasedDate;
            this.confidentiality = new TaggedText(mdo.Confidentiality);
            this.needsMeansTest = mdo.NeedsMeansTest;
            this.cmorSiteId = mdo.CmorSiteId;
            this.activeInsurance = mdo.ActiveInsurance;
            this.isTestPatient = mdo.IsTestPatient;
            this.maritalStatus = mdo.MaritalStatus;
            this.ethnicity = mdo.Ethnicity;
            this.currentMeansStatus = mdo.CurrentMeansStatus;
            this.hasInsurance = mdo.HasInsurance;
            this.preferredFacility = new TaggedText(mdo.PreferredFacility);
            this.patientType = mdo.PatientType;
            this.isVeteran = mdo.IsVeteran;
            this.patientFlags = new TaggedTextArray(mdo.PatientFlags);
            this.isLocallyAssignedMpiPid = mdo.IsLocallyAssignedMpiPid;
            if (mdo.HomeAddress != null)
            {
                this.homeAddress = new AddressTO(mdo.HomeAddress);
            }
            if (mdo.HomePhone != null)
            {
                this.homePhone = new PhoneNumTO(mdo.HomePhone);
            }
            if (mdo.CellPhone != null)
            {
                this.cellPhone = new PhoneNumTO(mdo.CellPhone);
            }
            if (mdo.SiteIDs != null)
            {
                Site[] a = new Site[mdo.SiteIDs.Length];
                for (int i = 0; i < mdo.SiteIDs.Length; i++)
                {
                    a[i] = new Site(mdo.SiteIDs[i].Id, mdo.SiteIDs[i].Name);
                    a[i].LastEventTimestamp = mdo.SiteIDs[i].LastSeenDate;
                    a[i].LastEventReason = mdo.SiteIDs[i].LastEvent;
                }
                this.sites = new SiteArray(a);
            }
            if (mdo.Team != null)
            {
                this.team = new TeamTO(mdo.Team);
            }

            if (mdo.Demographics != null && mdo.Demographics.Count > 0)
            {
                this.demographics = new DemographicSetTO[mdo.Demographics.Count];
                string[] keys = new string[mdo.Demographics.Count];
                mdo.Demographics.Keys.CopyTo(keys, 0);
                for (int i = 0; i < mdo.Demographics.Count; i++)
                {
                    this.demographics[i] = new DemographicSetTO(keys[i], mdo.Demographics[keys[i]]);
                }
            }
        }