public DoctorAppointmentsPage()
        {
            InitializeComponent();
            _patientService = new PatientService();
            _appoitmentService = new AppointmentService();
            List<Appointment> list = _appoitmentService.FindAll();//GetNextAppointmentsByDoctorId(SessionData.UserSessionData.CurrentUserId);

            Dictionary<int, Patient> patientList = GetDictionary(_patientService.FindAll());
            List<object> dataSet = null;
            if (list != null)
            {
                dataSet = new List<object>();
                foreach (Appointment app in list)
                {
                    Patient p = patientList[app.IdPacient];
                    dataSet.Add(new { AppointmentId = app.Id, Patient = p.FirstName + " " + p.LastName, Date = app.ScheduledDate.ToString(), Time = app.Time.ToString(), Symtoms = app.Symptoms.ToString() });
                }

                this._cview = new PagingCollectionView(dataSet, 20);
                this.DataContext = this._cview;
            }
            else
            {
                buttonPrevious.IsEnabled = false;
                buttonNext.IsEnabled = false;
            }
        }
示例#2
0
 public WebApiTest()
 {
     _professionalService = new ProfessionalService();
     _patientService = new PatientService();
     _userService = new UserService();
     _documentService = new DocumentService();
     _followerService = new FollowerService();
 }
示例#3
0
 public void addVisit(Visit visit, int patient_id)
 {
     var sess = SessionProvider.createSession();
     PatientService patientService = new PatientService();
     Patient p = patientService.getPatientById(patient_id);
     visit.patient = p;
     sess.Save(visit);
     sess.Flush();
 }
 /// <summary>
 ///  Get user (identified by SessionData.UserSessionData.CurrentUserId) data from database using CredentialsService and PatientService 
 ///and display data on the page
 /// </summary>
 private void DisplayPatientInfo()
 {
     _credentialsService = new CredentialsService();
     Credentials credentials = _credentialsService.FindById(SessionData.UserSessionData.CurrentUserId);
     _patientService = new PatientService();
     Patient patient = _patientService.FindById(SessionData.UserSessionData.CurrentUserId);
     if (patient != null && credentials != null)
     {
         SetImages();
         labelPatientName.Content = patient.FirstName + " " + patient.LastName;
         labelPatientEmail.Content = credentials.Email;
         labelPatientPhone.Content = patient.PhoneNumber;
         labelPatientAddress.Content = patient.Address;
     }
 }
示例#5
0
 /// <summary>
 /// using SessionData.UserSessionData finds which user is currently logged in,
 /// using PatientService retrieve data from database about the current user, in order to fill the fields of the edit form
 /// </summary>
 private void PopulateUserForm()
 {
     _patientService = new PatientService();
     _patient        = _patientService.FindById(SessionData.UserSessionData.CurrentUserId);
     if (_patient != null)
     {
         textBoxUserFirstName.Text            = _patient.FirstName;
         textBoxUserLastName.Text             = _patient.LastName;
         textBoxUserAddress.Text              = _patient.Address;
         textBoxUserPhone.Text                = _patient.PhoneNumber;
         datePickerUserBirthdate.SelectedDate = _patient.BirthDate;
         textBoxUserGeneticDisorder.Text      = _patient.GeneticDiseases;
         textBoxUserInsuranceNr.Text          = _patient.InsuranceNumber;
     }
 }
示例#6
0
        private async Task <PatientViewModel> GetModelById(int id)
        {
            PatientViewModel model;

            string key = $"{nameof(PatientViewModel)} - {id}";

            if (!base.MedicCache.TryGetValue(key, out model))
            {
                model = await PatientService.GetPatientAsync(id);

                base.MedicCache.Set(key, model);
            }

            return(model);
        }
示例#7
0
        // Удаление выбранного пациента
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (selectedPatient != null)
            {
                PatientService service = new PatientService();

                service.Remove(selectedPatient.Id);

                var patients = service.GetAll();
                if (patients?.Count > 0)
                {
                    GetAllPatients(patients);
                }
            }
        }
示例#8
0
        public async Task GetByUserIdAsync_ShouldThrow_NullReferenceException_WithNonExistentUser()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();
            var seeder  = new Seeder();
            await seeder.SeedPatientAsync(context);

            var userManager    = this.GetUserManagerMock(context);
            var patientService = new PatientService(context, userManager.Object);

            await Assert.ThrowsAsync <NullReferenceException>(async() =>
            {
                await patientService.GetByUserIdAsync("invalidId");
            });
        }
示例#9
0
        public async Task TestCreateDTOPhoneNumbersNull()
        {
            // Arrange
            var testDTO = new PatientInputModel {
                PhoneNumbers = null
            };

            var service = new PatientService(null, null);

            // Act
            async Task Action() => await service.Create(testDTO);

            // Assert
            await Assert.ThrowsAsync <ArgumentNullException>(Action);
        }
示例#10
0
        public App()
        {
            var doctorRepository        = new DoctorRepository();
            var drugRepository          = new DrugRepository();
            var managerRepository       = new ManagerRepository();
            var medicalExamRepository   = new MedicalExamRepository();
            var medicalRecordRepository = new MedicalRecordRepository();
            var medicalSupplyRepository = new MedicalSupplyRepository();
            var notificationRepository  = new NotificationRepository();
            var patientRepository       = new PatientRepository();
            var reportRepository        = new ReportRepository();
            var resourceRepository      = new ResourceRepository();
            var roomRepository          = new RoomRepository();
            var secretaryRepository     = new SecretaryRepository();
            var textContentRepository   = new TextContentRepository();
            var renovationRepository    = new RenovationRepository();
            var guestUserRepository     = new GuestUserRepository();

            var notificationService  = new NotificationService(notificationRepository);
            var doctorService        = new DoctorService(doctorRepository, notificationService);
            var doctorReviewService  = new DoctorReviewService(medicalExamRepository);
            var drugService          = new DrugService(drugRepository, doctorService);
            var employeeService      = new EmployeeService(managerRepository, doctorService, secretaryRepository);
            var guestUserService     = new GuestUserService(guestUserRepository);
            var medicalExamService   = new MedicalExamService(medicalExamRepository);
            var medicalSupplyService = new MedicalSupplyService(medicalSupplyRepository);
            var patientService       = new PatientService(patientRepository);
            var reportService        = new ReportService(reportRepository, managerRepository);
            var resourceService      = new ResourceService(resourceRepository);
            var roomService          = new RoomService(roomRepository, renovationRepository, medicalExamService, patientService, resourceService);
            var userService          = new UserService(employeeService, patientService);
            var textContentService   = new TextContentService(textContentRepository);

            TextContentController   = new TextContentController(textContentService);
            NotificationController  = new NotificationController(notificationService);
            DoctorController        = new DoctorController(doctorService);
            DoctorReviewController  = new DoctorReviewController(doctorReviewService);
            DrugController          = new DrugController(drugService);
            EmployeeController      = new EmployeeController(employeeService);
            GuestUserController     = new GuestUserController(guestUserService);
            MedicalExamController   = new MedicalExamController(medicalExamService);
            MedicalSupplyController = new MedicalSupplyController(medicalSupplyService);
            PatientController       = new PatientController(patientService);
            ReportController        = new ReportController(reportService);
            ResourceController      = new ResourceController(resourceService);
            RoomController          = new RoomController(roomService);
            UserController          = new UserController(userService);
        }
        private void GetPatient(PatientIdentifierType identifierType, Dictionary <string, string> configDictionary, Database.Constants.DBStatusCode mockDBStatusCode, bool returnValidCache = false)
        {
            RequestResult <PatientModel> requestResult = new RequestResult <PatientModel>()
            {
                ResultStatus     = Common.Constants.ResultType.Success,
                TotalResultCount = 1,
                PageSize         = 1,
                ResourcePayload  = new PatientModel()
                {
                    FirstName = "John",
                    LastName  = "Doe",
                    HdId      = hdid,
                },
            };

            Mock <IClientRegistriesDelegate> patientDelegateMock = new Mock <IClientRegistriesDelegate>();
            var config = new ConfigurationBuilder()
                         .AddInMemoryCollection(configDictionary)
                         .Build();

            patientDelegateMock.Setup(p => p.GetDemographicsByHDIDAsync(It.IsAny <string>())).ReturnsAsync(requestResult);
            patientDelegateMock.Setup(p => p.GetDemographicsByPHNAsync(It.IsAny <string>())).ReturnsAsync(requestResult);

            DBResult <GenericCache> dbResult = new DBResult <GenericCache>()
            {
                Status = mockDBStatusCode,
            };
            Mock <IGenericCacheDelegate> genericCacheDelegateMock = new Mock <IGenericCacheDelegate>();

            genericCacheDelegateMock.Setup(p => p.CacheObject(It.IsAny <object>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), true)).Returns(dbResult);
            if (returnValidCache)
            {
                genericCacheDelegateMock.Setup(p => p.GetCacheObject <PatientModel>(It.IsAny <string>(), It.IsAny <string>())).Returns(requestResult.ResourcePayload);
            }

            IPatientService service = new PatientService(
                new Mock <ILogger <PatientService> >().Object,
                config,
                patientDelegateMock.Object,
                genericCacheDelegateMock.Object);

            // Act
            RequestResult <PatientModel> actual = Task.Run(async() => await service.GetPatient(hdid, identifierType).ConfigureAwait(true)).Result;

            // Verify
            Assert.Equal(Common.Constants.ResultType.Success, actual.ResultStatus);
            Assert.Equal(hdid, actual.ResourcePayload.HdId);
        }
示例#12
0
        public void GetAppointmentPatient_WithValidAppointmentIdAndPatient_ShouldReturnPatient()
        {
            var options = new DbContextOptionsBuilder <DentHubContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) // Give a Unique name to the DB
                          .Options;
            var dbContext   = new DentHubContext(options);
            var appointment = new Appointment
            {
                Id        = 1,
                PatientId = "1",
                DentistID = "1"
            };

            var patient1 = new DentHubUser
            {
                Id          = "1",
                Email       = "*****@*****.**",
                FirstName   = "Test",
                LastName    = "LastName",
                IsActive    = true,
                PhoneNumber = "1234",
                UserName    = "******",
            };
            var patient2 = new DentHubUser
            {
                Id          = "2",
                Email       = "*****@*****.**",
                FirstName   = "Test2",
                LastName    = "LastName2",
                IsActive    = true,
                PhoneNumber = "123456",
                UserName    = "******",
            };

            dbContext.Appointments.Add(appointment);
            dbContext.DentHubUsers.Add(patient1);
            dbContext.DentHubUsers.Add(patient2);
            dbContext.SaveChanges();

            var userRepository        = new DbRepository <DentHubUser>(dbContext);
            var appointmentRepository = new DbRepository <Appointment>(dbContext);
            var ratingRepository      = new DbRepository <Rating>(dbContext);
            var appointmentService    = new AppointmentService(appointmentRepository, ratingRepository);
            var service = new PatientService(userRepository, appointmentService);
            var result  = service.GetAppointmentPatient(1);

            Assert.Equal(patient1, result);
        }
示例#13
0
        public async Task updatepstientSuggestion(string idcard)
        {
            PatientSuggestion.Clear();

            if (!string.IsNullOrEmpty(idcard))
            {
                var resultlist = await PatientService.getpatientforsearch(idcard);



                foreach (var result in resultlist)
                {
                    PatientSuggestion.Add(result);
                }
            }
        }
示例#14
0
        [HttpGet("{id}")]       // GET /api/patientuser/{id}
        public IActionResult Validate(int id)
        {
            if (id < 0)
            {
                return(BadRequest());
            }

            // checking if feedback exists in database
            PatientUser result = PatientService.Validate(id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Redirect("http://localhost:60198"));
        }
示例#15
0
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository         = new PatientRepository(context);
            var phoneNumberService = new PatientPhoneNumberService();
            var hitchayvutService  = new HitchayvutService();
            var service            = new PatientService(repository, phoneNumberService, hitchayvutService);

            // Act
            IEnumerable <PatientModel> result = service.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.patient.Count(), result.Count());
        }
示例#16
0
        private static void GetPatient()
        {
            Console.WriteLine("Enter the Patient Id: ");
            int patientId = ReadIntKey();

            IPatient patient = PatientService.GetPatient(patientId);

            if (patient != null)
            {
                PrintPatient(patient);
            }
            else
            {
                Console.WriteLine("Patient not found.");
            }
        }
示例#17
0
        // Отмена обновления
        private void btnCancel_Click(object sender, EventArgs e)
        {
            PatientService service = new PatientService();

            if (btnUpdate.Text == "Confirm")
            {
                selectedPatient = null;
                ClearValues();
                btnUpdate.Text = "Update";
                var patients = service.GetAll();
                if (patients?.Count > 0)
                {
                    GetAllPatients(patients);
                }
            }
        }
        public ActionResult Create(PatientCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var service = new PatientService();

            if (service.CreatePatient(model))
            {
                TempData["SaveResult"] = "New Patient created.";
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Patient could not be created.");
            return(View(model));
        }
        public async Task GetDonorsPatientsByDonorsUserIdAsync_WithIncorectUserId_ShouldThrowException()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();
            var seeder  = new Seeder();
            await seeder.SeedDonorsPatientsAsync(context);

            var userManager           = this.GetUserManagerMock(context);
            var patientService        = new PatientService(context, userManager.Object);
            var donorsPatientsService = new DonorsPatientsService(context, patientService, userManager.Object);

            await Assert.ThrowsAsync <NullReferenceException>(async() =>
            {
                await donorsPatientsService.GetDonorsPatientsByDonorsUserIdAsync("invalidId");
            });
        }
示例#20
0
        private HospitalManager()
        {
            logger.Debug("Начинается инициализация управляющего блока.");

            if (SerializationService is null)
            {
                SerializationService = new JsonSerializationService();
            }
            EmployeeService  = new EmployeeService(new EmployeeRepository(SerializationService));
            DiagnosisService = new DiagnosisService(new DiagnosisRepository(SerializationService));
            TreatmentService = new TreatmentService(new TreatmentRepository(SerializationService));
            DiseaseService   = new DiseaseService(new DiseaseRepository(SerializationService));
            PatientService   = new PatientService(new PatientRepository(SerializationService));
            VisitService     = new VisitService(new VisitRepository(SerializationService));
            logger.Debug("Инициализация управляющего блока выполнена.");
        }
示例#21
0
        public async Task AllActive_ShouldReturnCorectData()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();
            var seeder  = new Seeder();
            await seeder.SeedPatientAsync(context);

            var userManager    = this.GetUserManagerMock(context);
            var patientService = new PatientService(context, userManager.Object);

            var actualResult   = patientService.AllActive().Result;
            var expectedResult = context.Patients.Where(x => x.NeededBloodBanks > 0);

            Assert.True(actualResult.Count() == expectedResult.Count());
            Assert.IsAssignableFrom <IQueryable <PatientServiceModel> >(actualResult);
        }
示例#22
0
        public void GetAllFilterByBranch_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository         = new PatientRepository(context);
            var phoneNumberService = new PatientPhoneNumberService();
            var hitchayvutService  = new HitchayvutService();
            var service            = new PatientService(repository, phoneNumberService, hitchayvutService);
            int branchId           = 1;

            // Act
            IEnumerable <PatientModel> result = service.GetAllFilterByBranch(branchId);

            // Assert
            Assert.AreEqual(context.patient.Where(x => x.branchId == branchId).Count(), result.Count());
        }
示例#23
0
        public void ConvertEntityToModel_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var     repository           = new PatientRepository(context);
            var     service = new PatientService();
            patient entity  = context.patient.Where(x => x.id == 1).FirstOrDefault();

            // Act
            PatientModel model = service.ConvertEntityToModel(entity);

            // Assert
            Assert.IsNotNull(model);
            Assert.AreEqual(model.Id, entity.id);
            Assert.AreEqual(model.Zehut, entity.zehut);
        }
示例#24
0
        public async Task UpdatePatient_FullInfo_Success()
        {
            // Arrange
            var(unitOfWork, patientRepo, dbCollection) = GetMocks();
            var service = new PatientService(unitOfWork.Object);
            var patient = new Patient
            {
                FullName = "New Name"
            };

            // Act
            await service.UpdatePatient(27, patient);

            // Assert
            Assert.AreEqual((await unitOfWork.Object.Patients.GetByIdAsync(27)).FullName, patient.FullName);
        }
示例#25
0
        public async Task GetByPatientIdAsync_ShouldReturn_CorectPatient()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();
            var seeder  = new Seeder();
            await seeder.SeedPatientAsync(context);

            var userManager    = this.GetUserManagerMock(context);
            var patientService = new PatientService(context, userManager.Object);

            var expectedResult = context.Patients.First();
            var actualResult   = await patientService.GetByPatientIdAsync(expectedResult.Id);

            Assert.Equal(expectedResult.Id, actualResult.Id);
            Assert.True(actualResult.UserId == expectedResult.UserId);
            Assert.True(actualResult.GetType() == typeof(PatientServiceModel));
        }
        public PatientRegisterViewModel()
        {
            Address = new PersonAddress();
            Patient = new Patient();
            Program = new PatientProgram();

            Gender = new PatientService().InitializeGender();

            Facilities        = new List <SelectListItem>();
            TBCategory        = new List <SelectListItem>();
            TBTypes           = new List <SelectListItem>();
            TBConfirmation    = new List <SelectListItem>();
            ResistanceProfile = new List <SelectListItem>();

            DateOfBirth  = "";
            DateEnrolled = DateTime.Now.ToString("d MMMM, yyyy");
        }
示例#27
0
        public void Setup()
        {
            _testEncounters = _factory.GenerateTestEncountersByType(1);
            _patient        = _testEncounters.First().Patient;
            _uow            = new UnitOfWork(new SyncContext());
            _emrRepository  = new EmrRepository();

            _createEmrPatientHandler   = new CreateEmrPatientHandler();
            _createEmrEncounterHandler = new CreateEmrEncounterHandler();

            _patientService   = new PatientService(_uow, _emrRepository, _createEmrPatientHandler, _createEmrEncounterHandler);
            _encounterService = _patientService.EncounterService;

            _patientService.Sync(_patient, true);
            _iqPatient = new EmrRepository().GetPatient(_patient.UuId);
            uuids      = new List <Guid>();
        }
        public PatientViewModel()
        {
            InitialiseCommands();

            patientService = new PatientService();
            patients       = new ObservableCollection <Patient>();

            PopulatePatients();

            homePage    = new HomePage();
            detailsPage = new DetailsPage();

            homePage.DataContext    = this;
            detailsPage.DataContext = this;

            SwitchToHomePage();
        }
示例#29
0
        public void AddPatient()
        {
            Patient patient = new Patient("Ivo", "Ivić", "23456117890", DateTime.Now, "ii01234");
            string  street  = "Unska 3";
            string  city    = "Zagreb";
            string  zipcode = "10000";


            var mockRepository = new Mock <IPatientRepository>();

            mockRepository.Setup(x => x.Add(It.IsAny <Patient>())).Returns(patient);
            PatientService patientService = new PatientService(mockRepository.Object);

            patientService.Add("Ivo", "Ivić", "23456117890", DateTime.Now, "ii01234", street, city, zipcode);

            mockRepository.Verify(x => x.Add(patient), Times.Once());
        }
示例#30
0
        public PatientMultipleRegisterModel()
        {
            Genders = new PatientService().InitializeGender();

            Facilities        = new List <SelectListItem>();
            TBCategory        = new List <SelectListItem>();
            ResistanceProfile = new List <SelectListItem> {
                new SelectListItem {
                    Value = "1", Text = "TB"
                },
                new SelectListItem {
                    Value = "2", Text = "MDRTB"
                }
            };
            TBConfirmation = new List <SelectListItem> {
                new SelectListItem {
                    Value = "6", Text = "BC"
                },
                new SelectListItem {
                    Value = "7", Text = "CD"
                }
            };
            TBTypes = new List <SelectListItem> {
                new SelectListItem {
                    Value = "3", Text = "P"
                },
                new SelectListItem {
                    Value = "4", Text = "Ep"
                },
            };

            Facility = 0;

            PatientModel = new List <PatientModel>();
            for (int i = 0; i < 20; i++)
            {
                PatientModel.Add(new PatientModel());
            }

            DotsBy           = new List <SelectListItem>();
            Referees         = new List <SelectListItem>();
            SputumSmearItems = new List <SelectListItem>();
            GeneXpertItems   = new List <SelectListItem>();
            HivExamItems     = new List <SelectListItem>();
            XrayExamItems    = new List <SelectListItem>();
        }
示例#31
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository         = new PatientRepository(context);
            var phoneNumberService = new PatientPhoneNumberService();
            var hitchayvutService  = new HitchayvutService();
            var service            = new PatientService(repository, phoneNumberService, hitchayvutService);
            int id = 1;

            // Act
            PatientModel result = service.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.Id);
        }
示例#32
0
        public async Task DeletePatient_TargetItem_Success()
        {
            // Arrange
            var(unitOfWork, patientRepo, dbCollection) = GetMocks();
            var service = new PatientService(unitOfWork.Object);
            var patient = new Patient
            {
                Id       = 26,
                FullName = "Delete Name"
            };

            // Act
            await service.DeletePatient(patient);

            // Assert
            Assert.IsFalse(dbCollection.ContainsKey(26));
        }
示例#33
0
        public async Task CreatePatient_FullInfo_Success()
        {
            // Arrange
            var(unitOfWork, patientRepo, dbCollection) = GetMocks();
            var service = new PatientService(unitOfWork.Object);
            var patient = new Patient
            {
                Id       = 28,
                FullName = "New Name"
            };

            // Act
            await service.CreatePatient(patient);

            // Assert
            Assert.IsTrue(dbCollection.ContainsKey(patient.Id));
        }
        /// <summary>
        ///  Get user (identified by SessionData.UserSessionData.CurrentUserId) data from database using CredentialsService and PatientService
        ///and display data on the page
        /// </summary>
        private void DisplayPatientInfo()
        {
            _credentialsService = new CredentialsService();
            Credentials credentials = _credentialsService.FindById(SessionData.UserSessionData.CurrentUserId);

            _patientService = new PatientService();
            Patient patient = _patientService.FindById(SessionData.UserSessionData.CurrentUserId);

            if (patient != null && credentials != null)
            {
                SetImages();
                labelPatientName.Content    = patient.FirstName + " " + patient.LastName;
                labelPatientEmail.Content   = credentials.Email;
                labelPatientPhone.Content   = patient.PhoneNumber;
                labelPatientAddress.Content = patient.Address;
            }
        }
        public DoctorAppointmentAssignResult(int appoitnmentId)
        {
            InitializeComponent();
            groupBox.Visibility = Visibility.Hidden;
            h_date.Visibility = Visibility.Hidden;
            h_diagnosis.Visibility = Visibility.Hidden;
            h_medication.Visibility = Visibility.Hidden;
            h_symptoms.Visibility = Visibility.Hidden;
            h_results.Visibility = Visibility.Hidden;
            _appointmentService = new AppointmentService();
            _patientService = new PatientService();
            _resultsService = new ResultsService();

            _selectedAppointment = _appointmentService.FindById(appoitnmentId);
            _selectedPatient = _patientService.FindById(_selectedAppointment.IdPacient);

            nameLabel.Content = _selectedPatient.FirstName + " " + _selectedPatient.LastName;
            insuranceNumberLabel.Content = _selectedPatient.InsuranceNumber;
            geneticDisorderLabel.Content = _selectedPatient.GeneticDiseases;
        }
示例#36
0
 public IList<Visit> getVisitsByPatientId(int patient_id)
 {
     PatientService patientService = new PatientService();
     Patient p = patientService.getPatientById(patient_id);
     return p.visits;
 }
 public PatientController()
 {
     PatientSvc = new PatientService();
     physicianSvc = new PhysicianService();
 }
示例#38
0
        private void button4_Click(object sender, EventArgs e)
        {
            int n=Convert.ToInt32 (this.tbPatients .Text );
            DateTime dt = DateTime.Now;
            for (int i = 0; i < n; i++)
            {
                PASATCore.XMLParameter x = new XMLParameter("patient");
                x.AddParameter("id", "P008");
                x.AddParameter("firstname", "Felix");
                x.AddParameter("lastname", "Jiang");
                x.AddParameter("middlename", "J");
                x.AddParameter("birthDate", "restore");
                x.AddParameter("prefix", "Mr");
                x.AddParameter("suffix", "None");

                x.AddParameter("sex", "M");
                x.AddParameter("pregnancy", "No");

                PatientService ps = new PatientService();
                XMLResult cc = ps.CreatePatient(x);

                this.pb.Value = (int)(i * 100 / n);
                this.Update();
            }

            System.TimeSpan t = DateTime.Now - dt;
            this.label1.Text = t.Seconds.ToString();
        }
 /// <summary>
 /// handler for buttonSignin click Event, 
 /// gets user input and check if is valid,
 /// if input is valid use CrentialsService and PatientService to insert a new patient, 
 /// otherwise set the errorLabel content and make it visible
 /// </summary>
 private void buttonSignin_Click(object sender, RoutedEventArgs e)
 {
     //create new user, if success redirect to login view
     _credentialsService = new CredentialsService();
     _patientService = new PatientService();
     _defaultDate = DateTime.Now;
     String patientFirstName = textBoxUserFirstName.Text;
     String patientLastName = textBoxUserLastName.Text;
     String patientAddress = textBoxUserAddress.Text;
     String patientPhone = textBoxUserPhone.Text;
     String patientGeneticDisorder = textBoxUserGeneticDisorder.Text;
     String patientInsuranceNumber = textBoxUserInsuranceNr.Text;
     String patientEmail = textBoxUserEmail.Text;
     String patientPassword = (!(passwordBoxUserPassword.Password != null && String.IsNullOrEmpty(passwordBoxUserPassword.Password))) ? Encrypter.GetMD5(passwordBoxUserPassword.Password) : "";
     DateTime patientBirthdate;
     if (datePickerUserBirthdate.SelectedDate != null)
     {
         patientBirthdate = datePickerUserBirthdate.SelectedDate.Value;
     }
     else
     {
         patientBirthdate = _defaultDate;
     }
     int patientId = 0;
     if (ValidateUserInput(patientFirstName, patientLastName, patientAddress, patientPhone, patientEmail, patientPassword
         , patientBirthdate))
     {
         try
         {
             patientId = _credentialsService.Save(new Credentials(patientEmail, patientPassword, Utils.UserTypes.PATIENT));
         }
         catch (Exception ee)
         {
             MessageBox.Show("Something went wrong ! \n" + ee.Data.ToString());
         }
         if (patientId != 0)
         {
             try
             {
                 _patientService.Save(new Patient(patientId, patientLastName, patientFirstName, patientInsuranceNumber, patientAddress, patientBirthdate, patientGeneticDisorder, patientPhone));
                 MessageBox.Show("Account created!");
                 RaiseChangePageContentEvent(new LoginContent());
             }
             catch (Exception ee)
             {
                 MessageBox.Show("Something went wrong ! \n" + ee.Data.ToString());
                 try
                 {
                     _credentialsService.Delete(patientId);
                 }
                 catch (Exception eee)
                 {
                     MessageBox.Show("Something went wrong trying to fix errors ! \n" + eee.Data.ToString());
                 }
             }
         }
     }
     else
     {
         labelError.Visibility = Visibility.Visible;
         labelError.Content = _errorMessage;
     }
 }
 /// <summary>
 /// using SessionData.UserSessionData finds which user is currently logged in,
 /// using PatientService retrieve data from database about the current user, in order to fill the fields of the edit form
 /// </summary>
 private void PopulateUserForm()
 {
     _patientService = new PatientService();
     _patient = _patientService.FindById(SessionData.UserSessionData.CurrentUserId);
     if (_patient != null)
     {
         textBoxUserFirstName.Text = _patient.FirstName;
         textBoxUserLastName.Text = _patient.LastName;
         textBoxUserAddress.Text = _patient.Address;
         textBoxUserPhone.Text = _patient.PhoneNumber;
         datePickerUserBirthdate.SelectedDate = _patient.BirthDate;
         textBoxUserGeneticDisorder.Text = _patient.GeneticDiseases;
         textBoxUserInsuranceNr.Text = _patient.InsuranceNumber;
     }
 }
        /// <summary>
        /// opens a connection to the database and initializes necessary services
        /// </summary>
        private void OpenConnection()
        {
            try
            {
                DBConnection.CreateConnection("localhost", "xe", "hr", "hr");
            }
            catch (Exception)
            {
                try
                {
                    DBConnection.CreateConnection("localhost", "ORCL", "hr", "roxana");
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            credentialsService = new CredentialsService();
            administratorService = new AdministratorService();
            patientService = new PatientService();
            doctorService = new DoctorService();
            departmentService = new DepartmentService();
            appointmentService = new AppointmentService();
            resultService = new ResultsService();
            scheduleService = new ScheduleService();
        }
示例#42
0
        private void button5_Click(object sender, EventArgs e)
        {
            XMLParameter filter = new XMLParameter("filter");
            DateTime dt = DateTime.Now;

            PatientService ps = new PatientService();
            XMLResult cc= ps.FindPatient(filter);

            System.TimeSpan t = DateTime.Now - dt;

            MessageBox.Show("Loaded " + cc.ArrayResult.Length + " patients, Cost " + (((float)t.TotalMilliseconds) / 1000).ToString() + " seconds.");
        }