gov.va.medora.mdws.AccountLib.patientVisit C# (CSharp) Method

patientVisit() public method

patientVisit This method is used by MHV and will probably be used by other PHR apps.
public patientVisit ( string pwd, string homeSitecode, string mpiPid, bool multiSite ) : SiteArray
pwd string Client app's BSE security phrase
homeSitecode string Station number
mpiPid string ICN
multiSite bool Set to false for now
return gov.va.medora.mdws.dto.SiteArray
        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;
        }

Same methods

AccountLib::patientVisit ( string pwd, string sitecode, string mpiPid ) : SiteTO

Usage Example

Ejemplo n.º 1
0
        public TaggedChemHemRptArray getChemHemReportsByReportDateFromSite(
            string pwd, string sitecode, string mpiPid, string fromDate, string toDate)
        {
            TaggedChemHemRptArray result = new TaggedChemHemRptArray();

            if (String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO("Missing sitecode");
            }
            else if (mpiPid == "")
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (toDate == "")
            {
                toDate = DateTime.Now.ToString("yyyyMMdd");
            }

            AccountLib acctLib = new AccountLib(mySession);

            try
            {
                // Visit as DoD user...
                SiteArray sites = acctLib.patientVisit(pwd, sitecode, mpiPid, false);
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return(result);
                }

                // Get the labs...
                ChemHemReport[] rpts = ChemHemReport.getChemHemReports(mySession.ConnectionSet.getConnection(sitecode), fromDate, toDate);
                result = new TaggedChemHemRptArray(sitecode, rpts);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            finally
            {
                mySession.close();
            }
            return(result);
        }
All Usage Examples Of gov.va.medora.mdws.AccountLib::patientVisit