Ejemplo n.º 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);
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 3
0
 private void setProps(Site[] mdoSites)
 {
     if (mdoSites == null)
     {
         return;
     }
     ArrayList al = new ArrayList(mdoSites.Length);
     for (int i = 0; i < mdoSites.Length; i++)
     {
         if (mdoSites[i] != null)
         {
             al.Add(new SiteTO(mdoSites[i]));
         }
     }
     sites = (SiteTO[])al.ToArray(typeof(SiteTO));
     count = sites.Length;
 }
Ejemplo n.º 4
0
 public SiteArray(Site[] mdoSites)
 {
     setProps(mdoSites);
 }
Ejemplo n.º 5
0
 internal AbstractCredentials getAdministrativeCredentials(Site site)
 {
     AbstractCredentials credentials = new VistaCredentials();
     credentials.LocalUid = VistaAccount.getAdminLocalUid(site.Id);
     credentials.FederatedUid = mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_FED_UID];
     credentials.SubjectName = mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_NAME];
     credentials.SubjectPhone = "";
     credentials.AuthenticationSource = site.getDataSourceByModality("HIS");
     credentials.AuthenticationToken = site.Id + '_' + credentials.LocalUid;
     return credentials;
 }
Ejemplo n.º 6
0
        public SiteTO addSite(string id, string name, string datasource, string port, string modality, string protocol, string region)
        {
            SiteTO result = new SiteTO();
            Site site = new Site();
            DataSource source = new DataSource();
            int iPort = 0;
            int iRegion = 0;

            if (!mySession.MdwsConfiguration.IsProduction)
            {
                result.fault = new FaultTO("You may not add data sources to non-production MDWS installations");
            }
            else if (String.IsNullOrEmpty(id) || String.IsNullOrEmpty(name) || String.IsNullOrEmpty(datasource) ||
                String.IsNullOrEmpty(port) || String.IsNullOrEmpty(modality) || String.IsNullOrEmpty(protocol) ||
                String.IsNullOrEmpty(region))
            {
                result.fault = new FaultTO("Must supply all parameters");
            }
            else if (mySession.SiteTable.Sites.ContainsKey(id))
            {
                result.fault = new FaultTO("That site id is in use", "Choose a different site id");
            }
            else if (!Int32.TryParse(port, out iPort))
            {
                result.fault = new FaultTO("Non-numeric port", "Provide a numeric value for the port");
            }
            else if (!Int32.TryParse(region, out iRegion))
            {
                result.fault = new FaultTO("Non-numeric region", "Provide a numeric value for the region");
            }
            else if (modality != "HIS")
            {
                result.fault = new FaultTO("Only HIS modality currently supported", "Use 'HIS' as your modality");
            }
            else if (protocol != "VISTA")
            {
                result.fault = new FaultTO("Only VISTA protocol currently supported", "Use 'VISTA' as your protocol");
            }

            if(result.fault != null)
            {
                return result;
            }

            source.Port = iPort;
            source.Modality = modality;
            source.Protocol = protocol;
            source.Provider = datasource;
            source.SiteId = new SiteId(id, name);

            site.Sources = new DataSource[1];
            site.Sources[0] = source;
            site.RegionId = region;
            site.Name = name;
            site.Id = id;

            if(!mySession.SiteTable.Regions.ContainsKey(iRegion))
            {
                Region r = new Region();
                r.Id = iRegion;
                r.Name = "Region " + region;
                r.Sites = new ArrayList();
                mySession.SiteTable.Regions.Add(iRegion, r);
            }
            ((Region)mySession.SiteTable.Regions[iRegion]).Sites.Add(site);
            mySession.SiteTable.Sites.Add(id, site);
            mySession.SiteTable.Sources.Add(site.Sources[0]);
            result = new SiteTO(site);
            return result;
        }
Ejemplo n.º 7
0
 //public static DataSource[] getHisSources(Site[] sites)
 //{
 //    Dictionary<String, DataSource> lst = buildHisList(sites);
 //    DataSource[] result = new DataSource[lst.Count];
 //    lst.Values.CopyTo(result, 0);
 //    return result;
 //}
 //public static DataSource[] getHisSources(Connection localCxn, Site[] sites)
 //{
 //    Dictionary<String, DataSource> lst = buildHisList(sites);
 //    if (!lst.ContainsKey(localCxn.DataSource.SiteId.Id))
 //    {
 //        lst.Add(localCxn.DataSource.SiteId.Id, localCxn.DataSource);
 //    }
 //    DataSource[] result = new DataSource[lst.Count];
 //    lst.Values.CopyTo(result, 0);
 //    return result;
 //}
 private static Dictionary<String, DataSource> buildHisList(Site[] sites)
 {
     Dictionary<String, DataSource> lst = new Dictionary<String, DataSource>(sites.Length);
     for (int i = 0; i < sites.Length; i++)
     {
         DataSource src = sites[i].getDataSourceByModality("HIS");
         if (src != null && !lst.ContainsKey(sites[i].Id))
         {
             lst.Add(sites[i].Id, src);
         }
     }
     return lst;
 }
