Наследование: AbstractArrayTO
Пример #1
0
        public TaggedTextArray getSitesForStation()
        {
            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
            {
                List<SiteId> lst = HospitalLocation.getSitesForStation(mySession.ConnectionSet.BaseConnection);
                if (lst == null || lst.Count == 0)
                {
                    return null;
                }
                result.results = new TaggedText[lst.Count];
                for (int i = 0; i < lst.Count; i++)
                {
                    result.results[i] = new TaggedText(lst[i].Id, lst[i].Name);
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Пример #2
0
 public ProblemTO(Problem mdo)
 {
     this.id = mdo.Id;
     this.status = mdo.Status;
     this.providerNarrative = mdo.ProviderNarrative;
     this.onsetDate = mdo.OnsetDate;
     this.modifiedDate = mdo.ModifiedDate;
     this.exposures = mdo.Exposures;
     this.noteNarrative = mdo.NoteNarrative;
     if (mdo.Observer != null)
     {
         this.observer = new AuthorTO(mdo.Observer);
     }
     if (mdo.Facility != null)
     {
         this.facility = new TaggedText(mdo.Facility.Id, mdo.Facility.Name);
     }
     if (mdo.Type != null)
     {
         this.type = new ObservationTypeTO(mdo.Type);
     }
     this.comment = mdo.Comment;
     if (mdo.OrganizationProperties != null && mdo.OrganizationProperties.Count > 0)
     {
         this.organizationalProperties = new TaggedTextArray(mdo.OrganizationProperties);
     }
 }
Пример #3
0
        public TaggedTextArray getAdHocHealthSummaryByDisplayName(string displayName)
        {
            TaggedTextArray result = new TaggedTextArray();

            string msg = MdwsUtils.isAuthorizedConnection(mySession);
            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (displayName == "")
            {
                result.fault = new FaultTO("Missing displayName");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                IndexedHashtable t = ClinicalApi.getAdHocHealthSummaryByDisplayName(mySession.ConnectionSet, displayName);
                return new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
                return result;
            }
        }
Пример #4
0
 public ProblemTO(Problem mdo)
 {
     this.id                = mdo.Id;
     this.status            = mdo.Status;
     this.providerNarrative = mdo.ProviderNarrative;
     this.onsetDate         = mdo.OnsetDate;
     this.modifiedDate      = mdo.ModifiedDate;
     this.exposures         = mdo.Exposures;
     this.noteNarrative     = mdo.NoteNarrative;
     if (mdo.Observer != null)
     {
         this.observer = new AuthorTO(mdo.Observer);
     }
     if (mdo.Facility != null)
     {
         this.facility = new TaggedText(mdo.Facility.Id, mdo.Facility.Name);
     }
     if (mdo.Type != null)
     {
         this.type = new ObservationTypeTO(mdo.Type);
     }
     this.comment = mdo.Comment;
     if (mdo.OrganizationProperties != null && mdo.OrganizationProperties.Count > 0)
     {
         this.organizationalProperties = new TaggedTextArray(mdo.OrganizationProperties);
     }
 }
Пример #5
0
        public TaggedTextArray getAutopsyReports()
        {
            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
            {
                LabsApi api = new LabsApi();
                IndexedHashtable t = api.getAutopsyReport(mySession.ConnectionSet);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Пример #6
0
        public TaggedTextArray getBloodAvailabilityReports(string fromDate, string toDate, int nrpts)
        {
            TaggedTextArray result = new TaggedTextArray();

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

            try
            {
                LabsApi api = new LabsApi();
                IndexedHashtable t = api.getBloodAvailabilityReport(mySession.ConnectionSet, fromDate, toDate, nrpts);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Пример #7
0
        public TaggedTextArray getDiscontinueReasons()
        {
            TaggedTextArray result = new TaggedTextArray();

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

            try
            {
                MedsApi medsApi = new MedsApi();
                IndexedHashtable ht = medsApi.getDiscontinueReasons(mySession.ConnectionSet);
                return new TaggedTextArray(ht);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return result;
        }
Пример #8
0
        public TaggedTextArray getImmunizations(string fromDate, string toDate, int nrpts)
        {
            TaggedTextArray result = new TaggedTextArray();

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

            try
            {
                IndexedHashtable t = Medication.getImmunizations(mySession.ConnectionSet, fromDate, toDate, nrpts);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Пример #9
0
        public TaggedTextArray getClinicsByName(string name)
        {
            TaggedTextArray result = new TaggedTextArray();

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

            try
            {
                OrderedDictionary d = HospitalLocation.getClinicsByName(mySession.ConnectionSet.BaseConnection, name);
                result = new TaggedTextArray(d);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
 public MentalHealthInstrumentResultSetTO(MentalHealthInstrumentResultSet mdo)
 {
     this.id = mdo.Id;
     this.administrationId  = mdo.AdministrationId;
     this.scale             = new TaggedText(mdo.Scale);
     this.rawScore          = mdo.RawScore;
     this.transformedScores = new TaggedTextArray(mdo.TransformedScores);
     this.instrument        = new TaggedText(mdo.Instrument);
 }
 public MentalHealthInstrumentResultSetTO(MentalHealthInstrumentResultSet mdo)
 {
     this.id = mdo.Id;
     this.administrationId = mdo.AdministrationId;
     this.scale = new TaggedText(mdo.Scale);
     this.rawScore = mdo.RawScore;
     this.transformedScores = new TaggedTextArray(mdo.TransformedScores);
     this.instrument = new TaggedText(mdo.Instrument);
 }
Пример #12
0
 private void initCollections()
 {
     ContinuityOfCareDocuments = new TaggedTextArray();
     Patient          = new PatientTO();
     Meds             = new TaggedMedicationArrays();
     Allergies        = new TaggedAllergyArrays();
     Appointments     = new TaggedAppointmentArrays();
     Notes            = new TaggedNoteArrays();
     ChemHemReports   = new TaggedChemHemRptArrays();
     MicroReports     = new TaggedMicrobiologyRptArrays();
     Problems         = new TaggedProblemArrays();
     RadiologyReports = new TaggedRadiologyReportArrays();
     SurgeryReports   = new TaggedSurgeryReportArrays();
     Vitals           = new TaggedVitalSignArrays();
 }
Пример #13
0
 public ProblemTO(Problem mdo)
 {
     if (mdo == null)
     {
         return;
     }
     this.resolvedDate = mdo.ResolvedDate;
     this.removed      = mdo.Removed;
     this.verified     = mdo.Verified;
     if (mdo.Comments != null && mdo.Comments.Count > 0)
     {
         Note[] noteComments = new Note[mdo.Comments.Count];
         mdo.Comments.CopyTo(noteComments, 0);
         this.comments = new TaggedNoteArray("comments", noteComments);
     }
     this.acuity            = new TaggedText(mdo.Acuity);
     this.id                = mdo.Id;
     this.status            = mdo.Status;
     this.providerNarrative = mdo.ProviderNarrative;
     this.onsetDate         = mdo.OnsetDate;
     this.modifiedDate      = mdo.ModifiedDate;
     this.exposures         = mdo.Exposures;
     this.noteNarrative     = mdo.NoteNarrative;
     this.priority          = mdo.Priority;
     this.resolvedDate      = mdo.ResolvedDate;
     if (mdo.Observer != null)
     {
         this.observer = new AuthorTO(mdo.Observer);
     }
     if (mdo.Facility != null)
     {
         this.facility = new TaggedText(mdo.Facility.Id, mdo.Facility.Name);
     }
     if (mdo.Type != null)
     {
         this.type = new ObservationTypeTO(mdo.Type);
     }
     this.comment = mdo.Comment;
     if (mdo.OrganizationProperties != null && mdo.OrganizationProperties.Count > 0)
     {
         this.organizationalProperties = new TaggedTextArray(mdo.OrganizationProperties);
     }
     this.timestamp = mdo.Timestamp;
 }
Пример #14
0
 public QuestionTO(QuestionnaireQuestion mdo)
 {
     this.number = mdo.Number;
     this.text = mdo.Text;
     this.val = mdo.Value;
     this.branchFromQuestion = mdo.BranchFromQuestion;
     this.branchCondition = mdo.BranchCondition;
     if (mdo.Choices != null)
     {
         this.choices = new TaggedTextArray();
         this.choices.results = new TaggedText[mdo.Choices.Count];
         for (int i = 0; i < mdo.Choices.Count; i++)
         {
             KeyValuePair<string, string> kvp = mdo.Choices[i];
             this.choices.results[i] = new TaggedText(kvp);
         }
         this.choices.count = mdo.Choices.Count;
     }
 }
Пример #15
0
 public QuestionTO(QuestionnaireQuestion mdo)
 {
     this.number             = mdo.Number;
     this.text               = mdo.Text;
     this.val                = mdo.Value;
     this.branchFromQuestion = mdo.BranchFromQuestion;
     this.branchCondition    = mdo.BranchCondition;
     if (mdo.Choices != null)
     {
         this.choices         = new TaggedTextArray();
         this.choices.results = new TaggedText[mdo.Choices.Count];
         for (int i = 0; i < mdo.Choices.Count; i++)
         {
             KeyValuePair <string, string> kvp = mdo.Choices[i];
             this.choices.results[i] = new TaggedText(kvp);
         }
         this.choices.count = mdo.Choices.Count;
     }
 }
Пример #16
0
        public RadiologyOrderDialogTO(RadiologyOrderDialog mdo)
        {
            if (mdo != null)
            {
                contractOptions = new TaggedTextArray(mdo.ContractOptions);
                sharingOptions  = new TaggedTextArray(mdo.SharingOptions);
                researchOptions = new TaggedTextArray(mdo.ResearchOptions);
                categories      = new TaggedTextArray(mdo.Categories);
                modifiers       = new TaggedTextArray(mdo.Modifiers);
                urgencies       = new TaggedTextArray(mdo.Urgencies);
                transports      = new TaggedTextArray(mdo.Transports);
                submitTo        = new TaggedTextArray(mdo.SubmitTo);

                if (mdo.CommonProcedures != null && mdo.CommonProcedures.Count > 0)
                {
                    this.commonProcedures = new List <ClinicalProcedureTO>();
                    foreach (ClinicalProcedure proc in mdo.CommonProcedures)
                    {
                        this.commonProcedures.Add(new ClinicalProcedureTO(proc));
                    }
                }

                if (mdo.ShortList != null && mdo.ShortList.Count > 0)
                {
                    this.shortList = new List <ClinicalProcedureTO>();
                    foreach (ClinicalProcedure proc in mdo.ShortList)
                    {
                        this.shortList.Add(new ClinicalProcedureTO(proc));
                    }
                }

                if (mdo.Last7DaysExams != null && mdo.Last7DaysExams.Count > 0)
                {
                    this.lastSevenDaysExams = new List <ImagingExamTO>();
                    foreach (ImagingExam exam in mdo.Last7DaysExams)
                    {
                        this.lastSevenDaysExams.Add(new ImagingExamTO(exam));
                    }
                }
            }
        }
        public TaggedTextArray getActiveReminderReports()
        {
            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
            {
                OrderedDictionary d = ClinicalReminder.getActiveReminderReports(mySession.ConnectionSet.BaseConnection);
                result = new TaggedTextArray(d);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Пример #18
0
        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;
        }
Пример #19
0
        /// <summary>
        /// Visit multiple data sources without a login.
        /// </summary>
        /// <remarks>
        /// Requires no previous login.  Used by daemon apps to visit multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in 
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionStr">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string userSitecode, string userName, string DUZ, string permissionStr)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new FaultTO("Missing pwd");
            }
            else if (String.IsNullOrEmpty(sourceList))
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (String.IsNullOrEmpty(userSitecode))
            {
                result.fault = new FaultTO("Missing userSitecode");
            }
            else if (String.IsNullOrEmpty(userName))
            {
                result.fault = new FaultTO("Missing userName");
            }
            else if (String.IsNullOrEmpty(DUZ))
            {
                result.fault = new FaultTO("Missing DUZ");
            }
            if (result.fault != null)
            {
                return result;
            }

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

            try
            {
                // Do an admin visit to get user's SSN
                User theUser = getVisitorData(userSitecode, DUZ, pwd);

                // Build the credentials
                Site site = mySession.SiteTable.getSite(userSitecode);
                DataSource src = site.getDataSourceByModality("HIS");

                AbstractCredentials creds = new VistaCredentials();
                creds.AuthenticationSource = src;
                creds.AuthenticationToken = userSitecode + '_' + theUser.Uid;
                creds.FederatedUid = theUser.SSN.toString();
                creds.LocalUid = theUser.Uid;
                creds.SecurityPhrase = pwd;
                creds.SubjectName = theUser.Name.getLastNameFirst();
                creds.SubjectPhone = theUser.Phone;

                mySession.PrimaryPermission = new MenuOption(permissionStr);

                // Make next call think there's been a login
                mySession.Credentials = creds;

                // visitSites
                return visitSites(pwd, sourceList, permissionStr);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }

            return result;
        }
Пример #20
0
        /// <summary>
        /// Visit multiple data sources after a login.
        /// </summary>
        /// <remarks>
        /// Requires a previous login so the credentials are already in mySession and are
        /// not altered.  Can visit a single source or multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in 
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionString">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string permissionString)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (mySession == null || mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No site table");
            }
            else if (sourceList == "")
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (mySession.Credentials == null)
            {
                result.fault = new FaultTO("Cannot use this method without previous login");
            }
            if (result.fault != null)
            {
                return result;
            }

            Site[] sites = MdwsUtils.parseSiteList(mySession.SiteTable, sourceList);
            List<DataSource> sources = new List<DataSource>(sites.Length);
            for (int i = 0; i < sites.Length; i++)
            {
                for (int j = 0; j < sites[i].Sources.Length; j++)
                {
                    if (sites[i].Sources[j].Protocol == "VISTA" ||
                        sites[i].Sources[j].Protocol == "FHIE" || sites[i].Sources[j].Protocol == "XVISTA")
                    {
                        sources.Add(sites[i].Sources[j]);
                    }
                }
            }
            return setupMultiSourceQuery(pwd, sources, permissionString);
        }
Пример #21
0
        public TaggedTextArray visitDoD(string pwd)
        {
            Site site = mySession.SiteTable.getSite(MdwsConstants.DOD_SITE);
            AbstractCredentials credentials = getAdministrativeCredentials(site);
            credentials.SecurityPhrase = mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_PASSWORD];

            string context = MdwsConstants.MDWS_CONTEXT;
            if (mySession.DefaultVisitMethod == MdwsConstants.NON_BSE_CREDENTIALS)
            {
                context = MdwsConstants.CPRS_CONTEXT;
            }
            AbstractPermission permission = new MenuOption(context);
            permission.IsPrimary = true;

            TaggedTextArray result = new TaggedTextArray();
            try
            {
                User u = doTheVisit(site.Id, credentials, permission);
                result.results = new TaggedText[] { new TaggedText(site.Id, u.Uid) };
                addMyCxn2CxnSet();
                mySession.Credentials = credentials;
                mySession.PrimaryPermission = permission;
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Пример #22
0
        public TaggedTextArray sitesHavePatch(string sitelist, string patchId)
        {
            TaggedTextArray result = new TaggedTextArray();
            //if (mySession.ConnectionSet.Count == 0 || !mySession.ConnectionSet.IsAuthorized)
            //{
            //    result.fault = new FaultTO(NO_CONNECTIONS);
            //}
            if (String.IsNullOrEmpty(sitelist))
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (String.IsNullOrEmpty(patchId))
            {
                result.fault = new FaultTO("Missing patchId");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                AccountLib acctLib = new AccountLib(mySession);
                TaggedTextArray sites = acctLib.visitSites(mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_PASSWORD],
                    sitelist, MdwsConstants.CPRS_CONTEXT);

                ToolsApi api = new ToolsApi();
                IndexedHashtable t = api.hasPatch(mySession.ConnectionSet, patchId);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            finally
            {
                mySession.ConnectionSet.disconnectAll();
            }
            return result;
        }
Пример #23
0
        public TaggedTextArray getTestDescription(string identifierString)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (MdwsUtils.isAuthorizedConnection(mySession) != "OK")
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }

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

            try
            {
                LabsApi api = new LabsApi();
                return new TaggedTextArray(api.getTestDescription(mySession.ConnectionSet, identifierString));
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return result;
        }
Пример #24
0
        public TaggedTextArray getCancellationReasons()
        {
            TaggedTextArray result = new TaggedTextArray();

            return result;
        }
Пример #25
0
 private void initCollections()
 {
     ContinuityOfCareDocuments = new TaggedTextArray();
     Patient = new PatientTO();
     Meds = new TaggedMedicationArrays();
     Allergies = new TaggedAllergyArrays();
     Appointments = new TaggedAppointmentArrays();
     Notes = new TaggedNoteArrays();
     ChemHemReports = new TaggedChemHemRptArrays();
     MicroReports = new TaggedMicrobiologyRptArrays();
     Problems = new TaggedProblemArrays();
     RadiologyReports = new TaggedRadiologyReportArrays();
     SurgeryReports = new TaggedSurgeryReportArrays();
     Vitals = new TaggedVitalSignArrays();
 }
Пример #26
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;
        }
Пример #27
0
 public TaggedTextArray disconnectRemoteSites()
 {
     TaggedTextArray result = new TaggedTextArray();
     if (mySession.ConnectionSet == null || mySession.ConnectionSet.Count == 0)
     {
         result.fault = new FaultTO(NO_CONNECTIONS);
     }
     if (result.fault != null)
     {
         return result;
     }
     try
     {
         IndexedHashtable t = mySession.ConnectionSet.disconnectRemotes();
         result = new TaggedTextArray(t);
     }
     catch (Exception e)
     {
         result.fault = new FaultTO(e.Message);
     }
     return result;
 }
Пример #28
0
        public TaggedTextArray getOutpatientRxProfile()
        {
            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
            {
                IndexedHashtable t = Medication.getOutpatientRxProfile(mySession.ConnectionSet);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }
Пример #29
0
        /// <summary>
        /// Visit multiple data sources without a login.
        /// </summary>
        /// <remarks>
        /// Requires no previous login.  Used by daemon apps to visit multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in 
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionStr">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string userSitecode, string userName, string DUZ, string SSN, string permissionStr)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new FaultTO("Missing pwd");
            }
            else if (String.IsNullOrEmpty(sourceList))
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (String.IsNullOrEmpty(userSitecode))
            {
                result.fault = new FaultTO("Missing userSitecode");
            }
            else if (String.IsNullOrEmpty(userName))
            {
                result.fault = new FaultTO("Missing userName");
            }
            else if (String.IsNullOrEmpty(DUZ))
            {
                result.fault = new FaultTO("Missing DUZ");
            }
            else if (String.IsNullOrEmpty(SSN))
            {
                result.fault = new FaultTO("Missing SSN");
            }
            if (result.fault != null)
            {
                return result;
            }

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

            try
            {
                // Build the credentials
                Site site = mySession.SiteTable.getSite(userSitecode);
                DataSource src = site.getDataSourceByModality("HIS");

                AbstractCredentials creds = new VistaCredentials();
                creds.AuthenticationSource = src;
                creds.AuthenticationToken = userSitecode + '_' + DUZ;
                creds.FederatedUid = SSN;
                creds.LocalUid = DUZ;
                creds.SecurityPhrase = pwd;
                creds.SubjectName = userName;
                creds.SubjectPhone = "";

                User user = new User();
                user.UserName = userName;
                user.Uid = DUZ;
                user.SSN = new SocSecNum(SSN);

                mySession.PrimaryPermission = new MenuOption(permissionStr);

                // Make next call think there's been a login
                mySession.Credentials = creds;
                mySession.User = user;

                // visitSites
                return visitSites(pwd, sourceList, permissionStr);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }

            return result;
        }
Пример #30
0
        public TaggedTextArray getUsersWithOption(string optionName)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (!(MdwsUtils.isAuthorizedConnection(mySession) == "OK"))
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(optionName))
            {
                result.fault = new FaultTO("Empty Option Name");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                OrderedDictionary d = User.getUsersWithOption(mySession.ConnectionSet.BaseConnection, optionName);
                result = new TaggedTextArray(d);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return result;
        }
Пример #31
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]]);
                }
            }
        }
Пример #32
0
 public TaggedTextArray getUserIdBySSN(string SSN)
 {
     TaggedTextArray result = new TaggedTextArray();
     if (SSN == "")
     {
         result.fault = new FaultTO("Missing SSN");
     }
     if (result.fault != null)
     {
         return result;
     }
     try
     {
         UserApi api = new UserApi();
         IndexedHashtable t = api.getUserId(mySession.ConnectionSet, new System.Collections.Generic.KeyValuePair<string, string>("SSN", SSN));
         result = new TaggedTextArray(t);
     }
     catch (Exception e)
     {
         result.fault = new FaultTO(e.Message);
     }
     return result;
 }
Пример #33
0
        public TaggedTextArray matchCityAndState(string city, string stateAbbr)
        {
            TaggedTextArray result = new TaggedTextArray();
            if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (stateAbbr == "")
            {
                result.fault = new FaultTO("Missing stateAbbr");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                SitesApi api = new SitesApi();
                string[] s = api.matchCityAndState(city, stateAbbr, mySession.MdwsConfiguration.SqlConnectionString);
                result.results = new TaggedText[s.Length];
                for (int i = 0; i < s.Length; i++)
                {
                    string[] parts = StringUtils.split(s[i],StringUtils.CARET);
                    result.results[i] = new TaggedText(parts[0], parts[1]);
                }
                result.count = result.results.Length;
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Пример #34
0
        public TaggedTextArray getAdvanceDirectives(string fromDate, string toDate, int nrpts)
        {
            TaggedTextArray result = new TaggedTextArray();

            string msg = MdwsUtils.isAuthorizedConnection(_mySession);
            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (toDate == "")
            {
                result.fault = new FaultTO("Missing toDate");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                NoteApi api = new NoteApi();
                IndexedHashtable t = api.getAdvanceDirectives(_mySession.ConnectionSet, fromDate, toDate, nrpts);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Пример #35
0
        /// <summary>
        /// Given a national identifier find the patient's sites
        /// </summary>
        /// <param name="mpiPid"></param>
        /// <returns></returns>
        public TaggedTextArray getPatientSitesByMpiPid(string mpiPid)
        {
            TaggedTextArray result = new TaggedTextArray();
            if (String.IsNullOrEmpty(mpiPid))
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            if (result.fault != null)
            {
                return result;
            }

            // Temporary visit to site 200 for initial lookup
            AccountLib acctLib = new AccountLib(mySession);
            result = acctLib.visitDoD(null);
            if (result.fault != null)
            {
                return result;
            }

            TextTO localPid = getLocalPid(mpiPid);
            if (localPid.fault != null)
            {
                result.fault = localPid.fault;
                return result;
            }
            if (String.IsNullOrEmpty(localPid.text))
            {
                result.fault = new FaultTO("Empty DFN returned from VistA");
                return result;
            }

            PatientApi patientApi = new PatientApi();
            StringDictionary siteIds = patientApi.getRemoteSiteIds(mySession.ConnectionSet.BaseConnection, localPid.text);
            mySession.ConnectionSet.disconnectAll();
            result = new TaggedTextArray(siteIds);

            return result;
        }
Пример #36
0
        // This method is exposed to the svcs via visitSites
        internal TaggedTextArray setupMultiSourceQuery(string pwd, List<DataSource> sources, string context)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (sources == null || sources.Count == 0)
            {
                result.fault = new FaultTO("No sources");
            }
            else if (mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No site table");
            }
            else if (mySession.Credentials == null)
            {
                result.fault = new FaultTO("No credentials", "Need to login?");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (String.IsNullOrEmpty(context))
            {
                context = mySession.DefaultPermissionString;
            }
            if (mySession.PrimaryPermission == null || String.IsNullOrEmpty(mySession.PrimaryPermission.Name))
            {
                mySession.PrimaryPermission = new MenuOption(context);
            }

            try
            {
                mySession.ConnectionSet.ExcludeSite200 = mySession._excludeSite200;
                mySession.ConnectionSet.Add(sources, mySession.DefaultVisitMethod);
                mySession.Credentials.SecurityPhrase = pwd;
                DataSource validator = new DataSource() { ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString };
                IndexedHashtable t = mySession.ConnectionSet.connect(mySession.Credentials, mySession.PrimaryPermission, validator);

                if (t.Count == 0)
                {
                    throw new Exception("Unable to connect to remote sites");
                }
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result = new TaggedTextArray();
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Пример #37
0
        public TaggedTextArray getVistaTimestamps()
        {
            TaggedTextArray result = new TaggedTextArray();

            if(mySession.ConnectionSet.Count == 0 || !mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO(NO_CONNECTIONS);
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                IndexedHashtable t = mySession.ConnectionSet.query("IToolsDao", "getTimestamp", new object[] { });
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }