/// <summary> /// Logic for the Change Patient Command /// </summary> /// <param name="criteria">Criteria for the command</param> /// <returns>Result from executing the command</returns> /// <remarks>This command updates the admittance/patient object based in.</remarks> protected override object ProcessCommand(CommandCriteria criteria) { Patient patient = null; // Get the admittance from criteria - This will be the object that gets updated. Admittance admittance = criteria["Admittance"] as Admittance; if (admittance != null) { // Setup the criteria required by the repositories criteria.Add("PatientId", admittance.EDPatient.PatientID.ToString()); criteria.Add("AdmittanceId", admittance.ID.ToString()); // Get the Repository Provider IRepositoryProvider factory = DIManager.Current.Get <IRepositoryProvider>(); // Load the patient related data patient = admittance.EDPatient; patient.Admittances = new AdmittanceCollection( factory.GetRepository <Admittance>("AdmittanceRepository").SelectCollection(criteria)); patient.Allergies = new AllergyCollection( factory.GetRepository <PatientAllergy>("AlleryRepository").SelectCollection(criteria)); // Load the admittance related data admittance.Orders = new MedicationOrdersCollection( factory.GetRepository <Order>("OrderRepository").SelectCollection(criteria)); admittance.Tests = new TestCollection( factory.GetRepository <Test>("TestRepository").SelectCollection(criteria)); admittance.Vitals = new VitalsCollection( factory.GetRepository <Vital>("VitalRepository").SelectCollection(criteria)); admittance.ClinicalNotes = new ClinicalNotesCollection( factory.GetRepository <ClinicalNote>("ClinicalNoteRepository").SelectCollection(criteria)); this.GetAdmittanceHistoryTests(factory, patient.Admittances, admittance.EDPatient.PatientID.ToString()); } else { // If an admittance is not based in notify the caller throw new ApplicationException("Command requires a criteria parameter called Admittance."); } return(patient); }
public void LoginToLive(string userName, string password) { CommandCriteria criteria = new CommandCriteria(); criteria.Add("UserName", userName); criteria.Add("Password", password); GetLiveLoginInfoCommand loginCommand = new GetLiveLoginInfoCommand(); loginCommand.Execute(LoginCommand_Complete, criteria); }
/// <summary> /// Handles mapping a single model item /// </summary> /// <param name="source">Object(s) returned from the data source</param> /// <returns>Mapped Model Object(s)</returns> public override Patient Map(SR.Patient source) { Patient patient = null; if (source != null) { CommandCriteria patientCriteria = new CommandCriteria(); patientCriteria.Add("PatientId", source.ID.ToString()); patient = new Patient() { PatientID = source.ID, FirstName = source.FirstName, LastName = source.LastName, MiddleName = source.MiddleName, DNR = (bool)source.DNR, Gender = source.Gender, DOB = source.DOB.ConvertToDateTime(), Infectious = (bool)source.Infectious, Suffix = source.Suffix, VIP = (bool)source.VIP }; } return(patient); }
/// <summary> /// Retrieve the test data for the patient's admittance history /// </summary> /// <param name="admittances">Patient Admittance history</param> /// <param name="patientId">Patient ID</param> /// <returns>Admittance History with test results data</returns> private AdmittanceCollection GetAdmittanceHistoryTests(IRepositoryProvider factory, AdmittanceCollection admittances, string patientId) { AdmittanceCollection admittanceHistory = admittances; // factory.Get<IRepository<Test>>("TestRepository"); IRepository <Test> testRepository = factory.GetRepository <Test>("TestRepository"); IRepository <ClinicalNote> clinicalNoteRepository = factory.GetRepository <ClinicalNote>("ClinicalNoteRepository"); foreach (Admittance admittance in admittanceHistory) { CommandCriteria criteria = new CommandCriteria(); criteria.Add("PatientId", patientId); criteria.Add("AdmittanceId", admittance.ID.ToString()); admittance.Tests = new TestCollection(testRepository.SelectCollection(criteria)); admittance.ClinicalNotes = new ClinicalNotesCollection(clinicalNoteRepository.SelectCollection(criteria)); } return(admittanceHistory); }
/// <summary> /// Execute the command for retrieving data for the currently selected patient/admittance. /// </summary> /// <remarks>This method checks to see if the admittance was already previously loaded</remarks> private void ExecuteChangePatientCommand() { if (!this.selectedPatient.Admittance.IsDataLoaded) { // Raise Story Board Event if (this.SelectedPatientChanging != null) { this.SelectedPatientChanging(this, EventArgs.Empty); } CommandCriteria criteria = new CommandCriteria(); criteria.Add("Admittance", this.selectedPatient.Admittance); ChangePatientCommand command = new ChangePatientCommand(); command.Execute(PatientChanged, criteria); } else // If data is already loaded make sure to send data binding notification { this.NotifyPatientChanged(); } }
/// <summary> /// Handles mapping a single model item /// </summary> /// <param name="source">Object(s) returned from the data source</param> /// <returns>Mapped Model Object(s)</returns> public override Admittance Map(SR.Admittance source) { CommandCriteria patientCriteria = new CommandCriteria(); patientCriteria.Add("AdmittanceId", source.ID.ToString()); return(new Admittance() { ID = source.ID, Severity = source.Severity, TimestampIn = source.TimestampIn.ConvertToDateTime(), TimestampOut = source.TimestampOut.ConvertToDateTime(), Comments = source.Comments, Diagnosis = source.Diagnosis, Location = source.Location, Disposition = source.Disposition, EDPatient = this.patientMapper.Map(source.Patient), HospitalStaff = this.staffMapper.MapToCollection(source.Staff), Complaints = this.complaintMapper.MapToCollection(source.Complaints), }); }
public void GetChatResponses() { if (!string.IsNullOrEmpty(this.ChatText)) { string contactRole = string.Empty; if (this.SelectedContact != null && this.SelectedContact.Profession != null) { contactRole = this.SelectedContact.Profession; } else { contactRole = "Default"; } CommandCriteria criteria = new CommandCriteria(); criteria.Add("Role", contactRole); this.chatRole = criteria["Role"].ToString(); GetChatResponseCommand chatResponse = new GetChatResponseCommand(); chatResponse.Execute(ChatResponseCommand_Complete, criteria); } }