public TaggedTextArray getCompAndPenReports(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 { EncounterApi api = new EncounterApi(); IndexedHashtable t = api.getCompAndPenReports(mySession.ConnectionSet, fromDate, toDate, nrpts); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
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); }
/// <summary> /// US:1945 US:1880 US:885 /// gets the next note title target /// </summary> /// <param name="tta"></param> /// <param name="strTarget"></param> /// <returns></returns> protected CStatus GetNextNoteTitleTarget(TaggedTextArray tta, out string strTarget) { strTarget = String.Empty; //get the index of the last item in the array int nCountArray = tta.results.Count(); int nIndexArray = 0; if (nCountArray > 0) { nIndexArray = nCountArray - 1; } //get the index of the last item in the taggedResults of the array int nCountTagged = tta.results[nIndexArray].taggedResults.Count(); int nIndexTagged = 0; if (nCountTagged > 0) { nIndexTagged = nCountTagged - 1; } //get the next target strTarget = tta.results[nIndexArray].taggedResults[nIndexTagged].textArray[0]; return(new CStatus()); }
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); }
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); }
public TaggedTextArray disconnectAll() { 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.disconnectAll(); result = new TaggedTextArray(t); mySession.ConnectionSet.Clear(); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedTextArray getOrderDialogsForDisplayGroup(string displayGroupId) { 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(displayGroupId)) { result.fault = new FaultTO("Empty Display Group ID"); } if (result.fault != null) { return(result); } try { OrderedDictionary d = Order.getOrderDialogsForDisplayGroup(mySession.ConnectionSet.BaseConnection, displayGroupId); result = new TaggedTextArray(d); } catch (Exception exc) { result.fault = new FaultTO(exc); } return(result); }
public TaggedTextArray getCrisisNotes(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.getCrisisNotes(_mySession.ConnectionSet, fromDate, toDate, nrpts); return(new TaggedTextArray(t)); } catch (Exception e) { result.fault = new FaultTO(e); return(result); } }
public TaggedTextArray getMedsAdminLog(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.getMedsAdminLog(mySession.ConnectionSet, fromDate, toDate, nrpts); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TaggedTextArray getComplications() { TaggedTextArray result = new TaggedTextArray(); String sessionCheck = MdwsUtils.isAuthorizedConnection(_mySession); if (!String.Equals(sessionCheck, "OK", StringComparison.CurrentCultureIgnoreCase)) { result.fault = new FaultTO(sessionCheck); } if (result.fault != null) { return(result); } try { Dictionary <String, String> complications = new RadiologyApi().getComplications(_mySession.ConnectionSet.BaseConnection); result = new TaggedTextArray(complications); } catch (Exception exc) { result.fault = new FaultTO(exc); } return(result); }
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); } }
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); }
public TaggedTextArray ddrListerMS( string file, string iens, string fields, string flags, string maxrex, string from, string part, string xref, string screen, string identifier) { TaggedTextArray result = new TaggedTextArray(); try { ToolsApi api = new ToolsApi(); IndexedHashtable s = api.ddrLister(mySession.ConnectionSet, file, iens, fields, flags, maxrex, from, part, xref, screen, identifier); result = new TaggedTextArray(s); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedTextArray getLocations(string target, string direction) { 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 { EncounterLib encounterLib = new EncounterLib(mySession); TaggedHospitalLocationArray locations = encounterLib.getLocations(target, direction); if (locations.fault != null) { result.fault = locations.fault; return(result); } result.results = new TaggedText[locations.locations.Length]; for (int i = 0; i < locations.locations.Length; i++) { result.results[i] = new TaggedText(locations.locations[i].id, locations.locations[i].name); } result.count = locations.count; } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
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); }
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); }
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 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); }
public TaggedTextArray getNoteTitles(string sitecode, string target, string direction) { TaggedTextArray result = new TaggedTextArray(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } if (sitecode == null) { sitecode = _mySession.ConnectionSet.BaseSiteId; } if (direction == "") { direction = "1"; } try { AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode); Dictionary <string, ArrayList> x = _api.getNoteTitles(cxn, target, direction); IndexedHashtable t = new IndexedHashtable(); t.Add(sitecode, x); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public TaggedTextArray getCareTeamReports() { 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 { EncounterApi api = new EncounterApi(); IndexedHashtable t = api.getCareTeamReports(mySession.ConnectionSet); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
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); }
// 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); }
public TaggedTextArray runRpc(string rpcName, string[] paramValues, int[] paramTypes, bool[] paramEncrypted) { TaggedTextArray result = new TaggedTextArray(); try { ToolsApi api = new ToolsApi(); IndexedHashtable s = api.runRpc(mySession.ConnectionSet, rpcName, paramValues, paramTypes, paramEncrypted); return(new TaggedTextArray(s)); } catch (Exception exc) { result.fault = new FaultTO(exc); return(result); } }
/// <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(); //Say the magic word // TBD - needed????? //if (pwd != mySession.AppPwd) //{ // result.fault = new FaultTO("Invalid application password"); //} 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.user == null) //{ // result.fault = new FaultTO("No logged in user"); //} 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)); }
public TaggedTextArray disconnectRemoteSites() { //string logMsg = "disconnectRemoteSites()"; //mySession.log.Info(logMsg); ConnectionLib lib = new ConnectionLib(mySession); TaggedTextArray result = lib.disconnectRemoteSites(); //if (result.fault != null) //{ // mySession.log.Error(logMsg + ": " + result.fault.message); //} //else //{ // mySession.log.Info(logMsg + ": " + result.count + " disconnected"); //} return(result); }
/// <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); }
public void visit(string securityPhrase, string visitSite, string userSite, string userName, string duz, string ssn, string permissionString) { TaggedTextArray result = _emrSvc.visit(securityPhrase, visitSite, userSite, userName, duz, ssn, permissionString); if (result.fault != null) { throw new ApplicationException(result.fault.message); } if (result.results != null && result.results.Length > 0) { foreach (TaggedText tt in result.results) { if (tt != null && tt.fault != null) { throw new ApplicationException(tt.fault.message); } } } }
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); }
public TaggedTextArray updateIdProofingStatus(string patientId, string patientName, string patientDOB) { return(new TaggedTextArray() { fault = new FaultTO(new NotImplementedException()) }); TaggedTextArray result = new TaggedTextArray(); try { } catch (Exception exc) { result.fault = new FaultTO(exc); } finally { try { mySession.ConnectionSet.disconnectAll(); } catch (Exception) { } } return(result); }
public TaggedTextArray disconnectAll() { // TODO - FIX!!! This is very ugly - here so that SOAP and REST services can both be stateful or stateless if (!Convert.ToBoolean(_mySession.MdwsConfiguration.AllConfigs[MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][MdwsConfigConstants.CONNECTION_POOLING])) { return(new gov.va.medora.mdws.ConnectionLib(_mySession).disconnectAll()); } TaggedTextArray result = new TaggedTextArray(); try { //IndexedHashtable t = _mySession.ConnectionSet.disconnectAll(); //result = new TaggedTextArray(t); _mySession.ConnectionSet.Clear(); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }