public IActionResult Update(PatientViewModel updatedPatient) { if (ModelState.IsValid) { var patient = new Patient(updatedPatient.Title, updatedPatient.FirstName, updatedPatient.LastName, updatedPatient.DateOfBirth, updatedPatient.PhoneNumber, updatedPatient.Address, updatedPatient.Symptom, updatedPatient.DateAdmitted, updatedPatient.Gender) { FirstName = updatedPatient.FirstName, LastName = updatedPatient.LastName, DateOfBirth = updatedPatient.DateOfBirth, Gender = updatedPatient.Gender, Address = updatedPatient.Address, Symptom = updatedPatient.Symptom, DateAdmitted = updatedPatient.DateAdmitted, MedicationFees = updatedPatient.MedicationFees, LabFees = updatedPatient.LabFees, RehabFees = updatedPatient.RehabFees, IsCheckedOut = false, PatientId = Guid.NewGuid() }; _hospital.UpdatePatient(patient); return(RedirectToAction("Index")); } else { return(View("Form", updatedPatient)); } }
public PatientViewModel GetPatient(int?id) { PatientViewModel patient = new PatientViewModel(); var list = Context.Patients .Include(a => a.Person) .ToList(); PatientViewModel patientViewModel = new PatientViewModel(); foreach (var item in list) { patientViewModel.FirstName = item.Person.FirstName; patientViewModel.MiddleName = item.Person.MiddleName; patientViewModel.LastName = item.Person.LastName; patientViewModel.FatherName = item.Person.FatherName; patientViewModel.Gender = item.Person.Gender; patientViewModel.MaritalStatus = item.Person.MaritalStatus; patientViewModel.DateOfBirth = item.Person.DateOfBirth; patientViewModel.BloodGroup = item.Person.BloodGroup; patientViewModel.TazkiraNumber = item.Person.TazkiraNumber; patientViewModel.PassportNumber = item.Person.PassportNumber; patientViewModel.PersonID = item.Person.PersonID; patientViewModel.PatientID = item.PatientID; patientViewModel.PatientType = item.PatientType; } return(patientViewModel); }
public IActionResult Create(PatientViewModel newPatient) { if (ModelState.IsValid) { var patientToCreate = new Patient(newPatient.Title, newPatient.FirstName, newPatient.LastName, newPatient.DateOfBirth, newPatient.PhoneNumber, newPatient.Symptom, newPatient.Address, newPatient.DateAdmitted, newPatient.Gender) { FirstName = newPatient.FirstName, LastName = newPatient.LastName, DateOfBirth = newPatient.DateOfBirth, Gender = newPatient.Gender, Symptom = newPatient.Symptom, Address = newPatient.Address, DateAdmitted = newPatient.DateAdmitted, IsCheckedOut = false, PatientId = Guid.NewGuid() }; _hospital.AddNewPatient(patientToCreate); return(RedirectToAction("Index")); } else { return(View("Form", newPatient)); } }
public void AddPatient(PatientViewModel PatientViewModel) { //Add Person First Person newperson = new Person(); newperson.FirstName = PatientViewModel.FirstName; newperson.MiddleName = PatientViewModel.MiddleName; newperson.LastName = PatientViewModel.LastName; newperson.FatherName = PatientViewModel.FatherName; newperson.Gender = PatientViewModel.Gender; newperson.MaritalStatus = PatientViewModel.MaritalStatus; newperson.DateOfBirth = PatientViewModel.DateOfBirth; newperson.BloodGroup = PatientViewModel.BloodGroup; newperson.TazkiraNumber = PatientViewModel.TazkiraNumber; newperson.PassportNumber = PatientViewModel.PassportNumber; Context.Persons.Add(newperson); Context.SaveChanges(); int personid = newperson.PersonID; //Add Patient by getting ID from newly created Person Patient newpatient = new Patient(); newpatient.Person = newperson; newpatient.PatientType = PatientViewModel.PatientType; Context.Patients.Add(newpatient); Context.SaveChanges(); }
public List <PatientViewModel> GetAllPatients() { // using (ApplicationDbContext appcontext = new ApplicationDbContext()) // { List <PatientViewModel> Patientslist = new List <PatientViewModel>(); var list = Context.Patients .Include(a => a.Person) .ToList(); foreach (var item in list) { PatientViewModel patientViewModel = new PatientViewModel(); patientViewModel.FirstName = item.Person.FirstName; patientViewModel.MiddleName = item.Person.MiddleName; patientViewModel.LastName = item.Person.LastName; patientViewModel.FatherName = item.Person.FatherName; patientViewModel.Gender = item.Person.Gender; patientViewModel.MaritalStatus = item.Person.MaritalStatus; patientViewModel.DateOfBirth = item.Person.DateOfBirth; patientViewModel.BloodGroup = item.Person.BloodGroup; patientViewModel.TazkiraNumber = item.Person.TazkiraNumber; patientViewModel.PassportNumber = item.Person.PassportNumber; patientViewModel.PersonID = item.Person.PersonID; patientViewModel.PatientID = item.PatientID; patientViewModel.PatientType = item.PatientType; Patientslist.Add(patientViewModel); } return(Patientslist); }
public async Task <IActionResult> Details(Patient patient) { PatientViewModel model = new PatientViewModel(); //var currentUser = await _userManager.GetUserAsync(User) as Physician; Physician currentPhysician = new Physician(); currentPhysician.ID = 3; currentPhysician.FirstName = "Doctor McDoctor"; HttpResponseMessage response = await _client.GetAsync(String.Format("{0}/{1}", PATIENT_PLANS_URL, patient.ID)); if (response.IsSuccessStatusCode) { var responseBody = await response.Content.ReadAsStringAsync(); patient.Plans = JsonConvert.DeserializeObject <List <MedicationPlan> >(responseBody); } model.CurrentPhysician = currentPhysician; model.Patient = patient; model.NewMedPlan = new MedicationPlan(); return(View(model)); }
public PatientViewModel GetPatientDetails(int patientId, List <PatientMedicalAidDependancyViewModel> patientMedicalAidDepandancies) { PatientDetailResponse response = _PhekoServiceClient.GetPatientDetails(patientId); ServiceResponse <PatientViewModel> serviceResponse = new ServiceResponse <PatientViewModel>(); serviceResponse.IsModelValid = response.HasErrors; if (response.HasErrors) { ModelException modelException = new ModelException(); response.FieldErrors.ToList <FieldError>().ForEach(item => modelException.ModelErrors.Add(new ModelError() { FieldName = item.FieldName, Message = item.ErrorMessage })); throw modelException; } PatientViewModel model = _PatientViewModelMapper.MapToPatientViewModel(response.Patient); if (response.PatientMedicalAidDependancies != null && response.PatientMedicalAidDependancies.Count() > 0) { response.PatientMedicalAidDependancies.ToList().ForEach(item => patientMedicalAidDepandancies.Add(_PatientMedicalAidDependancyViewModelMapper.MapToPatientMedicalAidDependancyViewModel(item))); } return(model); }
// GET: PatientFatma public ActionResult Index() { List <PatientViewModel> list = new List <PatientViewModel>(); foreach (var item in sp.GetAll()) { PatientViewModel pvm = new PatientViewModel(); pvm.Id = item.Id; pvm.FirstName = item.FirstName; pvm.LastName = item.LastName; pvm.BirthDate = item.BirthDate; pvm.City = item.City; pvm.CivilStatus = item.CivilStatus; pvm.Gender = item.Gender; pvm.HomeAddress = item.HomeAddress; pvm.PhoneNumber = item.PhoneNumber; pvm.RegistrationDate = item.RegistrationDate; pvm.Profession = item.Profession; pvm.SpecialReq = item.SpecialReq; pvm.Allergies = item.Allergies; list.Add(pvm); } return(View(list)); }
public async Task <ActionResult> Create(PatientViewModel patientViewModel) { if (ModelState.IsValid) { var checkingUser = UserManager.FindByEmail(patientViewModel.Email); if (checkingUser == null) { Patient patient = PatientViewModel.ToPatient(patientViewModel); patient.Doctors.AddRange(db.Doctors.ToList().Where (doctor => patientViewModel.DoctorsIds.Contains(doctor.Id))); await CreateUser(patientViewModel); ImageWorker imagePathGetter = new ImageWorker(); patient.ImageUrl = imagePathGetter.GetImageStringPath(patientViewModel.UserImage); SaveImage(patientViewModel, patient); db.Patients.Add(patient); db.SaveChanges(); return(RedirectToAction("Index")); } } patientViewModel.Doctors = db.Doctors.ToList(); patientViewModel.AttendingDoctorId = 1; return(View(patientViewModel)); }
public async Task<ActionResult> Patients(int? id, CancellationToken ct) { _credentials.OnBehalfOf = User.Identity.GetUserId(); if (id == null) { return await ViewPatients(ct); } var cache = new ResponseCache<PatientViewModel>(false, DefaultCacheTime.Long, _settings.ResponseCacheEnabled, _settings.ResponseCacheDefaultShortTimeInMinutes, _settings.ResponseCacheDefaultLongTimeInMinutes); var patientModel = cache.GetValue(Request); if (patientModel == null) { var muscles = await _glanceDa.GetMusclesAsync(_credentials, ct); var yearBounds = await _glanceDa.GetYearBoundsAsync(_credentials, id.Value, ct); var patient = await _glanceDa.GetPatientAsync(_credentials, id.Value, ct); patientModel = new PatientViewModel { Name = patient.Name, Keycol = id.Value, YearMax = yearBounds.Max, YearMin = yearBounds.Min, Muscles = muscles.ToArray(), }; cache.SetValue(Request, patientModel); } patientModel.VersionedSettings = new Tuple<string, string>(string.Empty, "{}"); return View("Patient", patientModel); }
public PartialViewResult UserByIdInformations(int id) { var cuser = new Patient(); if (sp.GetById(id) != null) { cuser = sp.GetById(id); } PatientViewModel pvm = new PatientViewModel(); pvm.LastName = cuser.LastName; pvm.FirstName = cuser.FirstName; pvm.City = cuser.City; pvm.BirthDate = cuser.BirthDate; pvm.CivilStatus = cuser.CivilStatus; pvm.Gender = cuser.Gender; pvm.HomeAddress = cuser.HomeAddress; pvm.Profession = cuser.Profession; pvm.RegistrationDate = cuser.RegistrationDate; pvm.Allergies = cuser.Allergies; pvm.SpecialReq = cuser.SpecialReq; pvm.PhoneNumber = cuser.PhoneNumber; List <PatientViewModel> listuser = new List <PatientViewModel>(); listuser.Add(pvm); int nb = st.nbTotalTreatment(id); ViewBag.nbtreat = nb; return(PartialView(listuser)); }
public IActionResult RegisterPatient(PatientViewModel patient) { string uniqueFileName = UploadedFile(patient); if (ModelState.IsValid) { Patient newPatient = new Patient { PartientName = patient.PartientName, Phone = patient.Phone, Gender = patient.Gender, Photo = uniqueFileName, BloodGroub = patient.BloodGroub, Email = patient.Email, Password = patient.Password }; hospitalDBContext.Patient.Add(newPatient); hospitalDBContext.SaveChanges(); return(RedirectToAction("PatiientHome", new RouteValueDictionary( new { controller = "Patient", action = "PatiientHome", Id = newPatient.PatientId }))); } else { return(RedirectToAction()); } }
public IActionResult CreateDiseaseHistory(PatientViewModel model) { var result = Execute(() => { bool isMedEmployee = _userManager.IsUserInMedEmployeeRole(User.Identity.Name); if (!isMedEmployee) { throw new UnauthorizedAccessException("You have not appropriate rights to access this action"); } var patientUserInfo = _userInfoService.RegisterPatient(model); var diseaseHistory = new DiseaseHistory() { PatientInfoId = patientUserInfo.UserInfoId, PatientInfo = patientUserInfo, Message = model.Message }; _diseaseHistoryService.AddDiseaseHistory(diseaseHistory); }); return(Json(result)); }
public async Task <IActionResult> CreateMedicationPlan(PatientViewModel model) { if (model == null) { RedirectToAction("Index", "Physician"); } MedicationPlan plan = new MedicationPlan(); plan.MedicationPlanId = 10; plan.PhysicianId = model.PhysicianId; plan.PatientId = model.PatientId; plan.Medication = model.NewMedPlan.Medication; plan.HourlyInterval = model.NewMedPlan.HourlyInterval; plan.PillsPerInterval = model.NewMedPlan.PillsPerInterval; plan.Completed = false; var jsonRequest = JsonConvert.SerializeObject(plan); var buffer = System.Text.Encoding.UTF8.GetBytes(jsonRequest); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); var result = _client.PostAsync(MEDICATION_PLAN_URL, byteContent); return(RedirectToAction("Index", "Physician")); }
public ActionResult Details(int id) { AddPatientToTempData(id); PatientViewModel patientViewModel = patientRepository.GetById(id).ToViewModel(); return(View(patientViewModel)); }
public async Task <PatientView> UpsertAsync(PatientViewModel patientview) { var patient = _mapper.Map <Patient>(patientview); var result = await _patientService.UpsertAsync(patient); return(_mapper.Map <PatientView>(patient)); }
public AddAppointmentViewModel() { dentalChartViewModel = new DentalChartViewModel(); dentalChartViewModel.TreatmentRecordViewModel = null; PatientViewModel = new PatientViewModel(); TreatmentViewModel = new TreatmentViewModel(); UserViewModel = new UserViewModel(); Appointment = new Appointment(); CopyAppointment = (Appointment)appointment.Clone(); DialogBoxViewModel = new DialogBoxViewModel(); SearchPatientCommand = new DelegateCommand(SearchPatient); startLoadTreatmentsThread(); startLoadPatientsThread(); startLoadUsersThread(); startLoadFromDatabase("allaboutteeth_" + GetType().Namespace.Replace("AllAboutTeethDCMS.", ""), Filter); SelectedTreatments = new ObservableCollection <Treatment>(); AddTreatmentCommand = new DelegateCommand(AddTreatment); RemoveTreatmentCommand = new DelegateCommand(RemoveTreatment); SetTimes(); }
public void UpdatePatient(PatientViewModel PatientViewModel) { //Add Person First var newperson = Context.Persons.Find(PatientViewModel.PersonID); newperson.FirstName = PatientViewModel.FirstName; newperson.MiddleName = PatientViewModel.MiddleName; newperson.LastName = PatientViewModel.LastName; newperson.FatherName = PatientViewModel.FatherName; newperson.Gender = PatientViewModel.Gender; newperson.MaritalStatus = PatientViewModel.MaritalStatus; newperson.DateOfBirth = PatientViewModel.DateOfBirth; newperson.BloodGroup = PatientViewModel.BloodGroup; newperson.TazkiraNumber = PatientViewModel.TazkiraNumber; newperson.PassportNumber = PatientViewModel.PassportNumber; var newpatient = Context.Patients.Find(PatientViewModel.PatientID); newpatient.PatientType = PatientViewModel.PatientType; Context.SaveChanges(); }
//// GET: PatientViewModels/Details/5 //public ActionResult Details(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // PatientViewModel patientViewModel = db.PatientViewModels.Find(id); // if (patientViewModel == null) // { // return HttpNotFound(); // } // return View(patientViewModel); //} //// GET: PatientViewModels/Create //public ActionResult Create() //{ // return View(); //} //// POST: PatientViewModels/Create //// Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour //// plus de détails, voir https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Create([Bind(Include = "idPers,nomPers,prenomPers,adressePers,dateNaissancePers,sexePers,cniPers,situationMatPers,emailPers,telPers,poidsPatient,taillePatient,groupeSanguinPatient,ProfessionPatient")] PatientViewModel patientViewModel) //{ // if (ModelState.IsValid) // { // db.PatientViewModels.Add(patientViewModel); // db.SaveChanges(); // return RedirectToAction("Index"); // } // return View(patientViewModel); //} //// GET: PatientViewModels/Edit/5 //public ActionResult Edit(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // PatientViewModel patientViewModel = db.PatientViewModels.Find(id); // if (patientViewModel == null) // { // return HttpNotFound(); // } // return View(patientViewModel); //} //// POST: PatientViewModels/Edit/5 //// Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour //// plus de détails, voir https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Edit([Bind(Include = "idPers,nomPers,prenomPers,adressePers,dateNaissancePers,sexePers,cniPers,situationMatPers,emailPers,telPers,poidsPatient,taillePatient,groupeSanguinPatient,ProfessionPatient")] PatientViewModel patientViewModel) //{ // if (ModelState.IsValid) // { // db.Entry(patientViewModel).State = EntityState.Modified; // db.SaveChanges(); // return RedirectToAction("Index"); // } // return View(patientViewModel); //} //// GET: PatientViewModels/Delete/5 //public ActionResult Delete(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // PatientViewModel patientViewModel = db.PatientViewModels.Find(id); // if (patientViewModel == null) // { // return HttpNotFound(); // } // return View(patientViewModel); //} //// POST: PatientViewModels/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] //public ActionResult DeleteConfirmed(int id) //{ // PatientViewModel patientViewModel = db.PatientViewModels.Find(id); // db.PatientViewModels.Remove(patientViewModel); // db.SaveChanges(); // return RedirectToAction("Index"); //} public List <PatientViewModel> getListPatient() { var listPersonne = db.personnes.ToList(); List <PatientViewModel> lesPatients = new List <PatientViewModel>(); foreach (var p in listPersonne) { PatientViewModel m = new PatientViewModel(); m.idPers = p.idPers; m.nomPers = p.nomPers; m.prenomPers = p.prenomPers; m.adressePers = p.adressePers; m.cniPers = p.cniPers; m.dateNaissancePers = p.dateNaissancePers; m.emailPers = p.emailPers; m.sexePers = p.sexePers; m.situationMatPers = p.situationMatPers; m.telPers = p.telPers; m.ProfessionPatient = db.patients.Find(p.idPers).ProfessionPatient; m.groupeSanguinPatient = db.patients.Find(p.idPers).groupeSanguinPatient; lesPatients.Add(m); } return(lesPatients); }
public IActionResult Authenticate([FromBody] PatientViewModel userVM) { var user = _userService.Authenticate(userVM.Cpf, userVM.Password); if (user == null) { return(BadRequest(new { message = "Senha ou Cpf incorretos" })); } var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(_appSettings.Secret); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, user.ID.ToString()), new Claim(ClaimTypes.Role, user.GetType().Name) }), Expires = DateTime.UtcNow.AddDays(1), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); var tokenString = tokenHandler.WriteToken(token); // return basic user info (without password) and token to store client side return(Ok(new { Id = user.ID, Cpf = user.Cpf, Name = user.Name, Token = tokenString })); }
public ActionResult Diagnosis(int id) { PatientViewModel patientViewModel = new PatientViewModel(); patientViewModel.Diagnosises = dataManager.VisitResults.GetVisitResultsByPatient(id); return(View(patientViewModel)); }
private void ViewPatient() { PatientViewModel vm = new PatientViewModel(SelectedPatient); DesktopApplication.MakeModalDocument(vm, DesktopApplication.DocumentMode.Edit); //SelectedPatient = null; }
public ActionResult ViewEditPatient(bool?isPatientEditing, int patientNumber) { Patient patient = patientRepository.GetPatientByUniqueNumber(patientNumber); if (patient == null) { return(RedirectToAction("CreatePatient")); } var model = new PatientViewModel { Id = patient.Id, Caption = patient.Caption, PatientNumber = patient.PatientNumber, EnrollDate = patient.EnrollDate, IsActive = patient.IsActive, IsEnrolled = patient.IsEnrolled, PatientInitials = patient.PatientInitials, RandomisationDate = patient.RandomisationDate, RandomisationNumber = patient.RandomisationNumber }; if (patient.IsCompleted && !(isPatientEditing ?? false)) { return(PartialView("_ViewPatient", model)); } return(PartialView("_EditPatient", model)); }
public async Task <IActionResult> FindPatientModel(string patientToFind) { var pat = _polyclinicContext.Patients.ToList(); List <PatientViewModel> patients = new List <PatientViewModel>(); foreach (var p in pat) { if (p.LName == patientToFind) { PatientViewModel model = new PatientViewModel { Id = p.Id, FName = p.FName, LName = p.LName, Age = p.Age, BDate = p.BDate, EnumStatus = p.Status, AreaId = p.AreaId, }; patients.Add(model); } } ViewBag.PatFind = patients; ViewBag.Areas = await _polyclinicContext.Areas.AsNoTracking().ToListAsync(); return(View("~/Views/Doctor/ShowMyPatients.cshtml", patients)); }
public async Task updatePatient(int id, PatientViewModel model, int count) { var patients = from p in _context.Patient where p.PatientId == id select p; foreach (var pa in patients) { pa.Address = model.Address; pa.BloodGroup = model.BloodGroup; pa.Comment = model.Comments; pa.Contact = model.ContactNo; pa.Diagnosis = model.DoctorDiagnosis; pa.Email = model.Email; pa.Fname = model.Fname; pa.Gender = model.Gender; pa.Lname = model.Lname; pa.Age = model.PatientAge; pa.Detail = model.PatientDetails; pa.History = model.PatientHistory; if (count == 1) { pa.ProfilePicture = model.Email + ".jpg"; } } try { await _context.SaveChangesAsync(); } catch (Exception e) { } }
public IActionResult Edit(PatientViewModel model) { /*if (_patientRepository.GetAll().ToList().Any(x => x.FirstName.Equals(model.FirstName) && x.LastName.Equals(model.LastName))) * ModelState.AddModelError("", "Patient with same first name and last name already exist");*/ if (!ModelState.IsValid) { return(View(model)); } try { Patient patient = model; patient.Gender = Enum.GetName(typeof(Gender), model.Gender); _patientRepository.Update(patient); _patientRepository.SaveChanges(); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { return(BadRequest()); } }
public async Task <IActionResult> Detailes(Guid id) { var patient = await _polyclinicContext.Patients.FindAsync(id); var patientViewModel = new PatientViewModel { FName = patient.FName, LName = patient.LName, Age = patient.Age, BDate = patient.BDate, EnumStatus = patient.Status, AreaId = patient.AreaId, }; ViewBag.Address = await _polyclinicContext.PatientAddresses.FindAsync(id); ViewBag.Areas = await _polyclinicContext.Areas .AsNoTracking() .ToListAsync(); ViewBag.Email = (await _userManager.FindByIdAsync(id.ToString())).Email; return(View(patientViewModel)); }
private void InitializeDevice() { _hyPrDevice = new HyPrDevice(); _hyPrDevice.RfidDataReceived += (sender, e) => { var user = (Patient)FindUserByCid(e.Rfid); if (user != null) { SelectedUser = new PatientViewModel(user); SendColorToHyPrDevice(user.Color); } else { SelectedUser = new PatientViewModel(new Patient()) { Cid = e.Rfid }; SendColorToHyPrDevice(new Rgb(0, 0, 0)); SelectedUser.Cid = e.Rfid; } if (RFIDLoaded != null) { RFIDLoaded(this, new EventArgs()); } }; }
private void SavePatient() { //var user = (Patient)FindUserByCid(_hyPrDevice.CurrentRfid); var user = (Patient)FindUserByCid(SelectedUser.Cid); if (user != null) { user.UpdateAllProperties(SelectedUser.Patient); SelectedUser = new PatientViewModel(user); _wardNode.UpdatePatient(user); } else { user = new Patient { Name = SelectedUser.Name, Color = SelectedUser.Color, Cid = SelectedUser.Cid, Tag = SelectedUser.Tag }; _wardNode.AddPatient(user); SelectedUser.UpdateAllProperties(user); } }
public IActionResult Post([FromBody] PatientViewModel patientViewModel) { try { Patient patient = new Patient(); patient.FirstName = patientViewModel.FirstName; patient.MiddleName = patientViewModel.MiddleName; patient.LastName = patientViewModel.LastName; patient.Gender = patientViewModel.Gender; patient.DOB = patientViewModel.DOB; patient.CaseType = patientViewModel.CaseType; if (!string.IsNullOrEmpty(patientViewModel.Photo)) { patient.Photo = Convert.FromBase64String(patientViewModel.Photo); } patient.PhotoType = patientViewModel.PhotoType; patient.PoliceEnquireRemark = patientViewModel.PoliceEnquireRemark; patient.PremanentAddress = patientViewModel.PremanentAddress; patient.PresentAddress = patientViewModel.PresentAddress; _patientRepository.Save(patient); return(Ok(new { Message = "Patient added successfully" })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult EditPatient(string editPatient) { if (editPatient == null) { editPatient = HttpContext.Session.GetString("PatientId"); } GetPatient model = new GetPatient(_context); Patient pa = model.getPatient(int.Parse(editPatient)); PatientViewModel p = new PatientViewModel(); p.Address = pa.Address; p.BloodGroup = pa.BloodGroup; p.Comments = pa.Comment; p.ContactNo = pa.Contact; p.DoctorDiagnosis = pa.Diagnosis; p.Email = pa.Email; p.Fname = pa.Fname; p.Gender = pa.Gender; p.Lname = pa.Lname; p.PatientAge = pa.Age; p.PatientDetails = pa.Detail; p.PatientHistory = pa.History; p.ProfilePicture = pa.ProfilePicture; HttpContext.Session.SetString("PatientId", editPatient); return(View(p)); }
/// <summary> /// Edits the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <returns>ActionResult.</returns> public ActionResult Edit(int id) { var model = new PatientViewModel(); model.Countries = HealthHelper.GetAllCountries(); if (id != -1) { var svc = new PatientAppService(); var o = svc.GetPatient(id); model.PatientId = o.PatientId; model.FirstName = o.FirstName; model.FirstLastName = o.FirstLastName; model.Gender = o.Gender; model.BirthDate = o.BirthDate; model.Identification = o.Identification; model.IdentificationType = o.IdentificationType; model.Address = o.Address; model.Phone = o.Phone; model.Mobile = o.Mobile; model.SecondName = o.SecondName; model.SecondLastName = o.SecondLastName; model.EMail = o.EMail; model.GeoCityId = o.GeoCityId; model.BirthDateText= o.BirthDate.ToString("dd/MM/yyyy"); model.GeoStateId = o.GeoCity.GeoStateId; model.GeoCountryId = o.GeoCity.GeoState.GeoCountryId; } else { model.Action = "-1"; model.PatientId = -1; model.FirstName = string.Empty; model.FirstLastName = string.Empty; model.Gender = "M"; model.BirthDate = DateTime.Now; model.Identification = string.Empty; model.IdentificationType = "-1"; model.Address = string.Empty; model.Phone = string.Empty; model.Mobile = string.Empty; model.SecondName = string.Empty; model.SecondLastName = string.Empty; model.EMail = string.Empty; model.GeoCityId = "-1"; model.BirthDateText = DateTime.Now.Date.ToString("dd/MM/yyyy"); model.GeoStateId = "-1"; model.GeoCountryId = "-1"; } return View(model); }
public ActionResult PatientRegistration(PatientViewModel patientViewModel) { if (!LogOnHelper.CheckLogOn()) return RedirectToAction("Login", "Account"); if (!ModelState.IsValid) { return View(patientViewModel); } try { HealthReunionDataAccess.HealthReunionEntities dataContext = new HealthReunionDataAccess.HealthReunionEntities(); PatientRepository patientRepository = new PatientRepository(); Patient patient = new Patient(); patient.PatientId = patientViewModel.PatientViewEntity.PatientId; patient.ProviderId = int.Parse(Session["ProviderId"].ToString()); patient.MedicalRecordNumber = Guid.NewGuid(); patient.LastName = patientViewModel.PatientViewEntity.LastName.Trim(); patient.FirstName = patientViewModel.PatientViewEntity.FirstName.Trim(); patient.MiddleName = patientViewModel.PatientViewEntity.MiddleName.Trim(); patient.DOB = DateTime.Parse(patientViewModel.PatientViewEntity.DOB).Date; patient.Address = patientViewModel.PatientViewEntity.Address.Trim(); patient.Phone = patientViewModel.PatientViewEntity.Phone.Trim(); patient.Email = patientViewModel.PatientViewEntity.Email.Trim(); patient.City = patientViewModel.PatientViewEntity.City.Trim(); patient.State = patientViewModel.PatientViewEntity.State.Trim(); patient.Country = patientViewModel.PatientViewEntity.Country; patient.IsActive = true; if (patientViewModel.PatientViewEntity.Gender.Equals("Male")) patient.Sex = true; else patient.Sex = false; if (patientViewModel.PatientViewEntity.PatientId == 0) { string defaultPassword = RandomPasswordGenerator.Generate(8); defaultPassword = EncryptDecrypt.EncryptData(defaultPassword, EncryptDecrypt.ReadCert()); patientRepository.AddPatient(patient, patientViewModel.PatientViewEntity.UserName.Trim(), defaultPassword); var sendMail = new SMTPApi(ConfigurationManager.AppSettings["SmtpFromEmailAddress"].ToString(), new List<String> { patient.Email }); var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("<b>HealthReunion Patient Portal Log On Information. Below are the credentials</b><hr/>"); stringBuilder.AppendFormat("<br/>User Name: {0}", patientViewModel.PatientViewEntity.UserName.Trim()); stringBuilder.AppendFormat("<br/>Password: {0}", defaultPassword); stringBuilder.AppendLine("<br/><hr/>Please log on to HealthReunion Patient Portal - http://healthreunionpatients.azurewebsites.net/ to access your clinical information."); sendMail.SimpleHtmlEmail(stringBuilder.ToString()); } else { patientRepository.UpdatePatient(patient, patientViewModel.PatientViewEntity.UserName.Trim()); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View(patientViewModel); } ViewBag.Message = string.Format("Patient '{0} {1} {2}' Created Sucessfully!. An Email is trigged to {3} with credentials to Log in to HealthReunion Patient Portal.", patientViewModel.PatientViewEntity.FirstName, patientViewModel.PatientViewEntity.MiddleName, patientViewModel.PatientViewEntity.LastName, patientViewModel.PatientViewEntity.Email); patientViewModel.PatientViewEntity = new PatientViewEntity(); patientViewModel.PatientViewModelGrid = GetPatientsForLoggedInProvider(); return View(patientViewModel); }
public ActionResult PatientRegistration() { if (!LogOnHelper.CheckLogOn()) return RedirectToAction("Login", "Account"); var patientViewModel = new PatientViewModel(); patientViewModel.PatientViewModelGrid = GetPatientsForLoggedInProvider(); return View(patientViewModel); }
public DataTablesResult<PatientViewModel> GetAllRecords(DataTablesParam dataTableParam) { var svc = new PatientAppService(); var lst = svc.GetAllPatient(); var lstVm = new List<PatientViewModel>(); foreach (var itm in lst) { var itmVm = new PatientViewModel { PatientId = itm.PatientId, FirstName = itm.FirstName, FullName = itm.FirstLastName.ToUpper() + ", " + System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(itm.FirstName.ToLower()), FirstLastName = itm.FirstLastName, IdentificationText = itm.Identification + " (" + itm.IdentificationType + ")", Gender = itm.Gender, BirthDate = itm.BirthDate, Age = DateTimeExtension.ToAgeString(itm.BirthDate), Identification = itm.Identification, IdentificationType = itm.IdentificationType, Address = itm.Address, Phone = itm.Phone, Mobile = itm.Mobile, SecondName = itm.SecondName, SecondLastName = itm.SecondLastName, EMail = itm.EMail, GeoCityId = itm.GeoCityId, }; var sb = new StringBuilder(); string editUrl = Url.Action("Edit", "Patient"); string subscriptionUrl = Url.Action("Index", "Subscription"); sb.AppendLine("<div class=\"btn-group\">"); sb.AppendLine( "<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" aria-expanded=\"false\">"); sb.AppendLine("Acciones <span class=\"caret\"></span>"); sb.AppendLine("</button>"); sb.AppendLine("<ul class=\"dropdown-menu\" role=\"menu\">"); sb.AppendLine("<li><a href=\"" + editUrl + "?id=-1\"><i class=\"fa fa-plus\"></i> Nuevo Registro</a></li>"); sb.AppendLine("<li><a href=\"" + editUrl + "?id=" + itmVm.PatientId + "\"><i class=\"fa fa-edit\"></i> Editar " + itmVm.FullName + "</a></li>"); sb.AppendLine("<li><a href=\"" + subscriptionUrl + "?id=" + itmVm.PatientId + "\"><i class=\"fa fa-edit\"></i> Subscripción " + itmVm.FullName + "</a></li>"); sb.AppendLine("</ul>"); sb.AppendLine("</div>"); var actionButton = sb.ToString(); itmVm.ActionButton = actionButton; lstVm.Add(itmVm); } var lstVmQueryable = lstVm.AsQueryable(); return DataTablesResult.Create(lstVmQueryable, dataTableParam); }
public ActionResult Edit(PatientViewModel model) { model.Countries = HealthHelper.GetAllCountries(); try { var svc = new PatientAppService(); var o = new Patient { PatientId = model.PatientId, FirstName = model.FirstName, FirstLastName = model.FirstLastName, Gender = model.Gender, BirthDate = DateTime.ParseExact(model.BirthDateText, "dd/MM/yyyy", CultureInfo.InvariantCulture), Identification = model.Identification, IdentificationType = model.IdentificationType, Address = model.Address, Phone = model.Phone, Mobile = model.Mobile, SecondName = model.SecondName, SecondLastName = model.SecondLastName, EMail = model.EMail, GeoCityId = model.GeoCityId }; if (model.Action == "-1") { var exist = svc.GetPatient(model.PatientId) != null; if (!exist) { svc.AddPatient(o); ViewBag.Feed = 0; } else { model.Action = "-1"; ViewBag.Feed = 3; return View(model); } } else { o.PatientId = model.PatientId; if (model.IsDeleteAction == 0) { svc.SavePatient(o); } else { svc.RemovePatient(model.PatientId); } ViewBag.Feed = 0; } } catch (Exception) { ViewBag.Feed = 1; } return View(model); }