Ejemplo n.º 8
0
        private void parse(String filepath)
        {
            if (String.IsNullOrEmpty(filepath))
            {
                throw new ArgumentNullException("No source for site table");
            }

            Region currentRegion = null;
            ArrayList currentSites = null;
            Site currentSite = null;
            DataSource dataSource = null;
            ArrayList currentSources = null;
            #if DEBUG
            string currentDirStr = Directory.GetCurrentDirectory();
            #endif

            XmlReader reader = null;
            try
            {
                reader = new XmlTextReader(filepath);
                while (reader.Read())
                {
                    switch ((int)reader.NodeType)
                    {
                        case (int)XmlNodeType.Element:
                            String name = reader.Name;
                            if (name == "VhaVisn")
                            {
                                currentRegion = new Region();
                                currentRegion.Id = Convert.ToInt32(reader.GetAttribute("ID"));
                                currentRegion.Name = reader.GetAttribute("name");
                                currentSites = new ArrayList();
                            }
                            else if (name == "VhaSite")
                            {
                                currentSite = new Site();
                                currentSite.Id = reader.GetAttribute("ID");
                                currentSite.Name = reader.GetAttribute("name");
                                String displayName = reader.GetAttribute("displayname");
                                if (displayName == null)
                                {
                                    displayName = currentSite.Name;
                                }
                                currentSite.DisplayName = displayName;
                                currentSite.Moniker = reader.GetAttribute("moniker");
                                currentSite.RegionId = Convert.ToString(currentRegion.Id);
                                currentSources = new ArrayList();
                                currentSites.Add(currentSite);
                            }
                            else if (name == "DataSource")
                            {
                                dataSource = new DataSource();
                                KeyValuePair<string, string> kvp =
                                    new KeyValuePair<string, string>(currentSite.Id, currentSite.Name);
                                dataSource.SiteId = new SiteId(kvp.Key, kvp.Value);
                                dataSource.Modality = reader.GetAttribute("modality");
                                dataSource.Protocol = reader.GetAttribute("protocol");
                                dataSource.Provider = reader.GetAttribute("source");
                                dataSource.Status = reader.GetAttribute("status");
                                String sTmp = reader.GetAttribute("port");
                                if (String.IsNullOrEmpty(sTmp)) // StringUtils.isEmpty(sTmp))
                                {
                                    if (String.Equals(dataSource.Protocol, "VISTA", StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        dataSource.Port = 9200;
                                    }
                                    else if (String.Equals(dataSource.Protocol, "HL7", StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        dataSource.Port = 5000;
                                    }
                                }
                                else
                                {
                                    dataSource.Port = Convert.ToInt32(sTmp);
                                }
                                sTmp = reader.GetAttribute("provider");
                                if (sTmp != null)
                                {
                                    dataSource.Provider = sTmp;
                                }
                                sTmp = reader.GetAttribute("description");
                                if (sTmp != null)
                                {
                                    dataSource.Description = sTmp;
                                }
                                sTmp = reader.GetAttribute("vendor");
                                if (sTmp != null)
                                {
                                    dataSource.Vendor = sTmp;
                                }
                                sTmp = reader.GetAttribute("version");
                                if (sTmp != null)
                                {
                                    dataSource.Version = sTmp;
                                }
                                sTmp = reader.GetAttribute("context");
                                if (sTmp != null)
                                {
                                    dataSource.Context = sTmp;
                                }
                                sTmp = reader.GetAttribute("connectionString");
                                if (!String.IsNullOrEmpty(sTmp))
                                {
                                    dataSource.ConnectionString = sTmp;
                                }

                                currentSources.Add(dataSource);
                                sources.Add(dataSource);
                            }
                            break;
                        case (int)XmlNodeType.EndElement:
                            name = reader.Name;
                            if (name == "VhaVisn")
                            {
                                currentRegion.Sites = currentSites;
                                regions.Add(currentRegion.Id, currentRegion);
                            }
                            else if (name == "VhaSite")
                            {
                                currentSite.Sources = (DataSource[])currentSources.ToArray(typeof(DataSource));
                                sites.Add(currentSite.Id, currentSite);
                            }
                            break;
                    }
                }
            }
            catch (Exception) { /* do nothing */ }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Ejemplo n.º 9
0
        public void parseStateFile(string filepath)
        {
            if (String.IsNullOrEmpty(filepath))
            {
                throw new ArgumentNullException("No source for state file");
            }

            states = new SortedList();

            State currentState = null;
            SortedList currentSites = null;
            Site currentSite = null;
            ArrayList currentClinics = null;
            Site currentClinic = null;

            XmlReader reader = null;

            try
            {
                reader = new XmlTextReader(filepath);
                while (reader.Read())
                {
                    switch ((int)reader.NodeType)
                    {
                        case (int)XmlNodeType.Element:
                            String name = reader.Name;
                            if (name == "state")
                            {
                                currentState = new State();
                                currentState.Name = reader.GetAttribute("name");
                                currentState.Abbr = reader.GetAttribute("abbr");
                                currentSites = new SortedList();
                            }
                            else if (name == "vamc")
                            {
                                currentSite = new Site();
                                currentSite.Id = reader.GetAttribute("sitecode");
                                currentSite.Name = reader.GetAttribute("name");
                                currentSite.City = reader.GetAttribute("city");
                                currentSite.SystemName = reader.GetAttribute("system");
                                currentSites.Add(currentSite.Name, currentSite);
                                currentClinics = new ArrayList();
                            }
                            else if (name == "clinic")
                            {
                                currentClinic = new Site();
                                currentClinic.Name = reader.GetAttribute("name");
                                currentClinic.City = reader.GetAttribute("city");
                                currentClinic.State = reader.GetAttribute("state");
                                //if (StringUtils.isEmpty(currentClinic.State))
                                if (String.IsNullOrEmpty(currentClinic.State))
                                {
                                    currentClinic.State = currentState.Abbr;
                                }
                                currentClinic.ParentSiteId = currentSite.Id;
                                currentClinics.Add(currentClinic);
                            }
                            break;
                        case (int)XmlNodeType.EndElement:
                            name = reader.Name;
                            if (name == "state")
                            {
                                currentState.Sites = currentSites;
                                states.Add(currentState.Name, currentState);
                            }
                            else if (name == "vamc")
                            {
                                currentSite.ChildSites = (Site[])currentClinics.ToArray(typeof(Site));
                            }
                            else if (name == "clinic")
                            {
                            }
                            break;
                    }
                }
            }
            catch (Exception) { /* do nothing */ }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Ejemplo n.º 10
0
        public void parseStateCityFile(string filepath)
        {
            if (String.IsNullOrEmpty(filepath))
            {
                throw new ArgumentNullException("No source for state/city file");
            }

            states = new SortedList();

            State currentState = null;
            SortedList currentCities = null;
            City currentCity = null;
            ArrayList currentSites = null;
            Site currentSite = null;

            XmlReader reader = null;
            try
            {
                reader = new XmlTextReader(filepath);
                while (reader.Read())
                {
                    switch ((int)reader.NodeType)
                    {
                        case (int)XmlNodeType.Element:
                            String name = reader.Name;
                            if (name == "state")
                            {
                                currentState = new State();
                                currentState.Name = reader.GetAttribute("name");
                                currentState.Abbr = reader.GetAttribute("abbr");
                                currentCities = new SortedList();
                            }
                            else if (name == "city")
                            {
                                currentCity = new City();
                                currentCity.Name = reader.GetAttribute("name");
                                currentCity.State = currentState.Abbr;
                                currentCities.Add(currentCity.Name, currentCity);
                                currentSites = new ArrayList();
                            }
                            else if (name == "site")
                            {
                                currentSite = new Site();
                                currentSite.Name = reader.GetAttribute("name");
                                currentSite.City = currentCity.Name;
                                currentSite.State = currentState.Abbr;
                                currentSite.Id = reader.GetAttribute("sitecode");
                                currentSite.SiteType = reader.GetAttribute("type");
                                currentSites.Add(currentSite);
                            }
                            break;
                        case (int)XmlNodeType.EndElement:
                            name = reader.Name;
                            if (name == "state")
                            {
                                currentState.Cities = currentCities;
                                states.Add(currentState.Name, currentState);
                            }
                            else if (name == "city")
                            {
                                currentCity.Sites = (Site[])currentSites.ToArray(typeof(Site));
                            }
                            else if (name == "site")
                            {
                            }
                            break;
                    }
                }
            }
            catch (Exception) { /* do nothing */ }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Ejemplo n.º 11
0
 public Site[] getSites(SiteId[] siteIds)
 {
     if (siteIds == null || siteIds.Length == 0)
     {
         return null;
     }
     Site[] sites = new Site[siteIds.Length];
     for (int i = 0; i < siteIds.Length; i++)
     {
         sites[i] = getSite(siteIds[i].Id);
     }
     return sites;
 }
Ejemplo n.º 12
0
 public Site[] getSites(string sitelist)
 {
     string[] sitecodes = StringUtils.split(sitelist, StringUtils.COMMA);
     sitecodes = StringUtils.trimArray(sitecodes);
     if (sitecodes.Length == 0)
     {
         return null;
     }
     Site[] sites = new Site[sitecodes.Length];
     for (int i = 0; i < sitecodes.Length; i++)
     {
         sites[i] = getSite(sitecodes[i]);
     }
     return sites;
 }
Ejemplo n.º 13
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]]);
                }
            }
        }