public static PatientProfileModel ToModel(this PatientProfileViewModel model) { if (model == null) { return(null); } var entity = new PatientProfileModel { ContactID = model.ContactID, ClientTypeID = model.ClientTypeID, FirstName = model.FirstName, Middle = model.Middle, LastName = model.LastName, PreferredName = model.PreferredName, MRN = model.MRN, CareID = model.CareID, GenderID = model.GenderID, DOB = model.DOB, LegalStatusID = model.LegalStatusID, EmergencyContactFirstName = model.EmergencyContactFirstName, EmergencyContactLastName = model.EmergencyContactLastName, EmergencyContactPhoneNumber = model.EmergencyContactPhoneNumber, EmergencyContactExtension = model.EmergencyContactExtension, ModifiedOn = model.ModifiedOn }; return(entity); }
public ActionResult ToothMedicalRecord(string id, ToothPosition position) { PatientProfileViewModel patientProfile = new PatientProfileViewModel(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ToothPosition newPosition = position; var patient = db.Patients.Find(id); var medicalHistory = db.MedicalHistories.Find(id); var medicalRecords = db.MedicalRecords.Where(m => m.MedicalHistoryId == id).ToList(); var ToothMedicalRecord = medicalRecords.Where(m => m.ToothPosition == newPosition); double bills = 0.0; foreach (var item in ToothMedicalRecord) { if (item.Bill > 1.0) { bills = bills + item.Bill; } } patientProfile.Patient = patient; patientProfile.MedicalHistory = medicalHistory; patientProfile.MedicalRecords = ToothMedicalRecord; patientProfile.Patient.SumBills = bills; return(View(patientProfile)); }
public AddPatientProfile() { InitializeComponent(); this._patientVM = new PatientProfileViewModel(); this.DataContext = this._patientVM; }
// GET: Patients/Details/5 public ActionResult PatientProfile(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Patient patient = db.Patient.Include(x => x.Gender) .Include(x => x.CareGivers) .Include(x => x.BloodType) .Where(x => x.Id == id) .FirstOrDefault(); if (patient == null) { return(HttpNotFound()); } PatientProfileViewModel viewModel = new PatientProfileViewModel(); Mapper.Map <Patient, PatientProfileViewModel>(patient, viewModel); int calculatedAge = new DateTime(DateTime.Now.Subtract(patient.BirthDate).Ticks).Year - 1; DateTime?dateReleased = null; if (patient.DateReleased != null) { dateReleased = patient.DateReleased; } viewModel.Age = calculatedAge; viewModel.DateReleased = dateReleased; return(View(viewModel)); }
public ActionResult ListAllMedicalRecords(string id, PatientProfileViewModel model) { PatientProfileViewModel patientProfile = new PatientProfileViewModel(); //ovdje redom pravim kverije na bazu i ona mi vraca podatke, te podatke spremim i na kraju proslijedim u view if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var patient = db.Patients.Find(id); var medicalHistory = db.MedicalHistories.Find(id); var AllmedicalRecords = db.MedicalRecords.Where(m => m.MedicalHistoryId == id).ToList(); var medicalRecords = AllmedicalRecords.OrderByDescending(p => p.DateCreated); var teeth = db.Teeth.Where(m => m.MedicalHistoryId == id).ToList(); double bills = 0.0; foreach (var item in medicalRecords) { if (item.Bill > 1.0) { bills = bills + item.Bill; } } //sve njih, strpamo u ovaj viewmodel koji smo prethodno napravili patientProfile.Patient = patient; patientProfile.MedicalHistory = medicalHistory; patientProfile.MedicalRecords = medicalRecords; patientProfile.Teeth = teeth; patientProfile.Patient.SumBills = bills; return(View(patientProfile)); }
public async Task <IActionResult> UpdatePatientProfile(Guid id, [FromBody] PatientProfileViewModel formdata) { try { if (formdata == null) { return(BadRequest(new JsonResult(new { message = "object sent from client is null." }))); } if (id == null || id == Guid.Empty) { return(BadRequest(new JsonResult(new { message = "object sent from client is null." }))); } if (id != formdata.Id) { return(BadRequest(new JsonResult(new { message = "please ensure you are updating right object" }))); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object sent from client.")); } var patientProfile = _mapper.Map <PatientProfileDto>(formdata); var patientProfileId = await _patientProfileService.UpdatePatientProfile(patientProfile); if (patientProfileId == Guid.Empty) { return(NotFound()); } patientProfile.Id = patientProfileId; return(CreatedAtAction(nameof(GetPatientProfile), new { id = patientProfileId }, _mapper.Map <PatientProfileViewModel>(patientProfile))); } catch (Exception e) { return(StatusCode(500, new JsonResult(new { message = $"Something went wrong inside update patientProfile action: {e.Message}" }))); } }
public async Task <IActionResult> AddPatientProfile([FromBody] PatientProfileViewModel formdata) { try { if (formdata == null) { return(BadRequest(new JsonResult(new { message = "object sent from client is null." }))); } else if (!ModelState.IsValid) { return(BadRequest("Invalid model object sent from client.")); } var patientProfile = _mapper.Map <PatientProfileDto>(formdata); var patientProfileData = await _patientProfileService.AddPatientProfile(patientProfile); if (patientProfileData == Guid.Empty) { return(NotFound()); } patientProfile.Id = patientProfileData; var addedPatientProfile = _mapper.Map <PatientProfileViewModel>(patientProfile); return(CreatedAtAction(nameof(GetPatientProfile), new { id = patientProfileData }, addedPatientProfile)); } catch (Exception e) { return(StatusCode(500, $"Something went wrong inside add patientProfile action: {e.Message}")); } }
public ActionResult PatientProfile(string id) { PatientProfileViewModel patientProfile = new PatientProfileViewModel(); //ovdje redom pravim kverije na bazu i ona mi vraca podatke, te podatke spremim i na kraju proslijedim u view if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var patient = db.Patients.Find(id); var medicalHistory = db.MedicalHistories.Find(id); var medicalRecords = db.MedicalRecords.Where(m => m.MedicalHistoryId == id).ToList(); var teeth = db.Teeth.Where(m => m.MedicalHistoryId == id).ToList(); var lastTwoRecords = medicalRecords.OrderByDescending(p => p.DateCreated).Take(2); var lastRecord = medicalRecords.OrderByDescending(p => p.DateCreated).Take(1); //sve njih, strpamo u ovaj viewmodel koji smo prethodno napravili patientProfile.Patient = patient; patientProfile.MedicalHistory = medicalHistory; patientProfile.MedicalRecords = lastTwoRecords; patientProfile.MedicalRecords1 = lastRecord; patientProfile.Teeth = teeth; //MedicalHistory medicalHistory = db.MedicalHistories.Find(id); //if (medicalHistory == null) //{ // return HttpNotFound(); //} //MedicalRecord medicalRecord = db.MedicalRecords.Find(id); //if (medicalRecord == null) //{ // return HttpNotFound(); //} //Tooth Teeth = db.Teeth.Find(id); /*TODO*/ /*PatientProfile patientProfile = new PatientProfile { Patient = patient, MedicalHistory = medicalHistory }; * * return View(patientProfile);*/ //i na kraju posaljemo taj viewmodel u view return(View(patientProfile)); }
public PatientProfilePage() { InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Enabled; navigationHelper = new NavigationHelper(this); navigationHelper.LoadState += NavigationHelper_LoadState; navigationHelper.SaveState += NavigationHelper_SaveState; VM = DataContext as PatientProfileViewModel; VM.ApiSettings = App.ApiSettings; VM.PropertyChanged += VM_PropertyChanged; }
public async Task <ActionResult> ViewProfile(string id) { var patientprofile = new PatientProfileViewModel() { PatientId = id, PatientDetails = await _patientServices.GetPatientDetailsById(id), Listofdoctors = _patientServices.GetDoctorsByPatient(id), Lastvisited = _appointmentServices.LastVisited(id) }; return(View(patientprofile)); }
public async Task <IActionResult> PatientProfile(string patientId = null) { string stringId = patientId ?? User.FindFirstValue("patientIdClaim"); if (String.IsNullOrWhiteSpace(stringId)) { return(RedirectToAction("RefreshToken", "Account", new { returnUrl = Request.Path.Value })); } var token = this.GetAccessTokenFromCookies(); var id = Guid.Parse(stringId); var patient = await _watchmanPatientService.GetPatientAsync(id, token); var pendingRequests = await _controlRequestService.GetPendingRequests(id, token); IList <PersonalInfoRequestIdPair> pairs = new List <PersonalInfoRequestIdPair>(); foreach (var request in pendingRequests ?? new List <ControlRequest>()) { var user = await _userManager.FindByWatchman(request.WatchmanId, token); var info = await _personalService.GetPersonalInformation(user.PersonalInformationId, token); pairs.Add(new PersonalInfoRequestIdPair(info, request.Id)); } var watchmen = await _watchmanPatientService.GetPatientWatchmenAsync(patient.Id, token); var watchmenAndInfoPair = new List <WatchmanAndPersonalInfoPair>(); foreach (var watchman in watchmen) { watchmenAndInfoPair.Add(new WatchmanAndPersonalInfoPair() { Watchman = watchman, PersonalInformation = await _personalService.GetPersonalInformation( (await _userManager.FindByWatchman(watchman.Id, token)).PersonalInformationId , token) }); } PatientProfileViewModel model = new PatientProfileViewModel(patient, pairs) { AnalysisResults = await _watchmanPatientService.GetAnalyzesMeasurementsAsync(id, null, token), IgnorableSigns = await _watchmanPatientService.GetIgnorableSignsAsync(id, token), Watchmen = watchmenAndInfoPair }; return(View(model)); }
public Profile() { InitializeComponent(); DataContext = new PatientProfileViewModel(); CompounsList.ItemsSource = PatientProfileViewModel.Compouns; UnitOfWork unitOfWork = new UnitOfWork(); var compouns = unitOfWork.Compouns.GetAll().Where(x => x.PatientId == Account.GetInstance().Id).ToList(); foreach (var compoun in compouns) { var doctor = unitOfWork.Doctors.GetAll().FirstOrDefault(x => x.Id == compoun.DoctorId); compoun.Doctor = doctor; PatientProfileViewModel.Compouns.Add(compoun); } }
public ActionResult PatientProfile() { if (Session["userId"] == null) { return(Redirect("~")); } var PatientViewObj = new PatientProfileView((int)Session["userId"]); var viewModel = new PatientProfileViewModel { Patient = PatientViewObj.GetPatientProfile(), PatientInfo = PatientViewObj.GetPatientInfo() }; return(View(viewModel)); }
public ActionResult EditPatientProfile(PatientProfileViewModel patientProfileViewModel) { patientProfileViewModel = new PatientProfileViewModel() { Name = "Sami", Email = "*****@*****.**", Birthday = "01-01-1994", age = "24", ContactNumber = "01521434331", BloodGroup = "A-ve", Area = "Dhaka", District = "Dhaka", Division = "Dhaka", Gender = "Male", Photo = "no url provied" }; return(View(model: patientProfileViewModel)); }
public ActionResult InsertMedicalRecord2(string id, PatientProfileViewModel model) { var p = db.Patients.Find(id); var PozicijaZuba = model.Tooth.ToothPosition; var StanjeZuba = model.Tooth.ToothState; var medicalRecord02 = new MedicalRecord { DateCreated = DateTime.Now, Description = model.MedicalRecord.Description, Bill = model.MedicalRecord.Bill, ToothPosition = PozicijaZuba, ToothState = StanjeZuba }; var history = db.MedicalHistories.Find(id); var zubi = history.Teeth; foreach (var i in zubi) { if (i.ToothPosition == PozicijaZuba) { i.ToothState = StanjeZuba; } } if (ModelState.IsValid) { var MedicalRecords = new List <MedicalRecord>() { medicalRecord02 }; p.MedicalHistory.MedicalRecords = MedicalRecords; db.SaveChanges(); return(RedirectToAction("PatientProfile")); } return(View()); }
public ActionResult PatientUserProfile() { if (Session["userId"] == null) { return(Redirect("~")); } if (TempData["Id"] == null) { return(RedirectToAction("Patients")); } else { var PatientViewObj = new PatientProfileView((int)TempData["Id"]); var viewModel = new PatientProfileViewModel { Patient = PatientViewObj.GetPatientProfile(), PatientInfo = PatientViewObj.GetPatientInfo() }; return(View(viewModel)); } }
public IActionResult Profile(string uuid, PatientProfileViewModel model, PatientService ps, ConceptService cs, long program = 0) { CoreService core = new CoreService(HttpContext); model.Patient = ps.GetPatient(uuid); if (program.Equals(0)) { model.Program = ps.GetPatientProgram(model.Patient); } else { model.Program = ps.GetPatientProgram(program); } if (model.Program.DotsBy.Id.Equals(0)) { return(LocalRedirect("/registration/intake/" + model.Program.Id)); } if (!model.Program.DateCompleted.HasValue) { model.Regimens = core.GetRegimensIEnumerable(model.Program.Program); model.ExamOpts = cs.GetConceptAnswersIEnumerable(new Concept(Constants.SPUTUM_SMEAR)); model.Outcomes = cs.GetConceptAnswersIEnumerable(new Concept(Constants.TREATMENT_OUTCOME)); model.Centers = core.GetAllOtherCentersIEnumerable(model.Program.Facility); model.Facility = core.GetFacilitiesIEnumerable(); } model.Regimen = core.GetPatientRegimen(model.Program); model.DateOfBirth = model.Patient.Person.DateOfBirth.ToString("dd/MM/yyyy"); model.RegimenDate = model.Regimen.StartedOn.ToString("dd/MM/yyyy"); model.Program.Facility = core.GetFacility(model.Program.Facility.Id); model.LatestVitals = ps.GetLatestVitals(model.Patient); model.Examinations = core.GetRecentExaminations(model.Program); model.Contacts = ps.GetContacts(model.Patient); return(View(model)); }
public ActionResult MedicalHistory() { PatientProfileViewModel patientProfile = new PatientProfileViewModel(); var id = User.Identity.GetUserId(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var patient = db.Patients.Find(id); var medicalHistory = db.MedicalHistories.Find(id); var medicalRecords = db.MedicalRecords.Where(m => m.MedicalHistoryId == id).ToList(); var teeth = db.Teeth.Where(m => m.MedicalHistoryId == id).ToList(); patientProfile.Patient = patient; patientProfile.MedicalHistory = medicalHistory; patientProfile.MedicalRecords = medicalRecords; patientProfile.Teeth = teeth; return(View(patientProfile)); }
public PatientProfilePage() { InitializeComponent(); BindingContext = patientProfileViewModel = new PatientProfileViewModel(); }