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 TextTO getAllergiesAsXML(string appPwd, string patientICN) { TextTO result = new TextTO(); if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null || mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null) { result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!"); } if (result.fault != null) { return result; } CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]); cxn.Pid = patientICN; CdsClinicalDao dao = new CdsClinicalDao(cxn); try { result.text = dao.getAllergiesAsXML(); } catch (Exception exc) { result.fault = new FaultTO(exc); } return result; }
public TextTO closeNote(string sitecode, string noteId, string consultId) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (noteId == "") { result.fault = new FaultTO("Missing noteId"); } if (result.fault != null) { return result; } if (sitecode == null) { sitecode = _mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode); NoteApi api = new NoteApi(); string s = api.closeNote(cxn, noteId, consultId); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO getAdHocHealthSummaryByDisplayName(string sitecode, string displayName) { TextTO result = new TextTO(); if (displayName == "") { result.fault = new FaultTO("Missing display name"); } if (result.fault != null) { return result; } try { result.text = ClinicalApi.getAdHocHealthSummaryByDisplayName(mySession.ConnectionSet.getConnection(sitecode), displayName); if (result.text == null) { result.fault = new FaultTO("Site " + sitecode + " does not have " + displayName + " enabled! Please contact the site for remediation."); } } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO getLabReportsAsXML(string appPwd, string patientICN, string fromDate, string toDate) { TextTO result = new TextTO(); if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null || mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null) { result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!"); } if (result.fault != null) { return result; } CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]); cxn.Pid = patientICN; CdsLabsDao dao = new CdsLabsDao(cxn); try { // TODO - validate app password result.text = dao.getAllLabReports(fromDate, toDate, 0); // function is probably ignoring these params } catch (Exception exc) { result.fault = new FaultTO(exc); } return result; }
public TextTO getHealthSummary(string pwd, string sitecode, string mpiPid, string displayName) { TextTO result = new TextTO(); if (String.IsNullOrEmpty(sitecode)) { result.fault = new FaultTO("Missing sitecode"); } else if (mpiPid == "") { result.fault = new FaultTO("Missing mpiPid"); } else if (displayName == "") { result.fault = new FaultTO("Missing displayName"); } 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... ClinicalLib clinicalLib = new ClinicalLib(mySession); result = clinicalLib.getAdHocHealthSummaryByDisplayName(sitecode, displayName); } catch (Exception e) { result.fault = new FaultTO(e.Message); } finally { mySession.close(); } return result; }
public TextTO sendEmail(string from, string to, string subject, string body, string isBodyHTML, string username, string password) { TextTO result = new TextTO(); if (String.IsNullOrEmpty(from) || String.IsNullOrEmpty(to) || String.IsNullOrEmpty(subject) || String.IsNullOrEmpty(body)) { result.fault = new FaultTO("Must supply all parameters", "Supply a value for each of the arguments"); } if (result.fault != null) { return result; } string host = "smtp.va.gov"; int port = 25; bool enableSsl = false; bool useDefaultCredentials = false; try { MailMessage message = new MailMessage(); message.From = new MailAddress(from); if (!String.IsNullOrEmpty(isBodyHTML)) { message.IsBodyHtml = isBodyHTML.ToUpper().Equals("TRUE") ? true : false; } message.Body = body; message.Subject = subject; //to contains comma seperated email addresses message.To.Add(to); SmtpClient smtpClient = new SmtpClient(host, port); smtpClient.EnableSsl = enableSsl; smtpClient.UseDefaultCredentials = useDefaultCredentials; if (!useDefaultCredentials && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password)) { smtpClient.Credentials = new NetworkCredential(username, password); } smtpClient.Send(message); result.text = "OK"; } catch (Exception exc) { result.fault = new FaultTO(exc.Message); } return result; }
public TextTO getLrDfn(string sitecode, string dfn) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (dfn == "") { result.fault = new FaultTO("Missing dfn"); } if (result.fault != null) { return result; } if (sitecode == null) { sitecode = mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode); LabsApi api = new LabsApi(); string lrdfn = api.getLrDfn(cxn, dfn); result = new TextTO(lrdfn); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO getMedicationDetail(string siteId, string medId) { 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 (medId == "") { result.fault = new FaultTO("Missing medId"); } if (result.fault != null) { return result; } try { string s = Medication.getMedicationDetail(mySession.ConnectionSet.getConnection(siteId), medId); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
/// <summary> /// Make a patient inquiry call (address, contact numbers, NOK, etc. information) /// </summary> /// <returns>TextTO with selected patient inquiry text</returns> public TextTO patientInquiry() { TextTO result = new TextTO(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (String.IsNullOrEmpty(mySession.ConnectionSet.getConnection(mySession.ConnectionSet.BaseSiteId).Pid)) { result.fault = new FaultTO("Need to select patient"); } if (result.fault != null) { return result; } try { AbstractConnection cxn = mySession.ConnectionSet.getConnection(mySession.ConnectionSet.BaseSiteId); string selectedPatient = cxn.Pid; PatientApi api = new PatientApi(); string resultText = api.patientInquiry(cxn, selectedPatient); result = new TextTO(resultText); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO getNote(string siteId, string noteId) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, siteId); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (siteId == "") { result.fault = new FaultTO("Missing siteId"); } else if (noteId == "") { result.fault = new FaultTO("Missing noteId"); } if (result.fault != null) { return result; } try { NoteApi api = new NoteApi(); string s = api.getNoteText(_mySession.ConnectionSet.getConnection(siteId), noteId); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
public TextTO getSurgeryReportText(string siteId, string rptId) { 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 (rptId == "") { result.fault = new FaultTO("Missing rptId"); } if (result.fault != null) { return result; } try { ClinicalApi api = new ClinicalApi(); string s = api.getSurgeryReportText(mySession.ConnectionSet.getConnection(siteId), rptId); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
public TextTO getConsultNote(string siteId, string consultId) { TextTO result = new TextTO(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (String.IsNullOrEmpty(siteId)) { result.fault = new FaultTO("Missing siteId"); } else if (String.IsNullOrEmpty(consultId)) { result.fault = new FaultTO("Missing consultId"); } if (result.fault != null) { return result; } try { string s = Consult.getConsultNote(mySession.ConnectionSet.getConnection(siteId), consultId); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
public TextTO getOrderStatusForPatient(string pid, string orderableItemId) { TextTO result = new TextTO(); if (!(MdwsUtils.isAuthorizedConnection(mySession) == "OK")) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (String.IsNullOrEmpty(pid)) { result.fault = new FaultTO("Empty PID"); } else if (String.IsNullOrEmpty(orderableItemId)) { result.fault = new FaultTO("Empty Orderable Item ID"); } if (result.fault != null) { return result; } try { string s = Order.getOrderStatusForPatient(mySession.ConnectionSet.BaseConnection, pid, orderableItemId); result = new TextTO(s); } catch (Exception exc) { result.fault = new FaultTO(exc); } return result; }
public TextTO getVariableValue(string sitecode, string arg) { TextTO result = new TextTO(); 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); ToolsApi api = new ToolsApi(); string s = api.getVariableValue(cxn, arg); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO isPrfNote(string sitecode, string noteDefinitionIEN) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (noteDefinitionIEN == "") { result.fault = new FaultTO("Missing noteDefinitionIEN"); } if (result.fault != null) { return result; } if (sitecode == null) { sitecode = _mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode); bool f = _api.isPrfNote(cxn, noteDefinitionIEN); result.text = (f ? "Y" : "N"); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO getLocalPid(string sitecode, string mpiPid) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (mpiPid == "") { result.fault = new FaultTO("Missing mpiPid"); } if (result.fault != null) { return result; } if (String.IsNullOrEmpty(sitecode)) { sitecode = mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode); PatientApi api = new PatientApi(); string localPid = api.getLocalPid(cxn, mpiPid); result = new TextTO(localPid); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO signNote(string sitecode, string noteId, string userId, string esig) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (noteId == "") { result.fault = new FaultTO("Missing noteId"); } else if (esig == "") { result.fault = new FaultTO("Missing esig"); } if (userId == "") { if (_mySession.User.Uid == "") { result.fault = new FaultTO("Missing userId"); } else { userId = _mySession.User.Uid; } } if (result.fault != null) { return result; } if (sitecode == null) { sitecode = _mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode); NoteApi api = new NoteApi(); string s = api.signNote(cxn, noteId, userId, esig); if (s != "OK") { result.fault = new FaultTO(s); } else { result = new TextTO(s); } } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO disconnectSite() { TextTO result = new TextTO(); if (mySession.ConnectionSet == null || mySession.ConnectionSet.Count == 0) { result.fault = new FaultTO(NO_CONNECTIONS); return result; } try { mySession.ConnectionSet.disconnectAll(); result.text = "OK"; } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO isValidEsig(string esig) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (String.IsNullOrEmpty(esig)) { result.fault = new FaultTO("No E-Signature provided.", "Need to provide an E-Signature code"); } if (result.fault != null) { return result; } return isValidEsig(mySession.ConnectionSet.BaseConnection, esig); }
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 isValidEsig(string sitecode, string esig) { if (sitecode == "") { TextTO result = new TextTO(); result.fault = new FaultTO("Missing sitecode"); return result; } return isValidEsig(mySession.ConnectionSet.getConnection(sitecode), esig); }
public TextTO getZipcodeForCity(string city, string stateAbbr) { TextTO result = new TextTO(); if (city == "") { result.fault = new FaultTO("Missing city"); } else if (stateAbbr == "") { result.fault = new FaultTO("Missing stateAbbr"); } if (result.fault != null) { return result; } try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); string zip = dao.getZipcode(city, stateAbbr); result = new TextTO(zip); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
internal TextTO isValidEsig(AbstractConnection cxn, string esig) { TextTO result = new TextTO(); if (esig == "") { result.fault = new FaultTO("Missing esig"); } if (result.fault != null) { return result; } try { UserApi api = new UserApi(); bool f = api.isValidEsig(cxn, esig); result = new TextTO((f ? "TRUE" : "FALSE")); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public TextTO getFacadeVersion() { TextTO result = new TextTO(); try { System.Reflection.FieldInfo fi = this.GetType().GetField("VERSION"); result.text = ((string)fi.GetValue(this)); } catch (Exception) { result.fault = new FaultTO("This facade does not contain any version information"); } return result; }
public TextTO isRpcAvailable(string sitecode, string target, string context) { TextTO result = new TextTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (target == "") { result.fault = new FaultTO("Missing target"); } else if (context == "") { result.fault = new FaultTO("Missing context"); } if (result.fault != null) { return result; } if (sitecode == null) { sitecode = mySession.ConnectionSet.BaseSiteId; } try { AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode); ToolsApi api = new ToolsApi(); string s = api.isRpcAvailable(cxn, target, context); result = new TextTO(s); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }