Esempio n. 1
0
        public TaggedPatientArrays match(string target)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();

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

            try
            {
                PatientApi       api = new PatientApi();
                IndexedHashtable t   = api.match(mySession.ConnectionSet, target);
                return(new TaggedPatientArrays(t));
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Esempio n. 2
0
        public IList <PatientTO> match(string target)
        {
            TaggedPatientArrays tpas = _emrSvc.match(target);

            if (tpas == null || tpas.arrays == null || tpas.arrays.Length == 0)
            {
                throw new ApplicationException("Nothing returned!");
            }
            if (tpas.fault != null)
            {
                throw new ApplicationException(tpas.fault.message);
            }
            if (tpas.arrays[0] == null || tpas.arrays[0].count == 0 || tpas.arrays[0].patients == null || tpas.arrays[0].patients.Length == 0)
            {
                throw new ApplicationException("No patients returned for that search...");
            }

            IList <PatientTO> patients = new List <PatientTO>();

            foreach (PatientTO patient in tpas.arrays[0].patients)
            {
                patients.Add(patient);
            }

            return(patients);
        }
Esempio n. 3
0
        public TaggedPatientArrays matchByNameCityStateMS(string name, string city, string stateAbbr)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();
            string msg = MdwsUtils.isAuthorizedConnection(mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            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();
                IndexedHashtable matches = api.matchByNameCityState(mySession.ConnectionSet, name, city, stateAbbr);
                result = new TaggedPatientArrays(matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Esempio 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);
        }
Esempio n. 5
0
    /// <summary>
    /// US:838
    /// tranfer MDWS patients that match criteria
    /// </summary>
    /// <param name="strMatchID"></param>
    /// <param name="lCount"></param>
    /// <returns></returns>
    public CStatus GetMDWSMatchPatients(string strMatch, 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
        TaggedPatientArrays tpas = GetMDWSSOAPClient().match(strMatch);

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

        foreach (TaggedPatientArray tpa in tpas.arrays)
        {
            //transfer the patients to the checklist db
            CMDWSTransfer transfer = new CMDWSTransfer(this);
            status = transfer.TransferPatientArray(
                string.Empty,
                0,
                0,
                0,
                0,
                tpa,
                out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        return(new CStatus());
    }
Esempio n. 6
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);
        }