protected void selectPatient(object sender, EventArgs e) { try { string selectedDfn = listboxPatientMatchResults.SelectedItem.Value; IList <PatientTO> tempPatients = _mySession.TempHolder as IList <PatientTO>; PatientTO selectedPatient = null; foreach (PatientTO p in tempPatients) { if (p.localPid == selectedDfn) { selectedPatient = p; break; } } _mySession.Patient = selectedPatient; labelMessage.Text = "You have selected " + selectedPatient.name + ". All subsequent calls would normally operate operate on this patient"; panelNavigation.Visible = true; // show nav panel now that we've selected a patient } catch (Exception exc) { labelMessage.Text = exc.Message; } }
public PatientTO getDemographics() { PatientTO result = new PatientTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (String.IsNullOrEmpty(mySession.ConnectionSet.BaseConnection.Pid) || mySession.Patient == null) { result.fault = new FaultTO("Need to select patient"); } if (result.fault != null) { return(result); } try { result = new PatientTO(getHomeData(mySession.Patient)); } catch (Exception exc) { result.fault = new FaultTO(exc); } return(result); }
protected void showPatientProperties(object sender, EventArgs e) { try { string patientDfn = listboxPatientMatchResults.SelectedItem.Value; IList <PatientTO> tempPatients = _mySession.TempHolder as IList <PatientTO>; PatientTO selectedPatient = null; foreach (PatientTO p in tempPatients) { if (p.localPid == patientDfn) { selectedPatient = p; break; } } labelDfn.Text = patientDfn; labelDob.Text = selectedPatient.dob; } catch (Exception exc) { labelMessage.Text = exc.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (calendarSelectDate.SelectedDate == null || calendarSelectDate.SelectedDate.Year == 1) { calendarSelectDate.SelectedDate = DateTime.Today; _selectedDate = DateTime.Today; } else { _selectedDate = calendarSelectDate.SelectedDate; } _dao = new SchedulingDao(); UserTO user = _dao.connectAndLogin(_siteCode, _accessCode, _verifyCode); //_dao.connect("901"); //_dao.login("1programmer", "programmer1", ""); HospitalLocationTO clinic = _dao.getClinicSchedulingDetails("12"); PatientTO selectedPatient = _dao.selectPatient(_patient); _ssn = selectedPatient.ssn; labelPatientName.Text = selectedPatient.name; _dao.disconnect(); // just do this once at launch _slots = SchedulingUtils.getItemsFromAvailabilityString (clinic.clinicDisplayStartTime, Convert.ToInt32(clinic.appointmentLength), Convert.ToInt32(clinic.displayIncrements), clinic.availability); Session.Add("SLOTS", _slots); populateDropdown(_slots); } _slots = Session["SLOTS"] as IList <TimeSlot>; }
public PatientTO select(string dfn) { PatientTO result = _emrSvc.select(dfn); if (result.fault != null) { throw new ApplicationException(result.fault.message); } return(result); }
public void testSetupMultiSiteQuery() { _vistaDao.connect("901"); UserTO user = _vistaDao.login("04VEHU", "VEHU04"); PatientTO result = _vistaDao.select("3"); // need patient with ICN // this doesn't really do anything interesting since the patient only has records at // this one test system. in production, MDWS would connect to the patient's other // sites, select the same patient there _vistaDao.setupMultiSiteQuery("Every good boy deserves fudge"); // make believe BSE security phrase }
public void testSelect() { _vistaDao.connect("901"); UserTO user = _vistaDao.login("04VEHU", "VEHU04"); PatientTO result = _vistaDao.select("100022"); Assert.IsTrue(String.Equals(result.name, "BCMA,EIGHT")); Assert.IsTrue(String.Equals(result.ssn, "666330008")); Assert.IsTrue(String.Equals(result.localPid, "100022")); }
public PatientTO select(string sitecode, string localPid) { PatientTO result = new PatientTO(); string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode); if (msg != "OK") { result.fault = new FaultTO(msg); } else if (String.IsNullOrEmpty(localPid)) { result.fault = new FaultTO("Missing local PID"); } 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(); Patient p = api.select(cxn, localPid); result = new PatientTO(p); mySession.Patient = p; mySession.ConnectionSet.getConnection(sitecode).Pid = result.localPid; if (p.Confidentiality.Key > 0) { if (p.Confidentiality.Key == 1) { // do nothing here - M code takes care of this per documentation } else if (p.Confidentiality.Key == 2) { api.issueConfidentialityBulletin(mySession.ConnectionSet); } else if (p.Confidentiality.Key > 2) { mySession.ConnectionSet.disconnectAll(); throw new ApplicationException(p.Confidentiality.Value); } } } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public void testGetAllMeds() { //_vistaDao.connect("901"); //UserTO user = _vistaDao.login("04VEHU", "VEHU04"); _vistaDao.visit("Every good boy deserves fudge", "902", "901", "NEFARIOUS,USER", "2005", "123456789", "OR CPRS GUI CHART"); PatientTO result = _vistaDao.select("3"); _vistaDao.setupMultiSiteQuery("Every good boy deserves fudge"); IList <MedicationTO> results = _vistaDao.getAllMeds(); Assert.IsTrue(results.Count > 0, "Expected to see some meds"); Assert.IsTrue(String.Equals(results[0].name, "ASPIRIN TAB,EC")); }
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); }
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); }
public void testMatchNameExact() { string expectedName = "BCMA,EIGHT"; string expectedPid = "100022"; string expectedSsn = "666330008"; _vistaDao.connect("901"); UserTO user = _vistaDao.login("04VEHU", "VEHU04"); IList <PatientTO> result = _vistaDao.match(expectedName); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 1, "Matches by name usually return more than one result - need to filter/search"); PatientTO locatedRecord = null; foreach (PatientTO patient in result) { if (String.Equals(patient.localPid, expectedPid)) { locatedRecord = patient; break; } } Assert.IsNotNull(locatedRecord, "Expected to find a patient with known identifier for SSN"); Assert.IsTrue(String.IsNullOrEmpty(locatedRecord.ssn), "The match by name call does not return SSN"); Assert.IsTrue(String.IsNullOrEmpty(locatedRecord.dob), "The match by name call does not return date of birth"); Assert.IsFalse(String.IsNullOrEmpty(locatedRecord.name), "The match by name call should return name!"); Assert.IsFalse(String.IsNullOrEmpty(locatedRecord.localPid), "The match by name call should return the patient ID!"); // now - need to select patient and ensure localPid, SSN and name are all as expected PatientTO selectedPatient = _vistaDao.select(expectedPid); Assert.IsTrue(String.Equals(selectedPatient.name, expectedName)); Assert.IsTrue(String.Equals(selectedPatient.ssn, expectedSsn)); Assert.IsTrue(String.Equals(selectedPatient.localPid, expectedPid)); }
public void testMatchLastName() { string lastName = "BCMA"; string expectedName = "BCMA,TWENTY-PATIENT"; string expectedPid = "100035"; string expectedSsn = "666330020"; string expectedDob = "19350407"; _vistaDao.connect("901"); UserTO user = _vistaDao.login("04VEHU", "VEHU04"); IList <PatientTO> result = _vistaDao.match(lastName); // passing just the last name Assert.IsNotNull(result); Assert.IsTrue(result.Count > 1, "Matches by name usually return more than one result - need to filter/search"); PatientTO locatedRecord = null; foreach (PatientTO patient in result) { if (String.Equals(patient.localPid, expectedPid)) { locatedRecord = patient; break; } } // the match RPC will return, at most, 44 results - we can't always be certain those results contain // the patient for whom we are searching - if the patient is not in the collection then we can loop // the match call using the last patient's name as the start point for the search (Vista traverses the // file by the name) and quit when we no longer are looking at the correct last names (if the patient wasn't found) while (locatedRecord == null) { if (!(result[result.Count - 1].name.Contains(lastName))) // check the last result's name in the collection { Assert.Fail("Looked through all the last names {0} but didn't find the expected patient!"); } result = _vistaDao.match(result[result.Count - 1].name); // make sure to start the next search at the last name from previous' search foreach (PatientTO patient in result) { if (String.Equals(patient.localPid, expectedPid)) { locatedRecord = patient; break; } } } Assert.IsNotNull(locatedRecord, "Expected to find a patient with known identifier for SSN"); Assert.IsTrue(String.IsNullOrEmpty(locatedRecord.ssn), "The match by name call does not return SSN"); Assert.IsTrue(String.IsNullOrEmpty(locatedRecord.dob), "The match by name call does not return date of birth"); Assert.IsFalse(String.IsNullOrEmpty(locatedRecord.name), "The match by name call should return name!"); Assert.IsFalse(String.IsNullOrEmpty(locatedRecord.localPid), "The match by name call should return the patient ID!"); // now - need to select patient and ensure localPid, SSN and name are all as expected PatientTO selectedPatient = _vistaDao.select(expectedPid); Assert.IsTrue(String.Equals(selectedPatient.name, expectedName)); Assert.IsTrue(String.Equals(selectedPatient.ssn, expectedSsn)); Assert.IsTrue(String.Equals(selectedPatient.localPid, expectedPid)); Assert.IsTrue(String.Equals(selectedPatient.dob, expectedDob)); }
/// <summary> /// US:1952 US:1945 US:885 /// write a note to MDWS /// </summary> /// <param name="strPatientID"></param> /// <param name="strAuthorID"></param> /// <param name="strVisitLocationID"></param> /// <param name="strNoteTitleIEN"></param> /// <param name="strNoteText"></param> /// <returns></returns> public CStatus WriteNote( string strPatientID, string strAuthorID, string strESignature, string strVisitLocationID, string strNoteTitleIEN, string strNoteText) { //select the patient PatientTO toSelect = GetMDWSSOAPClient().select(strPatientID); // easy way to make sure we're using new value each test run -- yes //this will create a lot of notes... DateTime dtnow = DateTime.Now; string strVisitTimeStamp = dtnow.ToString("yyyyMMdd.HHmmss"); //encounter // create our encounter string // use "A" not a historical note, "H" if it was... string strEncounter = strVisitLocationID + ";" + strVisitTimeStamp + ";H"; string strCosigner = String.Empty; string strConsultIEN = String.Empty; string strPrfIEN = String.Empty; //before we start any note writing we need to verify the //esignature so that we dont have dangling notes if they //enter a bad esig one time TextTO toTxt = GetMDWSSOAPClient().isValidEsig(strESignature); if (toTxt.text == null || toTxt.text.ToUpper() != "TRUE") { return(new CStatus(false, k_STATUS_CODE.Failed, "Invalid Signature Code!")); } //write the note // //For preserving line breaks within a text block that is //being written to a note, replace the \r\n or \n characters //with a pipe (|). // NoteResultTO noteResult = GetMDWSSOAPClient().writeNote( strNoteTitleIEN, strEncounter, strNoteText.Replace("\r\n", "|"), strAuthorID, strCosigner, strConsultIEN, strPrfIEN); //check for error while writing note... if (noteResult == null || noteResult.fault != null) { return(new CMDWSStatus(noteResult.fault)); } //sign the note TextTO toSign = GetMDWSSOAPClient().signNote(noteResult.id, strAuthorID, strESignature); //check for sign error and return if (toSign.fault != null) { return(new CMDWSStatus(toSign.fault)); } //close the note TextTO closeNoteResult = GetMDWSSOAPClient().closeNote(noteResult.id, string.Empty); //check for close error and return if (closeNoteResult == null || closeNoteResult.fault != null) { return(new CMDWSStatus(closeNoteResult.fault)); } ///////////////////////////////////////////////////////////// //todo: remove this code later - test pulling back notes //////////////////////////////////////////////////////////// //select the patient /* PatientTO toP = GetMDWSSOAPClient().select(strPatientID); * * //todate is today * DateTime dtToDate = DateTime.Now; * string strToDate = CDataUtils.GetMilitaryDateAsString(dtToDate); * * //fromdate is today - lookback * int nLookBackDays = 9999; * DateTime dtFromDate = dtToDate.AddDays(-1 * nLookBackDays); * string strFromDate = CDataUtils.GetMilitaryDateAsString(dtFromDate); * * //get the notes * TaggedNoteArrays tnas = GetMDWSSOAPClient().getNotesWithText( strFromDate, * strToDate, * 0); * * string strNotes = String.Empty; * * if(tnas != null) * { * foreach (TaggedNoteArray tna in tnas.arrays) * { * if (tna.notes != null) * { * foreach (NoteTO note in tna.notes) * { * strNotes += String.Empty; * strNotes += note.timestamp; * strNotes += "\r\n"; * strNotes += note.text; * strNotes += "\r\n\r\n"; * } * } * } * } */ ////////////////////////////////////////////////////////////// //end pulling back notes ///////////////////////////////////////////////////////////// return(new CStatus()); }