Ejemplo n.º 1
0
        public TaggedText getTeams(string sitecode)
        {
            TaggedText result = new TaggedText();
            string     msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

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

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

            try
            {
                AbstractConnection cxn   = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api   = new EncounterApi();
                DictionaryHashList teams = api.getTeams(cxn);
                result = new TaggedText(sitecode, teams);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public TaggedHospitalLocationArray getWards(string sitecode)
        {
            TaggedHospitalLocationArray result = new TaggedHospitalLocationArray();
            string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

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

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

            try
            {
                AbstractConnection cxn   = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api   = new EncounterApi();
                HospitalLocation[] wards = api.getWards(cxn);
                result = new TaggedHospitalLocationArray(sitecode, wards);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public TaggedAdtArray getInpatientDischarges(string sitecode, string pid)
        {
            TaggedAdtArray result = new TaggedAdtArray();

            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();
                Adt[]        adts = api.getInpatientDischarges(mySession.ConnectionSet.getConnection(sitecode), pid);
                result = new TaggedAdtArray(sitecode, adts);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public PatientCareTeamTO getPatientCareTeamMembers(string station)
        {
            PatientCareTeamTO result = new PatientCareTeamTO();

            string msg = MdwsUtils.isAuthorizedConnection(mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (String.IsNullOrEmpty(station))
            {
                result.fault = new FaultTO("Missing station");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                PatientCareTeam   patientCareTeam   = new EncounterApi().getPatientCareTeamMembers(mySession.ConnectionSet.BaseConnection, station);
                PatientCareTeamTO patientCareTeamTO = new PatientCareTeamTO(patientCareTeam);
                result = patientCareTeamTO;
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }

            return(result);
        }
Ejemplo n.º 6
0
        public TaggedVisitArrays getMentalHealthVisits()
        {
            TaggedVisitArrays result = new TaggedVisitArrays();

            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.getMentalHealthVisits(mySession.ConnectionSet);
                return(new TaggedVisitArrays(t));
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
                return(result);
            }

            return(null);
        }
Ejemplo n.º 7
0
        public TextTO getAppointmentText(string siteId, string apptId)
        {
            TextTO result = new TextTO();

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

            try
            {
                EncounterApi api = new EncounterApi();
                string       s   = api.getAppointmentText(mySession.ConnectionSet.getConnection(siteId), apptId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 8
0
        public SiteArray getSiteDivisions(string sitecode)
        {
            SiteArray result = new SiteArray();

            if (sitecode == "")
            {
                result.fault = new FaultTO("Missing sitecode");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                EncounterApi api   = new EncounterApi();
                Site[]       sites = api.getSiteDivisions(mySession.ConnectionSet.getConnection(sitecode), sitecode);
                result = new SiteArray(sites);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 9
0
        public AppointmentTypeArray getAppointmentTypes(string target)
        {
            AppointmentTypeArray result = new AppointmentTypeArray();

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

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                IList <AppointmentType> types = new EncounterApi().getAppointmentTypes(_mySession.ConnectionSet.BaseConnection, target);
                result = new AppointmentTypeArray(types);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }
Ejemplo n.º 10
0
        public TaggedAppointmentArray getPendingAppointments(string startDate)
        {
            TaggedAppointmentArray result = new TaggedAppointmentArray();

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

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                IList <Appointment> appts = new EncounterApi().getPendingAppointments(_mySession.ConnectionSet.BaseConnection, startDate);
                result = new TaggedAppointmentArray(_mySession.ConnectionSet.BaseConnection.DataSource.SiteId.Id, appts);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }
Ejemplo n.º 11
0
        public TaggedInpatientStayArrays getStayMovementsByDateRange(string fromDate, string toDate)
        {
            TaggedInpatientStayArrays result = new TaggedInpatientStayArrays();

            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.getStayMovementsByDateRange(mySession.ConnectionSet, fromDate, toDate);
                result = new TaggedInpatientStayArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 12
0
        public TaggedIcdRptArrays getIcdSurgeryReports(string fromDate, string toDate, int nrpts)
        {
            TaggedIcdRptArrays result = new TaggedIcdRptArrays();

            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.getIcdSurgeryReports(mySession.ConnectionSet, fromDate, toDate, nrpts);
                result = new TaggedIcdRptArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 13
0
        public TaggedHospitalLocationArray getClinics(string sitecode, string target, string direction)
        {
            TaggedHospitalLocationArray result = new TaggedHospitalLocationArray();
            string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }

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

            try
            {
                AbstractConnection cxn     = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api     = new EncounterApi();
                HospitalLocation[] clinics = api.getClinics(cxn, target, direction);
                result = new TaggedHospitalLocationArray(sitecode, clinics);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 14
0
        public TaggedAppointmentArray getAppointmentsFromSite(
            string pwd, string sitecode, string mpiPid)
        {
            TaggedAppointmentArray result = new TaggedAppointmentArray();

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

            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...
                EncounterApi  api   = new EncounterApi();
                Appointment[] appts = api.getAppointments(mySession.ConnectionSet.getConnection(sitecode));
                for (int i = 0; i < appts.Length; i++)
                {
                    appts[i].Status = undecodeApptStatus(appts[i].Status);
                }
                result = new TaggedAppointmentArray(sitecode, appts);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            finally
            {
                mySession.close();
            }
            return(result);
        }
Ejemplo n.º 15
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.º 16
0
        public TaggedAdtArrays getInpatientMoves(string fromDate, string toDate, string iterLength)
        {
            TaggedAdtArrays result = new TaggedAdtArrays();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }

            try
            {
                EncounterApi     api = new EncounterApi();
                IndexedHashtable t   = api.getInpatientMoves(mySession.ConnectionSet, fromDate, toDate, iterLength);
                result = new TaggedAdtArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 17
0
        public TaggedDrgArrays getDRGRecords()
        {
            TaggedDrgArrays result = new TaggedDrgArrays();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }

            try
            {
                EncounterApi     api = new EncounterApi();
                IndexedHashtable t   = api.getDRGRecords(mySession.ConnectionSet);
                result = new TaggedDrgArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 18
0
        public TaggedVisitArray getVisits(string sitecode, string fromDate, string toDate)
        {
            TaggedVisitArray result = new TaggedVisitArray();
            string           msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (toDate == "")
            {
                toDate = DateTime.Today.ToString("yyyyMMdd");
            }
            if (result.fault != null)
            {
                return(result);
            }

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

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api = new EncounterApi();
                Visit[]            v   = api.getVisits(cxn, fromDate, toDate);
                result = new TaggedVisitArray(sitecode, v);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 19
0
        public InpatientStayTO getStayMovements(string sitecode, string checkinId)
        {
            InpatientStayTO result = new InpatientStayTO();
            string          msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

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

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

            try
            {
                AbstractConnection cxn  = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api  = new EncounterApi();
                InpatientStay      stay = api.getStayMovements(cxn, checkinId);
                result = new InpatientStayTO(stay);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 20
0
        public TaggedInpatientStayArrays getStayMovementsByPatient()
        {
            TaggedInpatientStayArrays result = new TaggedInpatientStayArrays();

            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.getStayMovementsByPatient(mySession.ConnectionSet, mySession.Patient.LocalPid);
                result = new TaggedInpatientStayArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Ejemplo n.º 21
0
        public AppointmentTO makeAppointment(string clinicId, string appointmentTimestamp, string purpose, string purposeSubcategory,
                                             string appointmentLength, string appointmentType)
        {
            AppointmentTO result = new AppointmentTO();

            if (!_mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(clinicId))
            {
                result.fault = new FaultTO("Missing clinic ID");
            }
            else if (String.IsNullOrEmpty(appointmentTimestamp))
            {
                result.fault = new FaultTO("Missing appointment timestamp");
            }
            else if (String.IsNullOrEmpty(appointmentType))
            {
                result.fault = new FaultTO("Missing appointment type");
            }
            else if (String.IsNullOrEmpty(appointmentLength))
            {
                result.fault = new FaultTO("Missing appointment length");
            }
            else if (String.IsNullOrEmpty(purpose))
            {
                result.fault = new FaultTO("Missing appointment purpose");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                Appointment appt = new Appointment()
                {
                    AppointmentType = new AppointmentType()
                    {
                        ID = appointmentType
                    },
                    Clinic = new HospitalLocation()
                    {
                        Id = clinicId
                    },
                    Length             = appointmentLength,
                    Purpose            = purpose,
                    PurposeSubcategory = purposeSubcategory,
                    Timestamp          = appointmentTimestamp
                };
                appt   = new EncounterApi().makeAppointment(_mySession.ConnectionSet.BaseConnection, appt);
                result = new AppointmentTO(appt);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }