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; }
public TaggedInpatientStayArray getAdmissions(string sitecode) { TaggedInpatientStayArray result = new TaggedInpatientStayArray(); 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(); InpatientStay[] stays = api.getAdmissions(cxn); result = new TaggedInpatientStayArray(sitecode, stays); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
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; }
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; }
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; }
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; }
public TaggedTextArray getAdmissionsReports(string fromDate, string toDate, int nrpts) { TaggedTextArray result = new TaggedTextArray(); 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.getAdmissionsReports(mySession.ConnectionSet, fromDate, toDate, nrpts); result = new TaggedTextArray(t); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
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; }
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; }
public TaggedHospitalLocationArray getLocations(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 (result.fault != null) { return result; } if (sitecode == null) { sitecode = mySession.ConnectionSet.BaseSiteId; } if (direction == "") { direction = "1"; } try { AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode); EncounterApi api = new EncounterApi(); HospitalLocation[] locations = api.getLocations(cxn,target,direction); result = new TaggedHospitalLocationArray(sitecode,locations); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
// This needs to be changed to a single-site call. public TaggedAdtArrays getInpatientMovesByCheckinId(string checkinId) { 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.getInpatientMovesByCheckinId(mySession.ConnectionSet, checkinId); result = new TaggedAdtArrays(t); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
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; }
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; }
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; }
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; }
public TextTO getClinicAvailability(string clinicId) { TextTO result = new TextTO(); 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"); } if (result.fault != null) { return result; } try { string availabilityString = new EncounterApi().getClinicAvailability(_mySession.ConnectionSet.BaseConnection, clinicId); result = new TextTO(availabilityString); } catch (Exception exc) { result.fault = new FaultTO(exc); } return result; }
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; }
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 = mySession.MdwsConfiguration.CdwConnectionString }; 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; }
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; }
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 { 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; }