public getLocalPid ( gov.va.medora.mdo.dao.AbstractConnection cxn, string mpiPID ) : string | ||
cxn | gov.va.medora.mdo.dao.AbstractConnection | |
mpiPID | string | |
return | string |
/// <summary> /// patientVisit /// This method is used by MHV and will probably be used by other PHR apps. /// </summary> /// <param name="pwd">Client app's BSE security phrase</param> /// <param name="homeSitecode">Station number</param> /// <param name="mpiPid">ICN</param> /// <param name="multiSite">Set to false for now</param> /// <returns>SiteArray: Nothing really in it though, except error messages</returns> public SiteArray patientVisit(string pwd, string homeSitecode, string mpiPid, bool multiSite) { SiteArray result = new SiteArray(); //Make sure we have all the args we need if (mySession == null || mySession.SiteTable == null) { result.fault = new FaultTO("No session has been started"); } else if (String.IsNullOrEmpty(homeSitecode)) { result.fault = new FaultTO("No homeSitecode"); } else if (mySession.SiteTable.getSite(homeSitecode) == null) { result.fault = new FaultTO("No site " + homeSitecode + " in the site table"); } else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0 && mySession.ConnectionSet.HasConnection(homeSitecode)) { result.fault = new FaultTO("Site " + homeSitecode + " already connected"); } else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0) { result.fault = new FaultTO("This session has pre-existing connections and this method should be the base connection.", "Do a disconnect?"); } else if (mpiPid == "") { result.fault = new FaultTO("No MPI PID"); } if (result.fault != null) { return result; } Site homeSite = mySession.SiteTable.getSite(homeSitecode); mySession.Credentials = getAdministrativeCredentials(homeSite); mySession.Credentials.SecurityPhrase = pwd; string context = MdwsConstants.MDWS_CONTEXT; if (mySession.DefaultVisitMethod == MdwsConstants.NON_BSE_CREDENTIALS) { context = MdwsConstants.CPRS_CONTEXT; } mySession.PrimaryPermission = new MenuOption(context); try { mySession.User = doTheVisit(homeSitecode, mySession.Credentials, mySession.PrimaryPermission); PatientApi patientApi = new PatientApi(); string localPid = patientApi.getLocalPid(myCxn, mpiPid); if (localPid == "") { myCxn.disconnect(); result.fault = new FaultTO("No such patient at this site"); return result; } mySession.Patient = patientApi.select(myCxn, localPid); addMyCxn2CxnSet(); } catch (Exception e) { myCxn.disconnect(); result.fault = new FaultTO(e.Message); return result; } 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; }
internal void addHomeData(Patient patient) { if (patient == null) { return; } try { Site site = mySession.SiteTable.getSite(patient.CmorSiteId); DataSource src = site.getDataSourceByModality("HIS"); MySession newMySession = new MySession(mySession.FacadeName); AccountLib accountLib = new AccountLib(newMySession); UserTO visitUser = accountLib.visitAndAuthorize(mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.BSE_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_PASSWORD], patient.CmorSiteId, mySession.ConnectionSet.BaseConnection.DataSource.SiteId.Id, mySession.User.Name.LastNameFirst, mySession.User.Uid, mySession.User.SSN.toString(), "OR CPRS GUI CHART"); PatientApi patientApi = new PatientApi(); patient.LocalPid = patientApi.getLocalPid(newMySession.ConnectionSet.BaseConnection, patient.MpiPid); patientApi.addHomeDate(newMySession.ConnectionSet.BaseConnection, patient); newMySession.ConnectionSet.BaseConnection.disconnect(); } catch (Exception) { // just pass back patient unchanged } }
public TextTO getLocalPid(string sitecode, string mpiPid) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (mpiPid == "") { result.fault = new FaultTO("Missing mpiPid"); } if (result.fault != null) { return result; } if (String.IsNullOrEmpty(sitecode)) { sitecode = mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode); PatientApi api = new PatientApi(); string localPid = api.getLocalPid(cxn, mpiPid); result = new TextTO(localPid); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }