コード例 #1
0
ファイル: Register.cshtml.cs プロジェクト: adimgg/IMed
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser
                {
                    UserName  = registerModel.Email,
                    Email     = registerModel.Email,
                    FirstName = registerModel.FirstName,
                    LastName  = registerModel.LastName,
                };
                var result = await _userManager.CreateAsync(user, registerModel.Password);

                var medicalHistory = new MedicalHistory();

                var path            = Path.Combine(_hostingEnvironment.WebRootPath, "images", "Default-welcomer.png");
                var imageFileStream = System.IO.File.OpenRead(path);

                byte[] imageByteArray;

                using (var memoryStream = new MemoryStream())
                {
                    imageFileStream.CopyTo(memoryStream);
                    imageByteArray = memoryStream.ToArray();
                }
                var patient = new Models.Patient
                {
                    Id             = user.Id,
                    User           = user,
                    MedicalHistory = medicalHistory,
                    Picture        = new ProfilePicture()
                    {
                        Id        = Guid.NewGuid().ToString(),
                        ImageData = imageByteArray
                    }
                };

                var pat = await _userManager.FindByIdAsync(patient.Id);

                await _userManager.AddToRoleAsync(pat, "Patient");

                context.Patient.Add(patient);
                await context.SaveChangesAsync();

                if (result.Succeeded)
                {
                    await _signInManager.SignInAsync(user, isPersistent : false);

                    return(RedirectToPage("/Patient/Edit"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError("", error.Description);
                    }
                }
            }
            return(Page());
        }
コード例 #2
0
 public AnalysisController(AnalysisNurse view)
 {
     this.view               = view;
     this.patientModel       = new Models.Patient();
     this.patientChartModel  = new Models.PatientChart();
     this.chartDocumentModel = new Models.ChartDocument();
 }
コード例 #3
0
        private void btnShow_Click(object sender, RoutedEventArgs e)
        {
            Models.Patient   patient = ((FrameworkElement)sender).DataContext as Models.Patient;
            ConsultationList conForm = new ConsultationList(patient);

            conForm.Show();
        }
コード例 #4
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            Models.Patient patient    = ((FrameworkElement)sender).DataContext as Models.Patient;
            addCosultation AddconForm = new addCosultation(patient);

            AddconForm.Show();
        }
コード例 #5
0
        public void RegisterPatient([FromBody]Models.Patient patient)
        {
            //int id = patientList.Count;
            Models.Patient _patient = new Models.Patient(patient.ID, patient.Name, patient.Age, patient.Sex);

            patientList.Add(_patient);
        }
コード例 #6
0
ファイル: PatientMapper.cs プロジェクト: mvuu0006/FIT3077
        /// <summary>
        /// Method to map a Fhir Model Patient element to an Patient object
        /// </summary>
        /// <param name="element"> Patient element from Fhir model </param>
        /// <returns> A Patient object with values from Fhir model element </returns>
        public override Models.Patient Map(Hl7.Fhir.Model.Patient element)
        {
            /// create a new Patient object and map values from Fhir model to it
            var patient = new Models.Patient
            {
                Id   = element.Id,
                Name = element.Name[0].ToString()
            };

            if (element.BirthDateElement != null)
            {
                patient.BirthDate = ((DateTimeOffset)element.BirthDateElement.ToDateTimeOffset()).DateTime;
            }
            else
            {
                patient.BirthDate = null;
            }

            if (Enum.TryParse(element.GenderElement.TypeName, out Gender gender))
            {
                patient.Gender = gender;
            }

            /// use Address mapper to map Patient's Address
            if (element.Address.Count > 0)
            {
                Hl7.Fhir.Model.Address address = element.Address[0];
                AddressMapper          mapper  = new AddressMapper();
                patient.Address = mapper.Map(address);
            }

            return(patient);
        }
コード例 #7
0
        public async Task <IViewComponentResult> InvokeAsync(Models.Patient currentPatient)
        {
            //List<Models.PatientData.ActivitySummary> summariesMonth = await ActivitySummaryController.Read(currentPatient.Id, DateTimeNow.ToString(italianDateFormat), "1m");
            //List<Models.PatientData.ActivitySummary> summariesWeek = await ActivitySummaryController.Read(currentPatient.Id, DateTimeNow.ToString(italianDateFormat), "1w");

            var data = new PatientPersonalData
            {
                Patient = currentPatient
            };

            //data.TotalSteps.Month = (from s in summariesMonth select s.Steps).Sum();
            //data.TotalSteps.Week = (from s in summariesWeek select s.Steps).Sum();

            //data.TotalCalories.Month = (from s in summariesMonth select s.CaloriesCategory.OutCalories).Sum();
            //data.TotalCalories.Week = (from s in summariesWeek select s.CaloriesCategory.OutCalories).Sum();

            //data.AverageFloors.Month = (from s in summariesMonth select s.Floors).Average();
            //data.AverageFloors.Week = (from s in summariesWeek select s.Floors).Average();

            data.WeightComparison.Today = await WeightController.Read(currentPatient.Id, DateTimeNow.ToString(italianDateFormat));

            data.WeightComparison.Yesterday = await WeightController.Read(currentPatient.Id, DateTimeNow.Subtract(TimeSpan.FromDays(1)).ToString(italianDateFormat));

            return(View(data));
        }
コード例 #8
0
ファイル: Edit.cshtml.cs プロジェクト: adimgg/IMed
        public void OnGet(string id)
        {
            var userId  = "";
            var patient = new Models.Patient();
            var user    = new ApplicationUser();

            if (id == null)
            {
                userId  = User.FindFirstValue(ClaimTypes.NameIdentifier);
                patient = _context.Patient.Include(i => i.User).Include(c => c.MedicalHistory).Include(p => p.Picture).AsNoTracking().FirstOrDefault(i => i.Id == userId);
                user    = _context.Users.Where(u => u.Id == userId).AsNoTracking().SingleOrDefault();
            }
            if (id != null)
            {
                patient = _context.Patient.Include(i => i.User).Include(c => c.MedicalHistory).Include(p => p.Picture).AsNoTracking().FirstOrDefault(i => i.Id == id);
                user    = _context.Users.Where(u => u.Id == id).AsNoTracking().SingleOrDefault();
            }

            pictureBase64 = Convert.ToBase64String(patient.Picture.ImageData, 0, patient.Picture.ImageData.Length);

            patientView = new PatientEditViewModel
            {
                FirstName   = user.FirstName,
                LastName    = user.LastName,
                Email       = user.Email,
                PhoneNumber = user.PhoneNumber,
                Birthday    = patient.Birthday,
                Sex         = patient.Sex,
                Weigth      = patient.Weight,
                Heigth      = patient.Heigth,
                MedicalH    = patient.MedicalHistory,
                Id          = patient.Id,
                Picture     = patient.Picture
            };
        }
コード例 #9
0
        public bool AddNewPatient(FormCollection collection)
        {
            if (collection.Get("Firstname") == null ||
                collection.Get("Lastname") == null ||
                DateTime.Parse(collection.Get("Birthdate")) == null)
            {
                return(false);
            }
            using (var db = new MedicalContext())
            {
                Patient temp = new Models.Patient
                {
                    Firstname   = collection.Get("Firstname"),
                    Lastname    = collection.Get("Lastname"),
                    Birthdate   = DateTime.Parse(collection.Get("Birthdate")),
                    Phonenumber = collection.Get("Phonenumber"),
                    Address     = collection.Get("Address"),
                    WeChat      = collection.Get("WeChat"),
                };

                if (collection.Get("Gender") == "1")
                {
                    temp.Gender = Gender.Female;
                }
                else
                {
                    temp.Gender = Gender.Male;
                }
                db.Patients.Add(temp);
                db.SaveChanges();
                return(true);
            }
        }
コード例 #10
0
ファイル: PatientDevice.cs プロジェクト: peterbork/Leisner
        public PatientDevice(int patientID, int deviceID)
        {
            Controllers.PatientController pc = new Controllers.PatientController();

            List<Models.Patient> patientList = pc.GetPatients();
            List<Models.Device> deviceList = Controllers.DeviceController.GetDevices();
            Models.Patient tempPatient = new Models.Patient();
            Models.Device tempDevice = new Models.Device();

            foreach (Models.Patient p in patientList) {
                if (patientID == p.ID) {
                    tempPatient = p;
                }
            }

            foreach (Models.Device d in deviceList) {
                if (deviceID == d.ID) {
                    tempDevice = d;
                }
            }

            this.ID = pc.GetPatientDevices().Count + 1;
            this.HandOutDate = DateTime.Now;
            this.HandInDate = new DateTime(0001, 1, 1); // definerer en dato for længe siden, for at simulerer den ikke er fastsat
            this.Patient = tempPatient;
            this.Device = tempDevice;
            this.Measurements = new List<Measurement>();
        }
