getTreatingFacilityIds() public method

Get patient identifiers from the treating facility file at a single Vista (typically the base connection)
public getTreatingFacilityIds ( AbstractConnection cxn, string pid ) : string>.Dictionary
cxn AbstractConnection Typically a VistaConnection
pid string Patient ID - typically a DFN
return string>.Dictionary
Example #1
0
        public TaggedTextArray getCorrespondingIds(string sitecode, string patientId, string idType)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (mySession == null || mySession.ConnectionSet == null || mySession.ConnectionSet.BaseConnection == null ||
                !mySession.ConnectionSet.HasBaseConnection || !mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("No connections", "Need to login?");
            }
            else if (!String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO("Lookup by a specific sitecode is not currently supported - please leave this field empty and MDWS will query the base connection");
            }
            else if (String.IsNullOrEmpty(patientId))
            {
                result.fault = new FaultTO("Missing patient ID");
            }
            else if (String.IsNullOrEmpty(idType))
            {
                result.fault = new FaultTO("Missing ID type");
            }
            else if (!String.Equals("DFN", idType, StringComparison.CurrentCultureIgnoreCase)
                && !String.Equals("ICN", idType, StringComparison.CurrentCultureIgnoreCase))
            {
                result.fault = new FaultTO("Lookup by " + idType + " is not currently supported");
            }

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

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

            try
            {
                if (String.Equals("ICN", idType, StringComparison.CurrentCultureIgnoreCase))
                {
                    PatientApi patientApi = new PatientApi();
                    string localPid = patientApi.getLocalPid(mySession.ConnectionSet.BaseConnection, patientId);
                    result = new TaggedTextArray(patientApi.getTreatingFacilityIds(mySession.ConnectionSet.BaseConnection, localPid));
                }
                else if (String.Equals("DFN", idType, StringComparison.CurrentCultureIgnoreCase))
                {
                    PatientApi patientApi = new PatientApi();
                    result = new TaggedTextArray(patientApi.getTreatingFacilityIds(mySession.ConnectionSet.BaseConnection, patientId));
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return result;
        }