コード例 #1
0
 public void addConnections(DataSource[] sources)
 {
     for (int i = 0; i < sources.Length; i++)
     {
         if (cxnTable.ContainsKey(sources[i].SiteId.Key))
         {
             continue;
         }
         int        protocol   = DaoFactory.getConstant(sources[i].Protocol);
         DaoFactory daoFactory = DaoFactory.getDaoFactory(protocol);
         cxnTable.Add(sources[i].SiteId.Key, daoFactory.getConnection(sources[i]));
     }
 }
コード例 #2
0
 public void addConnection(Connection cxn)
 {
     if (cxnTbl == null)
     {
         cxnTbl        = new IndexedHashtable();
         this.modality = cxn.DataSource.Modality;
     }
     checkModality(cxn);
     if (!cxnTbl.ContainsKey(cxn.DataSource.SiteId.Id))
     {
         cxnTbl.Add(cxn.SiteId.Key, cxn);
     }
 }
コード例 #3
0
        public ZipcodeTO[] getCitiesInState(string stateAbbr)
        {
            gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao =
                new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString);
            ZipcodeTO[] result = new ZipcodeTO[1];
            result[0] = new ZipcodeTO();

            if (String.IsNullOrEmpty(stateAbbr))
            {
                result[0].fault = new FaultTO("Missing state abbreviation");
            }
            else if (stateAbbr.Length != 2)
            {
                result[0].fault = new FaultTO("Invalid state abbreviation", "Please supply a valid 2 letter abbreviation");
            }
            if (result[0].fault != null)
            {
                return(result);
            }

            try
            {
                Zipcode[] zips = dao.getCitiesInState(stateAbbr);

                IndexedHashtable t = new IndexedHashtable();
                for (int i = 0; i < zips.Length; i++)
                {
                    if (!t.ContainsKey(zips[i].City))
                    {
                        t.Add(zips[i].City, zips[i]);
                    }
                }
                result = new ZipcodeTO[t.Count];
                for (int i = 0; i < t.Count; i++)
                {
                    result[i] = new ZipcodeTO((Zipcode)t.GetValue(i));
                }
            }
            catch (Exception exc)
            {
                result[0].fault = new FaultTO(exc);
            }
            return(result);
        }
コード例 #4
0
ファイル: AccountLib.cs プロジェクト: monkeyglasses/mdws
        /// <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);
        }
コード例 #5
0
ファイル: VistaEncounterDao.cs プロジェクト: OSEHRA/mdo
 internal IndexedHashtable toUniqueCheckinIds(string[] response)
 {
     if (response == null || response.Length == 0)
     {
         return null;
     }
     IndexedHashtable t = new IndexedHashtable(response.Length);
     for (int i = 0; i < response.Length; i++)
     {
         if (String.IsNullOrEmpty(response[i]))
         {
             continue; // per http://trac.medora.va.gov/web/ticket/2713 - found a blank record in a test site. can't do anything with stay since can't locate checkin id 
         }
         if (t.ContainsKey(response[i]))
         {
             continue;
         }
         t.Add(response[i], null);
     }
     return t;
 }