コード例 #11
0
 public IActionResult VideoCallPatient()
 {
     ViewBag.HeaderName = "VideoCall";
     //if (string.IsNullOrEmpty(HttpContext.Session.GetString("SessionId")))
     //{
     //    int ApiKey = 46201082;
     //    string ApiSecret = "fbef52398143449c9b269e1357d797c64ae945be";
     //    var OpenTok = new OpenTok(ApiKey, ApiSecret);
     //    var session = OpenTok.CreateSession();
     //    // Store this sessionId in the database for later use:
     //    string sessionId = session.Id;
     //    //string token = OpenTok.GenerateToken(sessionId);
     //    double inOneMonth = (DateTime.UtcNow.Add(TimeSpan.FromDays(30)).Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
     //    string token = session.GenerateToken(role: Role.MODERATOR, expireTime: inOneMonth, data: "name=Prabhu");
     //    HttpContext.Session.SetString("OpenTokSessionId", sessionId);
     //    HttpContext.Session.SetString("Token", token);
     //}
     //ViewBag.PatientName = HttpContext.Session.GetString("UserName");
     if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserId")))
     {
         Models.Patient lpatient = lIPatient.GetPatientByPatientLoginId(HttpContext.Session.GetString("UserId"));
         if (lpatient != null)
         {
             HttpContext.Session.SetString("PatientId", lpatient.PatientLoginId);
             HttpContext.Session.SetString("PatientName", lpatient.PatientName);
             HttpContext.Session.SetString("TherapistId", lpatient.Therapistid);
         }
     }
     return(View());
 }
コード例 #12
0
        public ActionResult PatientModel(string mrn)
        {
            RetrievePatientInformation info = new RetrievePatientInformation();
            Patient pat = new Models.Patient();

            pat = info.GetPatient(mrn);
            return(View(pat));
        }
コード例 #13
0
        public ConsultationList(Models.Patient consultation)
        {
            InitializeComponent();

            var conList = BLL.ConsultationBLL.List(consultation.PatientID);

            dgCons.ItemsSource = conList;
        }
コード例 #14
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Models.Patient patient = await db.Patients.FindAsync(id);

            db.Patients.Remove(patient);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #15
0
 public AnalyticsController(ManagerAnalytics view)
 {
     this.view                 = view;
     this.serviceModel         = new Models.Service();
     this.patientModel         = new Models.Patient();
     this.doctorModel          = new Models.Doctor();
     this.nurseModel           = new Models.Nurse();
     this.reservationAnalytics = new Models.ReservationAnalytics();
 }
コード例 #16
0
 public ReservationsController(Reservations view)
 {
     this.view             = view;
     this.reservationModel = new Models.Reservation();
     this.serviceModel     = new Models.Service();
     this.patientModel     = new Models.Patient();
     this.doctorModel      = new Models.Doctor();
     this.nurseModel       = new Models.Nurse();
 }
