/// <summary> /// set values for patient object /// </summary> /// <param name="patientObject"></param> public void SetViewBagsForEditMode(Patient patientObject) { try { if (patientObject != null) { ViewBag.FirstName = patientObject.FirstName; ViewBag.LastName = patientObject.LastName; ViewBag.MiddleInitial = patientObject.MiddleInitial; ViewBag.AgeInYears = patientObject.AgeInYears.ToString(); ViewBag.AgeInMonths = patientObject.AgeInMonths.ToString(); ViewBag.AgeInDays = patientObject.AgeInDays.ToString(); ViewBag.DateOfBirth = patientObject.DateOfBirth; ViewBag.MedicalRecordNumber = patientObject.MedicalRecordNumber; ViewBag.OfficeTypetoload = patientObject.OfficeType; ViewBag.Providertoload = patientObject.Provider; ViewBag.UploadImage = patientObject.UploadImage; ViewBag.Sex = patientObject.Sex; ViewBag.CreatedTime = patientObject.CreatedTimeStamp.ToString(); ViewBag.IsEditMode = true; } } catch (Exception ex) { AjaxCallResult(new AjaxResult(AppEnum.ResultType.Error, ex.ToString(), "")); ExceptionManager.Error("Error: ControllerName: Patient, MethodName:SetViewBagsForEditMode", ex); } }
/// <summary> /// This method is used to save patient in assignment for a New Appointment /// </summary> /// <param name="assignmentUniqueIdentifier"></param> /// <param name="patientItem"></param> /// <param name="dropBox"> </param> /// <returns></returns> public Patient SaveNewAppointmentPatient(string assignmentUniqueIdentifier, Patient patientItem, DropBoxLink dropBox) { string patientAssignmentUrl = _patientDocument.GetAssignmentUrl(dropBox, DocumentPath.Module.Patients, AppConstants.Create); patientAssignmentUrl = _patientDocument.SaveOrUpdate(patientAssignmentUrl, patientItem); //patientItem = _patientDocument.Get(patientAssignmentUrl); string patientUniqueIdentifier = patientAssignmentUrl.Split('/').Last(); patientItem.UniqueIdentifier = patientUniqueIdentifier; return patientItem; }
public ActionResult SavePatient(string patientUrlReference, string folderIdentifier, bool isEditMode) { string result; Patient patient = new Patient(); try { string patientJson = HttpUtility.UrlDecode(new StreamReader(Request.InputStream).ReadToEnd()); Patient patientObject = JsonSerializer.DeserializeObject<Patient>(patientJson); patientObject.Status = "Unpublished"; patientObject.IsActive = true; SetAuditFields(patientObject, isEditMode); Type patientType = patientObject.GetType(); foreach (System.Reflection.PropertyInfo objProp in patientType.GetProperties()) { if (objProp.CanWrite && objProp.Name.ToUpper() != "ID") { objProp.SetValue(patient, patientType.GetProperty(objProp.Name).GetValue(patientObject, null), null); } } _patientService.SavePatient(patient, GetLoginUserCourse() + "/" + GetLoginUserRole(), patientUrlReference, folderIdentifier, isEditMode); result = "success"; } catch (Exception ex) { result = AjaxCallResult(new AjaxResult(AppEnum.ResultType.Error, ex.ToString(), "")); ExceptionManager.Error("error: ControllerName: Patient, MethodName: SavePatient", ex); //errorMessage = AppConstants.Error; } return Json(new { Result = result }); }
public bool IsPatientValid(DropBoxLink assignmentCredentials, Patient patientItem) { bool isPatientValid = true; IList<Patient> duplicatePatientList = new List<Patient>(); IList<Patient> patientList = _patientDocument.GetAllPatientForAssignment(assignmentCredentials); if (patientList != null && patientList.Count > 0) { duplicatePatientList = patientList.Where(x => ((x.LastName.ToLower() == patientItem.LastName.ToLower()) && (x.FirstName.ToLower() == patientItem.FirstName.ToLower()) && (x.MiddleInitial.ToLower() == patientItem.MiddleInitial.ToLower()) && (x.DateOfBirth.ToLower() == patientItem.DateOfBirth.ToLower()))).ToList(); } if (duplicatePatientList.Count() != 0) { isPatientValid = false; } return isPatientValid; }