getConfidentiality() 공개 메소드

public getConfidentiality ( ConnectionSet cxns ) : IndexedHashtable
cxns gov.va.medora.mdo.dao.ConnectionSet
리턴 IndexedHashtable
예제 #1
0
파일: PatientLib.cs 프로젝트: OSEHRA/mdws
        public TaggedTextArray getConfidentiality()
        {
            TaggedTextArray result = new TaggedTextArray();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                PatientApi api = new PatientApi();
                result = new TaggedTextArray(api.getConfidentiality(mySession.ConnectionSet));
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
예제 #2
0
파일: AccountLib.cs 프로젝트: OSEHRA/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;
        }