コード例 #17
0
ファイル: FhirService.cs プロジェクト: mvuu0006/FIT3077
        /// <summary>
        /// Get all patients of a given Practitioner
        /// </summary>
        /// <param name="practitionerId"></param>
        /// <returns> a list of Patients </returns>
        public static async Task <List <Models.Patient> > GetPatientsOfPractitioner(string practitionerId)
        {
            List <Models.Patient> patientList = new List <Models.Patient>();

            SortedSet <string> patientIdList = new SortedSet <string>();

            try
            {
                var encounterQuery = new SearchParams()
                                     .Where("participant.identifier=http://hl7.org/fhir/sid/us-npi|" + practitionerId)
                                     .Include("Encounter.participant.individual")
                                     .Include("Encounter.patient")
                                     .LimitTo(LIMIT_ENTRY);
                Bundle Result = await Client.SearchAsync <Encounter>(encounterQuery);

                // implement paging for HAPI FHIR API Bundle
                while (Result != null)
                {
                    foreach (var Entry in Result.Entry)
                    {
                        // Get patient id and add to a list
                        Encounter encounter  = (Encounter)Entry.Resource;
                        string    patientRef = encounter.Subject.Reference;
                        string    patientId  = patientRef.Split('/')[1];
                        patientIdList.Add(patientId);
                    }

                    Result = Client.Continue(Result, PageDirection.Next);
                }

                // fetch patient data from the list of patient ids
                foreach (var patientId in patientIdList)
                {
                    Bundle PatientResult = await Client.SearchByIdAsync <Hl7.Fhir.Model.Patient>(patientId);

                    if (PatientResult.Entry.Count > 0)
                    {
                        // Map the FHIR Patient object to App's Patient object
                        Hl7.Fhir.Model.Patient fhirPatient = (Hl7.Fhir.Model.Patient)PatientResult.Entry[0].Resource;
                        PatientMapper          mapper      = new PatientMapper();
                        Models.Patient         patient     = mapper.Map(fhirPatient);
                        patientList.Add(patient);
                    }
                }
            }
            catch (FhirOperationException FhirException)
            {
                System.Diagnostics.Debug.WriteLine("Fhir error message: " + FhirException.Message);
            }
            catch (Exception GeneralException)
            {
                System.Diagnostics.Debug.WriteLine("General error message: " + GeneralException.Message);
            }

            return(patientList);
        }
コード例 #18
0
 public ActionResult LogOut()
 {
     Session["Pa"]      = new Models.Patient();
     Session["Palogin"] = "";
     Session["msg"]     = "";
     Session["Dng"]     = "";
     Session["NT"]      = "";
     Session["AP"]      = "";
     return(RedirectToAction("Index", "Home"));
 }
コード例 #19
0
 public PatientChartsController(OperatorPatientCharts view)
 {
     this.view               = view;
     this.patientModel       = new Models.Patient();
     this.patientChartModel  = new Models.PatientChart();
     this.chartDocumentModel = new Models.ChartDocument();
     this.allergenModel      = new Models.Allergen();
     this.counter            = 0;
     this.pageCount          = 1;
 }
        public IActionResult PutTodoItem(string id, Models.Patient patient)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            ServiceEnvironment.PatientAdapter.Update(id, patient);
            return(NoContent());
        }
コード例 #21
0
        public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,LastName,EmailAddress,PhoneNumber,Addresses,City,State,Zipcode")] Models.Patient patient)
        {
            if (ModelState.IsValid)
            {
                db.Patients.Add(patient);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(patient));
        }
コード例 #22
0
        // GET: Patients/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            _ = new Patient();
            Models.Patient patient = await db.Patients.FindAsync(id);

            return(patient == null?HttpNotFound() : (ActionResult)View(patient));
        }
コード例 #23
0
        public async Task <object> SendWeightNotification(int patientId, string doctorEmail, [FromBody] PatientWeight item)
        {
            Models.Patient patient    = await new PatientController(IPConfig, JsonStructureConfig).Read(patientId);
            var            goalWeight = await new GoalWeightController(IPConfig, JsonStructureConfig)
                                        .Read(patientId, DateTimeNow.ToString(italianDateFormat));

            if (item.Weight <= goalWeight.Goal)
            {
                await HubContext.Clients.All.SendAsync(doctorEmail + "/" + WeightConfig.Key[0], patient.Name, patientId);
            }

            return(Empty);
        }
コード例 #24
0
        internal static Models.Patient MapPatient(DataModel.Patient dBPatient)
        {
            var patient = new Models.Patient(dBPatient.Id, dBPatient.Name, dBPatient.Dob, dBPatient.Ssn, dBPatient.Insurance);

            patient.InsuranceProvider = dBPatient.Insurance;
            patient.SSN = dBPatient.Ssn;

            //create lists for these.
            patient.Timeslots      = new List <Models.Timeslot>();
            patient.Prescriptions  = new List <Models.Prescription>();
            patient.PatientReports = new List <Models.PatientReport>();

            return(patient);
        }
コード例 #25
0
        public Models.Patient CreatePatient(Models.Patient patient)
        {
            Patients pat = new Patients();

            pat.patientsArray = LoadAllPatients();
            pat.ColletionName = "Patients";
            pat.Add(patient);
            XmlSerializer serializer = new XmlSerializer(typeof(Patients));
            TextWriter    writer     = new StreamWriter(pathPatients);

            serializer.Serialize(writer, pat);
            writer.Close();
            return(patient);
        }
