Ejemplo n.º 1
0
        internal TaggedPatientArray match(AbstractConnection cxn, string target)
        {
            TaggedPatientArray result = new TaggedPatientArray();

            if (!cxn.IsConnected)
            {
                result = new TaggedPatientArray("Connection not open");
            }
            else if (cxn.DataSource.Uid == "")
            {
                result = new TaggedPatientArray("No user authorized for lookup");
            }
            else if (target == "")
            {
                result.fault = new FaultTO("Missing target");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                PatientApi patientApi = new PatientApi();
                Patient[]  matches    = patientApi.match(cxn, target);
                result = new TaggedPatientArray(cxn.DataSource.SiteId.Id, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public TaggedPatientArray match(string sitecode, string target)
        {
            TaggedPatientArray result = new TaggedPatientArray();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (sitecode == "")
            {
                result.fault = new FaultTO("Missing sitecode");
            }
            if (result.fault != null)
            {
                return(result);
            }
            return(match(mySession.ConnectionSet.getConnection(sitecode), target));
        }
Ejemplo n.º 3
0
    /// <summary>
    /// US:838
    /// transfers patients by clinic to the checklist db
    /// </summary>
    /// <param name="lClinicID"></param>
    /// <param name="dtApptFrom"></param>
    /// <param name="dtApptTo"></param>
    /// <param name="lCount"></param>
    /// <returns></returns>
    public CStatus GetMDWSClinicPatients(
        long lClinicID,
        DateTime dtApptFrom,
        DateTime dtApptTo,
        out long lCount)
    {
        //status
        lCount = 0;

        //check to make sure the MDWS connection is valid
        CStatus status = IsMDWSValid();

        if (!status.Status)
        {
            return(status);
        }

        //get the wards from MDWS
        TaggedPatientArray tpa = GetMDWSSOAPClient().getPatientsByClinic(Convert.ToString(lClinicID));

        if (tpa == null || tpa.fault != null)
        {
            //return new CMDWSStatus(tpa.fault);
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        //transfer the patients to the checklist DB
        CMDWSTransfer transfer = new CMDWSTransfer(this);

        status = transfer.TransferPatientArray(
            string.Empty,
            0,
            0,
            0,
            lClinicID,
            tpa,
            out lCount);
        if (!status.Status)
        {
            return(status);
        }

        return(new CStatus());
    }
Ejemplo n.º 4
0
        public TaggedPatientArrays getPatientsWithUpdatedFutureAppointments(string username, string pwd, string updatedSince)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();

            //if (String.IsNullOrEmpty(username) | String.IsNullOrEmpty(pwd) | String.IsNullOrEmpty(updatedSince))
            //{
            //    result.fault = new FaultTO("Must supply all arguments");
            //}
            try
            {
                EncounterApi api = new EncounterApi();
                DataSource   ds  = new DataSource {
                    ConnectionString = "Data Source=VHACDWa01.vha.med.va.gov;Initial Catalog=CDWWork;Trusted_Connection=true"
                };                                                                                                                                            // TODO - need to figure out how cxn string will be handled
                AbstractConnection cxn = new gov.va.medora.mdo.dao.sql.cdw.CdwConnection(ds);
                Dictionary <string, HashSet <string> > dict = api.getUpdatedFutureAppointments(cxn, DateTime.Parse(updatedSince));
                result.arrays = new TaggedPatientArray[dict.Keys.Count];
                int arrayCount = 0;

                foreach (string key in dict.Keys)
                {
                    TaggedPatientArray tpa = new TaggedPatientArray(key);
                    tpa.patients = new PatientTO[dict[key].Count];
                    int patientCount = 0;
                    foreach (string patientICN in dict[key])
                    {
                        PatientTO p = new PatientTO {
                            mpiPid = patientICN
                        };
                        tpa.patients[patientCount] = p;
                        patientCount++;
                    }
                    result.arrays[arrayCount] = tpa;
                    arrayCount++;
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public TaggedPatientArrays getPatientsWithUpdatedChemHemReports(string username, string pwd, string fromDate)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();

            //if (String.IsNullOrEmpty(username) | String.IsNullOrEmpty(pwd) | String.IsNullOrEmpty(fromDate))
            //{
            //    result.fault = new FaultTO("Must supply all arguments");
            //}
            try
            {
                LabsApi    api = new LabsApi();
                DataSource ds  = new DataSource {
                    ConnectionString = mySession.MdwsConfiguration.CdwConnectionString
                };
                AbstractConnection cxn = new gov.va.medora.mdo.dao.sql.cdw.CdwConnection(ds);
                Dictionary <string, HashSet <string> > dict = api.getUpdatedChemHemReports(cxn, DateTime.Parse(fromDate));
                result.arrays = new TaggedPatientArray[dict.Keys.Count];
                int arrayCount = 0;

                foreach (string key in dict.Keys)
                {
                    TaggedPatientArray tpa = new TaggedPatientArray(key);
                    tpa.patients = new PatientTO[dict[key].Count];
                    int patientCount = 0;
                    foreach (string patientICN in dict[key])
                    {
                        PatientTO p = new PatientTO {
                            mpiPid = patientICN
                        };
                        tpa.patients[patientCount] = p;
                        patientCount++;
                    }
                    result.arrays[arrayCount] = tpa;
                    arrayCount++;
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Ejemplo n.º 6
0
    /// <summary>
    /// US:838
    /// retrieves a list of the users patients and transfers
    /// them to the checklist db
    /// </summary>
    /// <param name="lUserID"></param>
    /// <param name="lCount"></param>
    /// <returns></returns>
    public CStatus GetMDWSUserPatients(long lUserID, out long lCount)
    {
        lCount = 0;

        //check to make sure the MDWS connection is valid
        CStatus status = IsMDWSValid();

        if (!status.Status)
        {
            return(status);
        }

        //get the patients from MDWS
        string             strDUZ = Convert.ToString(lUserID);
        TaggedPatientArray tpa    = GetMDWSSOAPClient().getPatientsByProvider(strDUZ);

        if (tpa == null || tpa.fault != null)
        {
            //return new CMDWSStatus(tpa.fault);
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        //transfer the patients to the checklist db
        CMDWSTransfer transfer = new CMDWSTransfer(this);

        status = transfer.TransferPatientArray(
            strDUZ,
            0,
            0,
            0,
            0,
            tpa,
            out lCount);
        if (!status.Status)
        {
            return(status);
        }

        return(new CStatus());
    }
Ejemplo n.º 7
0
    /// <summary>
    /// US:838
    /// transfers patients by specialty to the checklist db
    /// </summary>
    /// <param name="lSpecialtyID"></param>
    /// <param name="lCount"></param>
    /// <returns></returns>
    public CStatus GetMDWSSpecialtyPatients(long lSpecialtyID, out long lCount)
    {
        //status
        lCount = 0;

        //check to make sure the MDWS connection is valid
        CStatus status = IsMDWSValid();

        if (!status.Status)
        {
            return(status);
        }

        //get the teams from MDWS
        TaggedPatientArray tpa = GetMDWSSOAPClient().getPatientsBySpecialty(lSpecialtyID.ToString());

        if (tpa == null || tpa.fault != null)
        {
            //return new CMDWSStatus(tpa.fault);
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        //transfer the patients to the checklist db
        CMDWSTransfer transfer = new CMDWSTransfer(this);

        status = transfer.TransferPatientArray(
            string.Empty,
            0,
            lSpecialtyID,
            0,
            0,
            tpa,
            out lCount);
        if (!status.Status)
        {
            return(status);
        }

        return(new CStatus());
    }
Ejemplo n.º 8
0
        internal TaggedPatientArray matchByNameCityState(AbstractConnection cxn, string name, string city, string stateAbbr)
        {
            TaggedPatientArray result = new TaggedPatientArray();

            if (name == "")
            {
                result.fault = new FaultTO("Missing name");
            }
            else if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (stateAbbr == "")
            {
                result.fault = new FaultTO("Missing stateAbbr");
            }
            else if (!State.isValidAbbr(stateAbbr))
            {
                result.fault = new FaultTO("Invalid stateAbbr");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                PatientApi api     = new PatientApi();
                Patient[]  matches = api.matchByNameCityState(cxn, name, city, stateAbbr);
                result = new TaggedPatientArray(cxn.DataSource.SiteId.Id, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 9
0
        public TaggedPatientArray getPatientsByProvider(string sitecode, string duz)
        {
            TaggedPatientArray result = new TaggedPatientArray();
            string             msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (duz == "")
            {
                result.fault = new FaultTO("Missing duz");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn        = mySession.ConnectionSet.getConnection(sitecode);
                PatientApi         patientApi = new PatientApi();
                Patient[]          matches    = patientApi.getPatientsByProvider(cxn, duz);
                result = new TaggedPatientArray(sitecode, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }