public Domain.Patient setPatientInfo(Patient mPatient) { Domain.Patient patient = new Domain.Patient(); patient.id = mPatient.id; patient.alcohol = mPatient.alcoholConsumption; patient.bloodType = mPatient.bloodType; patient.cigaretteNumber = mPatient.cigarettes; patient.createdTicket = string.Empty; patient.dormNumber = mPatient.dormNumber; patient.educationalAttainment = mPatient.educationalAttainment; patient.electricity = mPatient.home.electricity; patient.fractureNumber = mPatient.fractureNumber; patient.fruitsVegetables = mPatient.fvConsumption; patient.highGlucose = mPatient.highGlucose; patient.homeMaterial = mPatient.home.material; patient.homeOwnership = mPatient.home.ownership; patient.homeType = mPatient.home.type; patient.occupation = mPatient.occupation; patient.otherAllergies = mPatient.otherAllergies; patient.otherFatherBackground = mPatient.otherFatherBackground; patient.otherMedicines = mPatient.otherMedicines; patient.otherMotherBackground = mPatient.otherMotherBackground; patient.otherPersonalBackground = mPatient.otherPersonalBackground; patient.physicalActivity = mPatient.physicalActivity; patient.residentNumber = 0; patient.water = mPatient.home.water; patient.sewage = mPatient.home.sewage; patient.departmentId = mPatient.department; patient.user = setUserInfo(mPatient); return(patient); }
public void PatientRepositoryTests_can_update() { Domain.Patient patient = new Domain.Patient() { FirstName = "Bob", LastName = "Network", CurrentAddress = new Domain.CurrentAddress() { Street = "123 Test St", Unit = "Unit", City = "Test City", State = "MA", ZipCode = "01876", ZipCodeSupplement = "1234" } }; _repo.Insert(patient); patient.FirstName = "John"; patient.LastName = "Smith"; patient.CurrentAddress.Street += "1"; patient.CurrentAddress.Unit += "1"; patient.CurrentAddress.City += "1"; patient.CurrentAddress.State = "RI"; patient.CurrentAddress.ZipCode = "12345"; patient.CurrentAddress.ZipCodeSupplement = "4321"; _repo.Update(patient); Domain.Patient fetchedPatient = _repo.Get(patient.PatientId); CompareEntities(patient, fetchedPatient); }
public Domain.Patient SavePatient(Domain.Patient mPatient) { if (mPatient.user.id == 0) { mPatient.user.passwordHash = Infrastructure.HashPasswordHelper.HashPassword(mPatient.user.passwordHash); } mPatient.user = userRepository.SaveUser(mPatient.user); if (mPatient.user.id > 0) { mPatient.userId = mPatient.user.id; patientRepository.SavePatient(mPatient); } return(mPatient); }
public HttpResponseMessage GetPatient(int documentNumber) { //Domain.User pat = patientService.GetPatientByDocumentNumber(documentNumber); Domain.Patient pat = patientService.GetPatientByDocumentNumber(documentNumber); var notes = noteService.GetAllNoteByPatient(Convert.ToInt32(pat.id)); HttpResponseMessage response = null; try { response = Request.CreateResponse(HttpStatusCode.OK, new { patient = pat, notes = notes }); } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public HttpResponseMessage Show(long id) { HttpResponseMessage response = null; try { Domain.Patient mPatient = patientService.GetPatientById(id); if (mPatient == null) { response = Request.CreateResponse(HttpStatusCode.NotFound, "Requested entity was not found in database."); } else { response = Request.CreateResponse(HttpStatusCode.OK, mPatient); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public HttpResponseMessage GetLatest(Domain.Patient mPatient) { HttpResponseMessage response = null; try { Domain.Triage mTriage = triageService.GetLatest(mPatient); if (mTriage == null) { response = Request.CreateResponse(HttpStatusCode.NotFound, "Requested entity was not found in database."); } else { response = Request.CreateResponse(HttpStatusCode.OK, mTriage); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.NotFound, ex.Message); } return(response); }
public void PatientRepositoryTests_can_insert_and_get() { Domain.Patient insertedPatient = new Domain.Patient() { FirstName = "Bob", LastName = "Network", CurrentAddress = new Domain.CurrentAddress() { Street = "123 Test St", Unit = "Unit", City = "Test City", State = "MA", ZipCode = "01876", ZipCodeSupplement = "1234" } }; _repo.Insert(insertedPatient); Assert.AreNotEqual(0, insertedPatient.PatientId); Assert.AreNotEqual(0, insertedPatient.CurrentAddress.CurrentAddressId); Domain.Patient fetchedPatient = _repo.Get(insertedPatient.PatientId); CompareEntities(insertedPatient, fetchedPatient); }
public PatientVisits(Domain.Patient Patient) : this() { this.Patient = Patient; }
private void Start() { var session = ((App)Application.Current).session; /* though patient object has been passed * to access visits the session has to be * initialised again */ Patient = session.Get<Domain.Patient>(Patient.Id); Refresh(); lblTitle.Content = Patient.Name; if (Patient.Visits.Count == 0) { CreateNewVisit(); } else { /* Sort Visit List by desc date */ lbxVisits.ItemsSource = Patient.Visits.OrderByDescending(x => x.Date_of_Examination); /* select latest visit - fires event */ lbxVisits.SelectedIndex = 0; UpdateVisit(); } }
public void PatientRepositoryTests_can_get_all() { Domain.Patient patient1 = new Domain.Patient() { FirstName = "Bob", LastName = "Network", CurrentAddress = new Domain.CurrentAddress() { Street = "123 Test St", Unit = "Unit", City = "Test City", State = "MA", ZipCode = "01876", ZipCodeSupplement = "1234" } }; Domain.Patient patient2 = new Domain.Patient() { FirstName = "Bob2", LastName = "Network2", CurrentAddress = new Domain.CurrentAddress() { Street = "1232 Test St", Unit = "Unit2", City = "Test2 City", State = "RI", ZipCode = "02876", ZipCodeSupplement = "3234" } }; _repo.Insert(patient1); _repo.Insert(patient2); IEnumerable<Domain.Patient> fetchedPatients = _repo.GetAll(); Domain.Patient fetchedPatient1 = fetchedPatients.FirstOrDefault(x => x.PatientId == patient1.PatientId); CompareEntities(patient1, fetchedPatient1); Domain.Patient fetchedPatient2 = fetchedPatients.FirstOrDefault(x => x.PatientId == patient2.PatientId); CompareEntities(patient2, fetchedPatient2); }
/// <summary> /// Creates a new patient from the given model /// </summary> /// <param name="value">Patient information</param> public void Post([FromBody]PatientModel value) { Domain.Patient patient = new Domain.Patient() { FirstName = value.FirstName, LastName = value.LastName, CurrentAddress = new Domain.CurrentAddress() { Street = value.Street, Unit = value.Unit, City = value.City, State = value.State, ZipCode = value.ZipCode, ZipCodeSupplement = value.ZipCodeSupplement, } }; _patientRepository.Insert(patient); }
public PatientDetails(Domain.Patient Patient) : this() { this.Patient = Patient; }
private void wDetails_Loaded(object sender, RoutedEventArgs e) { cbxSex.ItemsSource = Enum.GetValues(typeof(Domain.Sex)); if (Patient != null) { lblTitle.Content = "Patient Details " + Patient.Id; btnCreateNewPatient.Content = "Update"; txtName.Text = Patient.Name; txtPhone.Text = Patient.Phone; txtPin.Text = Patient.Pin; cbxSex.SelectedIndex = cbxSex.Items.IndexOf(Patient.Sex); txtState.Text = Patient.State; txtAddress.Text = Patient.Address; txtCity.Text = Patient.City; dtDate_of_Birth.Text = Patient.Date_of_Birth.ToString(); txtEmail.Text = Patient.Email; txtFather_or_spouce.Text = Patient.Father_or_Spouce; } else { Patient = new Domain.Patient(); lblTitle.Content = "Create New Patient"; btnCreateNewPatient.Content = "Create"; } }