Example #1
0
        public TaggedHealthSummaryArray getHealthSummary(string healthSummaryId, string healthSummaryName)
        {
            TaggedHealthSummaryArray result = new TaggedHealthSummaryArray();
            string msg = MdwsUtils.isAuthorizedConnection(mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
                return(result);
            }
            if ((mySession.Patient == null) || (string.IsNullOrEmpty(mySession.Patient.LocalPid)))
            {
                result.fault = new FaultTO("Need to select a patient before calling this method.");
                return(result);
            }
            if (string.IsNullOrEmpty(healthSummaryId) && string.IsNullOrEmpty(healthSummaryName))
            {
                result.fault = new FaultTO("Missing health summary Id OR health summary name. Please provide one of the parameters.");
                return(result);
            }

            try
            {
                IndexedHashtable hs = ClinicalApi.getHealthSummary(mySession.ConnectionSet, new MdoDocument(healthSummaryId, healthSummaryName));
                result.Init(hs);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Example #2
0
        public TaggedUserArrays getStaffByCriteria(string siteCode, string searchTerm, string firstName, string lastName, string type)
        {
            TaggedUserArrays result = new TaggedUserArrays();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connection not established or authorized");
            }
            else if (String.IsNullOrEmpty(type))
            {
                result.fault = new FaultTO("Missing type of search {email, phone, firstAndLast, firstOrLast}");
            }
            else if (String.IsNullOrEmpty(siteCode))
            {
                result.fault = new FaultTO("Missing siteCode");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                IndexedHashtable ht = ClinicalApi.getStaffByCriteria(mySession.ConnectionSet, siteCode, searchTerm, firstName, lastName, type);
                result = new TaggedUserArrays(ht);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }

            return(result);
        }
Example #3
0
        public TaggedTextArray getNhinData(string types)
        {
            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 = ClinicalApi.getNhinData(mySession.ConnectionSet, types,
                                                             mySession.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.MDWS_CONFIG_SECTION][conf.MdwsConfigConstants.NHIN_TYPES]);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Example #4
0
        public TextTO getAdHocHealthSummaryByDisplayName(string sitecode, string displayName)
        {
            TextTO result = new TextTO();

            if (displayName == "")
            {
                result.fault = new FaultTO("Missing display name");
            }
            if (result.fault != null)
            {
                return(result);
            }
            try
            {
                result.text = ClinicalApi.getAdHocHealthSummaryByDisplayName(mySession.ConnectionSet.getConnection(sitecode), displayName);
                if (result.text == null)
                {
                    result.fault = new FaultTO("Site " + sitecode + " does not have " + displayName + " enabled! Please contact the site for remediation.");
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Example #5
0
        public TaggedProblemArrays getProblemList(string type)
        {
            TaggedProblemArrays result = new TaggedProblemArrays();

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

            try
            {
                IndexedHashtable t = ClinicalApi.getProblemList(mySession.ConnectionSet, type.ToUpper());
                result = new TaggedProblemArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Example #6
0
        public TextTO getSurgeryReportText(string siteId, string rptId)
        {
            TextTO result = new TextTO();

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

            try
            {
                ClinicalApi api = new ClinicalApi();
                string      s   = api.getSurgeryReportText(mySession.ConnectionSet.getConnection(siteId), rptId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Example #7
0
        public TaggedRadiologyReportArrays getRadiologyReports(string fromDate, string toDate, int nrpts)
        {
            TaggedRadiologyReportArrays result = new TaggedRadiologyReportArrays();

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

            try
            {
                IndexedHashtable t = ClinicalApi.getRadiologyReports(mySession.ConnectionSet, fromDate, toDate, nrpts);
                result = new TaggedRadiologyReportArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Example #8
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);
            }
        }
Example #9
0
        public HealthSummaryTO getHealthSummary(string healthSummaryId, string healthSummaryName)
        {
            HealthSummaryTO result = new HealthSummaryTO();

            if (string.IsNullOrEmpty(healthSummaryId) && string.IsNullOrEmpty(healthSummaryName))
            {
                result.fault = new FaultTO("Missing health summary Id OR health summary name. Please provide one of the parameters.");
                return(result);
            }

            try
            {
                HealthSummary hs = ClinicalApi.getHealthSummary(mySession.ConnectionSet.BaseConnection, new MdoDocument(healthSummaryId, healthSummaryName));
                result.Init(hs);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Example #10
0
        public TaggedProblemArrays getFluRelatedProblemList()
        {
            TaggedProblemArrays result = new TaggedProblemArrays();

            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 = ClinicalApi.getFluRelatedProblemList(mySession.ConnectionSet);
                result = new TaggedProblemArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Example #11
0
        public TaggedSurgeryReportArrays getSurgeryReportsBySite(string siteCode)
        {
            TaggedSurgeryReportArrays result = new TaggedSurgeryReportArrays();

            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 = ClinicalApi.getSurgeryReportsBySite(mySession.ConnectionSet, siteCode);
                result = new TaggedSurgeryReportArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Example #12
0
        public PatientMedicalRecordTO getData(string pwd, string site, bool multiSite, string pid, string types)
        {
            // TODO - implement checking of types
            PatientMedicalRecordTO result = new PatientMedicalRecordTO();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new FaultTO("Missing application password");
            }
            else if (String.IsNullOrEmpty(pid))
            {
                result.fault = new FaultTO("Must supply patient ID");
            }
            else if (String.IsNullOrEmpty(types))
            {
                result.fault = new FaultTO("Must supply types argument", "Use 'getDataTypes' call to discover currently supported data domains");
            }

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

            try
            {
                Dictionary <string, string> patientIens = null;

                // this section is all about finding the patient's remote sites
                if (String.IsNullOrEmpty(site))
                {
                    // TBD - Should CDW be hardcoded in here? Probably should refactor this out
                    using (CdwConnection cdwCxn = new CdwConnection(
                               new DataSource()
                    {
                        ConnectionString = mySession.MdwsConfiguration.CdwSqlConfig.ConnectionString
                    },
                               mySession.MdwsConfiguration.CdwSqlConfig.RunasUser))
                    {
                        patientIens = new CdwPatientDao(cdwCxn).getTreatingFacilityIds(pid);
                    }
                    if (patientIens == null || patientIens.Count == 0)
                    {
                        result.fault = new FaultTO("Unable to locate that patient with only ICN", "Try specifying the site with the patient's ID");
                        return(result);
                    }
                    IEnumerator enumerator = patientIens.Keys.GetEnumerator();
                    enumerator.MoveNext();
                    site = enumerator.Current as string; // set the site to the first one in the list
                }
                else
                {
                    patientIens = new Dictionary <string, string>();
                    patientIens.Add(site, pid);
                }

                // check to be sure we're asking for Vista or CDW data
                Site selectedSite = mySession.SiteTable.getSite(site);

                if (selectedSite == null || selectedSite.Sources == null || selectedSite.Sources.Length == 0 ||
                    (selectedSite.getDataSourceByModality("HIS") == null && selectedSite.getDataSourceByModality("CDW") == null))
                {
                    result.fault = new FaultTO("Currently supporting Vista and CDW only");
                    return(result);
                }

                // if we're asking for data from Vista - connect to sites
                if (selectedSite.getDataSourceByModality("HIS") != null)
                {
                    SiteArray sites = new AccountLib(mySession).patientVisit(pwd, site, pid, multiSite);
                    if (sites.fault != null)
                    {
                        result.fault = sites.fault;
                        return(result);
                    }
                }
                else if (selectedSite.getDataSourceByModality("CDW") != null)
                {
                    mySession.ConnectionSet.Add(new CdwConnection(selectedSite.getDataSourceByModality("CDW")));
                }
                else
                {
                    // shoulnd't get here but leave as placeholder for future data sources
                }

                IndexedHashtable ihs = ClinicalApi.getPatientRecord(mySession.ConnectionSet, types);
                result = new PatientMedicalRecordTO(ihs);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            finally
            {
                try { mySession.ConnectionSet.disconnectAll(); }
                catch (Exception) { }
            }

            return(result);
        }