コード例 #26
0
        // GET: Patients/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Models.Patient patient = await db.Patients.FindAsync(id);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            return(View(patient));
        }
コード例 #27
0
        /// <summary>
        /// Get patients of a specific doctor
        /// </summary>
        /// <param name="id">The id of the doctor whose patients are being requested</param>
        /// <returns>A list of patients of a doctor</returns>
        public IEnumerable <Models.Patient> GetDoctorPatients(int doctorId)
        {
            var DBPatients = _context.Patients.Where(o => o.DoctorId == doctorId).ToList();
            var doctor     = GetDoctorByID(doctorId);

            List <Models.Patient> patients = new List <Models.Patient>();

            foreach (var patient in DBPatients)
            {
                Models.Patient next = new Models.Patient(patient.Id, patient.Name, patient.Dob, patient.Ssn, patient.Insurance);
                next.PrimaryDoctor = doctor;
                patients.Add(next);
            }

            return(patients);
        }
コード例 #28
0
        public ActionResult PaLogin(Models.Patient pa)
        {
            var v = db.Patients.Where(e => e.Email.ToLower() == pa.Email && e.PassWord == pa.PassWord).ToList();

            if (v.Count <= 0)
            {
                Session["Dng"] = "You Are Not An Admin. Denger Request";
                Session["msg"] = "Invalid Login Please Check Your Email Or PassWard";
                return(View(pa));
            }

            Session["Pa"]      = v.First();
            Session["Palogin"] = "******";

            return(RedirectToAction("Index", "Home"));
        }
コード例 #29
0
        public async Task <Patient> Create(PatientInfo patientInfo)
        {
            // Create a Patient model from the PatientInfo
            var patient = new Models.Patient
            {
                Uuid      = MongoDB.Bson.ObjectId.GenerateNewId().ToString(),
                FirstName = patientInfo.FirstName,
                LastName  = patientInfo.LastName,
                PatientId = patientInfo.PatientId
            };

            _logger.LogInformation($"Creating new patient with id: {patient.Uuid}");
            await _patients.InsertOneAsync(patient);

            return(patient);
        }
コード例 #30
0
        public void WhenISetAdditionalParametersByFilterpanel(Table table)
        {
            CCENPersonalDataPage cCENPersonalDataPage = new CCENPersonalDataPage();           // определяем страницу персональных данных

            if (isInsurenced)                                                                 // если ПЗ страховой
            {
                createdInsurancedPatient = table.CreateInstance <Models.InsurancedPatient>(); // берем коллекцию СтраховойПациент и заполняем страховые поля
                cCENPersonalDataPage.SetInsurancePatientData(createdInsurancedPatient.PolicyNumber, createdInsurancedPatient.Dispetcher, createdInsurancedPatient.Validity);
            }

            // далее в любом случае заполняем основные данные пациента
            createdPatient = table.CreateInstance <Models.Patient>();
            cCENPersonalDataPage.SetFIO(createdPatient.Firstname, createdPatient.Middlename, createdPatient.Lastname, createdPatient.Dateofbirth);
            cCENPersonalDataPage.SetGender(createdPatient.Gender);
            System.Threading.Thread.Sleep(900); // ожидание, поскольку есть небольшое зависание после выбора пола
        }
コード例 #31
0
        /// <summary>
        /// Add a patient to the database
        /// </summary>
        /// <param name="patient">A patient to be added to the database</param>
        public Models.Patient AddPatient(Models.Patient patient)
        {
            //todo: replace with mapper
            var newPatient = new DataModel.Patient
            {
                Name      = patient.Name,
                Dob       = patient.DateOfBirth,
                DoctorId  = patient.PrimaryDoctor.Id,
                Ssn       = patient.SSN,
                Insurance = patient.InsuranceProvider
            };

            _context.Patients.Add(newPatient);
            _context.SaveChanges();
            patient.Id = newPatient.Id;
            return(patient);
        }
コード例 #32
0
        public static Contracts.Patient ToContract(this Models.Patient patient)
        {
            if (patient == null)
            {
                return(null);
            }

            return(new Contracts.Patient()
            {
                Id = patient.Id,
                FirstName = patient.FirstName,
                LastName = patient.LastName,
                Email = patient.Email,
                Phone = patient.Phone,
                Address = patient.Address,
                DentistId = patient.DentistId
            });
        }