public PatientResponse Get(int id) { PatientResponse response = new PatientResponse() { Success = true }; try { Patient patient = patientService.GetPatient(id); if (patient == null) { throw new RecordNotFoundException(string.Format("Patient {0} not found", id)); } response.Patient = patient; } catch (Exception exc) { response.Success = false; response.ErrorCode = ((int)ErrorResponse.ServerError).ToString(); response.ErrorMessage = exc.Message; } return(response); }
public PatientResponse GetMedicineDetails([FromUri] bool isDelivered) { PatientResponse patientResponse = new PatientResponse(); try { var medicineList = _patientBL.GetMedicineDetails(isDelivered); if (medicineList.Count() > 0) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "Medicine Details Fetched Successfully"; patientResponse.Data = medicineList; } else { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "No records found"; } return(patientResponse); } catch (Exception ex) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Error while fetching medicine details"; return(patientResponse); } }
public PatientResponse UpdateMedicineStatus([FromBody] PrescriptionListModel prescriptionListModel) { PatientResponse patientResponse = new PatientResponse(); try { var prescription = Mapper.Map <List <PrescriptionModel>, List <ContactInfo.DBEntities.Entities.Prescription> >(prescriptionListModel.PrescriptionData); var data = _patientBL.UpdateMedicineStatus(prescription); if (data.Count() > 0) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "Medicine status updated successfully"; patientResponse.Data = data; } else { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Issue in updating medicine status"; } return(patientResponse); } catch (Exception) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Issue in updating medicine status"; return(patientResponse); } }
public async Task <PatientResponse> GetPatients() { var results = await Task <List <Patient> > .Run(() => _apiContext.Patients.ToList()); var response = new PatientResponse(); List <Patient> patients = Helper.TransformToPatient(results); response.Patients = patients; return(response); }
public async Task <IActionResult> Get([FromRoute] Guid id) { try { PatientResponse patient = await patientService.GetPatientResponseAsync(id); return(Ok(patient)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public Patient GetPatient(PatientResponse data) { var entry = data.Entries[0].Resource; return(new Patient { BeneficiaryId = entry.Identifiers.FirstOrDefault(x => x.System.Contains("bene_id")).Value, BirthDate = entry.BirthDate, Gender = entry.Gender, GivenName = entry.Name.Select(x => string.Join(", ", x.GivenName).ToString()).FirstOrDefault(), LastName = entry.Name.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.LastName)).LastName, Id = entry.Id, }); }
public ActionResult CreateOrEditPatient() { PatientResponse _response = new PatientResponse(); if (Request.QueryString["id"] != null) { var request = new PatientRequest { Data = new PatientModel { Id = long.Parse(Request.QueryString["id"].ToString()), } }; if (Session["UserLogon"] != null) { request.Data.Account = (AccountModel)Session["UserLogon"]; } PatientResponse resp = new PatientHandler(_unitOfWork, _context).GetDetail(request); PatientModel _model = resp.Entity; ViewBag.Response = _response; ViewBag.Relation = BindDropDownRelation(); ViewBag.PatientType = BindDropDownPatientType(); ViewBag.City = BindDropDownCity(); ViewBag.EmpReff = BindDropDownEmployeeReff(); ViewBag.Marital = BindDropDownMaritalStatus(); ViewBag.ReffRelation = BindDropDownReffRelation(); ViewBag.ActionType = ClinicEnums.Action.Edit; return(View(_model)); } else { ViewBag.ActionType = ClinicEnums.Action.Add; ViewBag.Response = _response; ViewBag.Relation = BindDropDownRelation(); ViewBag.PatientType = BindDropDownPatientType(); ViewBag.EmpReff = BindDropDownEmployeeReff(); ViewBag.Marital = BindDropDownMaritalStatus(); ViewBag.City = BindDropDownCity(); ViewBag.ReffRelation = BindDropDownReffRelation(); return(View("CreateOrEditPatient", new PatientModel())); } }
private async Task <PatientResponse> GetPatient(long patientId) { string url = $"{PatientsApiUrl}GetById?patientId={patientId}"; var Patient = new PatientResponse(); var accessToken = await HttpContext.GetTokenAsync("access_token"); var response = await HttpRequestFactory.Get(accessToken, url); if (response.StatusCode == HttpStatusCode.OK) { Patient = response.ContentAsType <PatientResponse>(); } else { ModelState.AddModelError("", HttpResponseHandler.Process(response)); } return(Patient); }
public PatientResponse Map(Patient request) { if (request == null) { return(null); } List <RiskFactorResponse> riskFactors = new List <RiskFactorResponse>(); if (request.PatientRiskFactors == null) { riskFactors = null; } else { //foreach (PatientRiskFactor p in request.PatientRiskFactors) //{ // if(p.RiskFactor != null) // { // riskFactors.Add(_riskFactorMapper.Map(p.RiskFactor)); // } //} riskFactors = request.PatientRiskFactors .Select(p => _riskFactorMapper.Map(p.RiskFactor)) .ToList(); } PatientResponse response = new PatientResponse { Id = request.Id, PatientName = request.PatientName, PatientSurname = request.PatientSurname, DateOfBirth = request.DateOfBirth, PhoneNumber = request.PhoneNumber, RiskFactorResponses = riskFactors }; return(response); }
public async Task <IActionResult> ConfirmPatient([FromQuery] long patientId) { string url = $"{PatientsApiUrl}GetById?patientId={patientId}"; var patient = new PatientResponse(); var accessToken = await HttpContext.GetTokenAsync("access_token"); var response = await HttpRequestFactory.Get(accessToken, url); if (response.StatusCode == HttpStatusCode.OK) { patient = response.ContentAsType <PatientResponse>(); } else { ModelState.AddModelError("", HttpResponseHandler.Process(response)); } return(View(patient)); }
public PatientResponse AddPatientPoliceCommunicationDetails([FromBody] PatientPoliceCommunicationModel patientPoliceCommunicationModel) { PatientResponse patientResponse = new PatientResponse(); try { if (!ModelState.IsValid) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.BadRequest); patientResponse.Message = "Invalid data"; return(patientResponse); } var patientPoliceCommunicationDetails = Mapper.Map <PatientPoliceCommunicationModel, ContactInfo.DBEntities.Entities.PatientPoliceCommunication>(patientPoliceCommunicationModel); //var data = _patientBL.AddPatientPoliceCommunicationDetails(patientPoliceCommunicationDetails); var data = Mapper.Map <ContactInfo.DBEntities.Entities.PatientPoliceCommunication, PatientPoliceCommunicationModel>(_patientBL.AddPatientPoliceCommunicationDetails(patientPoliceCommunicationDetails)); if (data.PatientPoliceCommunicationId > 0) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "Patient Police Communication added successfully"; patientResponse.Data = data; } else { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Error while adding"; } return(patientResponse); } catch (Exception ex) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Error while adding"; return(patientResponse); } }
public async Task <IActionResult> VerifyConfirmPatient(long patientId) { string url = $"{PatientsApiUrl}ConfirmPatient?patientId={patientId}"; var patient = new PatientResponse(); var accessToken = await HttpContext.GetTokenAsync("access_token"); var response = await HttpRequestFactory.Put(accessToken, url, patientId); if (response.StatusCode == HttpStatusCode.OK) { AppContextHelper.SetToastMessage("Patient has been successfully confirmed", MessageType.Success, 1, Response); return(RedirectToAction(nameof(Index))); } else { AppContextHelper.SetToastMessage("Failed to confirm patient", MessageType.Danger, 1, Response); ModelState.AddModelError("", HttpResponseHandler.Process(response)); } return(RedirectToAction(nameof(ConfirmPatient), new { patientId })); }
} //ends GetRelatedPeopleAsync private async Task <PatientResponse> GetPatientAsync(string patientReference) { PatientResponse response = new PatientResponse(); _client = GetClient(baseUri); //Response Processing Logic _client.OnAfterResponse += (object sender, AfterResponseEventArgs e) => { response.statusCode = e.RawResponse.StatusCode; }; try { response.patient = await _client.ReadAsync <Patient>(location : patientReference); } catch (Exception) { } return(response); }//ends GetPatientAsync
public JsonResult UseExistingPatientData(string isUseExisting) { var _model = new PatientModel { }; var _response = new PatientResponse { }; if (Session["UserLogon"] != null) { _model.Account = (AccountModel)Session["UserLogon"]; } if (Session["PatientModel"] != null) { _model = (PatientModel)Session["PatientModel"]; _model.IsUseExistingData = isUseExisting == "yes" ? true : false; var request = new PatientRequest { Data = _model }; _response = new PatientValidator(_unitOfWork, _context).Validate(request); ViewBag.Response = $"{_response.Status};{_response.Message}"; ViewBag.Relation = BindDropDownRelation(); ViewBag.PatientType = BindDropDownPatientType(); ViewBag.City = BindDropDownCity(); ViewBag.EmpReff = BindDropDownEmployeeReff(); ViewBag.Marital = BindDropDownMaritalStatus(); ViewBag.ReffRelation = BindDropDownReffRelation(); ViewBag.ActionType = request.Data.Id > 0 ? ClinicEnums.Action.Edit : ClinicEnums.Action.Add; } else { _response.Status = false; _response.Message = Messages.SessionExpired; } return(Json(new { Status = _response.Status, Message = _response.Message }, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> GetPatientByEmailAsync(EmailRequest request) { if (!ModelState.IsValid) { return(BadRequest()); } var patient = await _dataContext.Patients .Include(o => o.User) .Include(m => m.MedicalOrders) .FirstOrDefaultAsync(o => o.User.Email.ToLower() == request.Email.ToLower()); if (patient == null) { return(NotFound()); } var response = new PatientResponse { Id = patient.Id, FirstName = patient.User.FirstName, LastName = patient.User.LastName, Address = patient.User.Address, Document = patient.User.Document, Email = patient.User.Email, PhoneNumber = patient.User.PhoneNumber, MedicalOrder = patient.MedicalOrders?.Select(m => new MedicalOrderResponse { Id = m.Id, Remarks = m.Remarks, Price = m.Price, StartDate = m.StartDate, EndDate = m.EndDate }).ToList() }; return(Ok(response)); }
/// <summary> /// This method does the following operations : /// Get the Patients lists from Database converts it to Object and returns it back to the API. /// </summary> /// <returns></returns> public async Task <PatientResponse> GetPatients() { var response = new PatientResponse(); try { var domainPatients = await _patientRepository.GetPatients(); domainPatients.ToList().ForEach(patient => { response.PatientDetailViewModels.Add(patient.Record.Deserialize <PatientDetailViewModel>()); }); response.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { response.StatusCode = HttpStatusCode.BadRequest; response.Error = "Error Occured while fetching patient information"; _logger.LogError("Error Occured while fetching patient information", ex); } return(response); }
public PatientResponse GetPatients(PatientRequest request) { PatientResponse response = new PatientResponse(); // Set correlation Id response.CorrelationId = request.RequestId; try { // Get customer list via Customer Facade. PatientFacade facade = new PatientFacade(); IList<Patient> list = facade.GetPatients(request.SortExpression); response.Patients = new PatientTransferObject[list.Count]; Console.WriteLine(list.Count.ToString()); // Package customer data in Customer Transfer Object int index = 0; foreach (Patient patient in list) { PatientTransferObject transfer = new PatientTransferObject(); transfer.PatientID = patient.PatientID; transfer.FName = patient.fName; transfer.LName = patient.LName; transfer.Phone = patient.Phone; response.Patients[index++] = transfer; } } catch // (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = "Request cannot be handled at this time."; } return response; }
private static void Main(string[] args) { Configuration configuration = new Configuration(); configuration.BasePath = "http://connector.develop.cnxt.dtr01.rodenstock.com:8080/api"; //configuration.BasePath = "http://localhost:8280/api"; PatientsApi patientsApi = new PatientsApi(configuration); // Query the first 25 patients sorted by lastName (ascending) PatientsResponse patientsResponse = patientsApi.GetPatients(25, null, new PatientFilter() { DateOfBirth = DateTime.ParseExact("1982-10-30", "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None) }, new List <string>() { "lastName" }, new List <string>() { "session", "latestSessionId", "latestSessionUpdate" }); // Query the next 25 patients sorted by lastName (ascending) patientsResponse = patientsApi.GetPatients(25, patientsResponse.PageInfo.EndCursor, null, new List <string>() { "lastName" }, new List <string>() { "session", "latestSessionId", "latestSessionUpdate" }); List <PatientResponse> patients = patientsResponse.Patients; PatientResponse patient = null; foreach (PatientResponse patientResponse in patients) { // Query patient by id and include session relationship patient = patientsApi.GetPatient(patientResponse.Id, new List <string>() { "session" }); Console.WriteLine("Patient: {0}" + Environment.NewLine, JsonConvert.SerializeObject(patient)); } SessionsApi sessionsApi = new SessionsApi(configuration); // Query the first 25 sessions sorted by upatedAt date (descending) SessionsResponse sessionsResponse = sessionsApi.GetSessions(25, null, new SessionFilter() { UpdatedAfter = DateTime.Parse("2020-02-17T10:00:00.391984Z"), State = null }, new List <string>() { "-updatedAt" }, new List <string>() { "patient" }); // Query the next 25 sessions sorted by updatedAt date (descending) sessionsResponse = sessionsApi.GetSessions(25, sessionsResponse.PageInfo.EndCursor, new SessionFilter() { UpdatedAfter = DateTime.Parse("2020-02-17T10:00:00.391984Z"), State = null }, new List <string>() { "-updatedAt" }, new List <string>() { "patient" }); List <SessionResponse> sessions = sessionsResponse.Sessions; SessionResponse session = null; foreach (SessionResponse sessionResponse in sessions) { // Query session by id and include patient and b2boptic relationships session = sessionsApi.GetSession(sessionResponse.Id, new List <string>() { "patient", "b2boptic" }); Console.WriteLine("Session: {0}" + Environment.NewLine, JsonConvert.SerializeObject(session)); // Query assets assigned to the the specified session AssetsResponse assetResponse = sessionsApi.GetAssets(session.Id); } string b2bOptic_Sample1 = System.IO.File.ReadAllText("./Data/B2BOptic_Sample1.xml"); // Import b2boptic XML document as new session List <string> sessionIds = sessionsApi.ImportB2BOpticAsNewSession(b2bOptic_Sample1, "OPEN"); string b2bOptic_Sample2 = System.IO.File.ReadAllText("./Data/B2BOptic_Sample2.xml"); // Import b2boptic XML document and update it by session for the specified session sessionIds = sessionsApi.ImportB2BOptic("691e5c29-3d70-4a3e-a8dd-bea781faba4b", b2bOptic_Sample2, "OPEN"); SessionResponse _sessionResponse = sessionsApi.GetSession("f62fc646-9101-4f20-8255-65816435662c"); AssetsResponse _assetResponse = sessionsApi.GetAssets(_sessionResponse.Id); AssetsApi assetsApi = new AssetsApi(configuration); DNEyeScannerAssetsResponse dnEyeScannerAssetsResponse = assetsApi.GetDNEyeScannerAssets("b126c195-8dde-47d6-9373-a2a47a72abaa"); ImpressionISTAssetsResponse impressionISTAssetResponse = assetsApi.GetImpressionISTAssets("f62fc646-9101-4f20-8255-65816435662c"); Console.ReadLine(); }
public PatientResponse AddPatient([FromBody] PatientDetailsModel patientDetailsModel) { PatientResponse patientResponse = new PatientResponse(); try { if (!ModelState.IsValid) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.BadRequest); patientResponse.Message = "Invalid data"; return(patientResponse); } bool isEmailExists = ValidateEmail(patientDetailsModel.Email); if (isEmailExists) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.BadRequest); patientResponse.Message = "Email already exists"; return(patientResponse); } int coordinatingPersonId = 0; if (patientDetailsModel.CoordinatingPerson != null) { var coordinatingPerson = Mapper.Map <CoordinatingPersonModel, ContactInfo.DBEntities.Entities.CoordinatingPerson>(patientDetailsModel.CoordinatingPerson); coordinatingPersonId = _patientBL.AddCoordinatingPerson(coordinatingPerson); patientDetailsModel.CoordinatingPerson.CoordinatingPersonId = coordinatingPersonId; } var patientDetails = Mapper.Map <PatientDetailsModel, ContactInfo.DBEntities.Entities.PatientDetail>(patientDetailsModel); if (coordinatingPersonId > 0) { patientDetails.CoordinatingPersonId = coordinatingPersonId; } var patientModel = Mapper.Map <ContactInfo.DBEntities.Entities.PatientDetail, PatientDetailsModel> (_patientBL.AddPatient(patientDetails)); patientModel.CoordinatingPerson = patientDetailsModel.CoordinatingPerson; if (patientModel.PatientId > 0) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "Patient added successfully"; patientResponse.Data = patientModel; EmailModel emailModel = new EmailModel(); emailModel.Recipient = ""; emailModel.Subject = patientModel.Category + " Case Verification"; emailModel.Message = "test"; if (patientModel.IsPoliceVerificationRequired == true) { bool isMailSent = EmailHelper.SendEMail(emailModel); } } else { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Error while adding"; } return(patientResponse); } catch (Exception ex) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Error while adding"; return(patientResponse); } }
public PatientResponse GetPatient(PatientRequest request) { PatientResponse response = new PatientResponse(); // Set correlation Id response.CorrelationId = request.RequestId; try { // Get customer patient via Patient Facade. PatientFacade facade = new PatientFacade(); response.Name = facade.GetPatient(request.PatientID); } catch // (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = "Request cannot be handled at this time."; } return response; }
public async Task <IActionResult> Create([Bind] PatientResponse patient) { return(View(patient)); }
public async Task <PersonProfileResponse> GetPersonProfileAsync(string person_id) { PersonProfileResponse response = new PersonProfileResponse(); //PHASE 1 Person person = await GetPersonWithConfirmedIdentity(person_id); if (person == null) { response.statusCode = HttpStatusCode.BadRequest; return(response); } response.statusCode = HttpStatusCode.Accepted; //The request has been accepted for processing, but the processing has not been completed //PHASE 2 List <string> patientReferences = GetReferences(person, "Patient"); if (patientReferences.Count == 0) { response.statusCode = HttpStatusCode.PartialContent; return(response); } string patientReference = patientReferences[0]; // response.statusCode = HttpStatusCode.Accepted; //The request has been accepted for processing, but the processing has not been completed //PHASE 3 //Since there is always only one patient associated with a person, So in patientReferences array at index 0, we have that one patientReference List <Appointment> appointments = await GetInFutureAppointmentsForPatientAsync(patientReference); if (appointments == null) //appointments will be null only when ResponseCode is other than 200 { response.statusCode = HttpStatusCode.InternalServerError; //500 return(response); } // response.statusCode = HttpStatusCode.Accepted; //The request has been accepted for processing, but the processing has not been completed List <FutureAppointment> futureAppointments = GetFutureAppointmentsFromAppointmentsWhereActorIsPractitionerRole(appointments); //PHASE 4 List <Related_Person> related_People = await GetRelatedPeopleAsync(person); //PHASE 5 PatientResponse getPatientResponse = await GetPatientAsync(patientReference); if (getPatientResponse.statusCode != HttpStatusCode.OK) { response.statusCode = HttpStatusCode.InternalServerError; return(response); } // response.statusCode = HttpStatusCode.Accepted; //The request has been accepted for processing, but the processing has not been completed List <string> practitionerRoleReferences = GetPractitionerRoleReferencesFromPatient(getPatientResponse.patient); List <_Provider> providers = null; if (practitionerRoleReferences.Count > 0) { providers = await GetPractitionerRolesAsync(practitionerRoleReferences); } //PHASE 5a //Extraction externalIds from the retrieved patient resource List <ExternalId> externalIds = GetExternalIdsFromPatient(getPatientResponse.patient); //PHASE 6 //Collecting data into a single object response.data = new PersonProfile { personId = person_id, patientSelfId = getPatientResponse.patient.Id, externalIds = (externalIds?.Count > 0 ? externalIds : null), relatedPersons = (related_People?.Count > 0 ? related_People : null), appointments = (futureAppointments?.Count > 0 ? futureAppointments : null), providers = (providers?.Count > 0 ? providers : null) }; //Setting Response Code response.statusCode = HttpStatusCode.OK; return(response); }//ends GetPersonProfileAsync
public PatientResponse GetPatient([FromBody] PatientDetailsModel patientDetailsModel) { PatientResponse patientResponse = new PatientResponse(); try { var patientList = _patientBL.GetAllPatientDetails(); var patientListModel = Mapper.Map <IList <ContactInfo.DBEntities.Entities.PatientDetail>, IList <PatientDetailsModel> >(patientList); if (!(string.IsNullOrEmpty(patientDetailsModel.PatientName) && string.IsNullOrEmpty(patientDetailsModel.Email) && string.IsNullOrEmpty(patientDetailsModel.PatientName))) { bool isEmail = Regex.IsMatch(patientDetailsModel.Email, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); bool isMobileNumber = Regex.IsMatch(patientDetailsModel.MobileNumber, @"^\d{10}$"); if ((!string.IsNullOrEmpty(patientDetailsModel.Email) && !isEmail) || (!string.IsNullOrEmpty(patientDetailsModel.MobileNumber) && !isMobileNumber)) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.BadRequest); patientResponse.Message = "Invalid data"; return(patientResponse); } if (!string.IsNullOrEmpty(patientDetailsModel.Email)) { patientListModel = patientListModel.Where(p => p.Email.ToLower() == patientDetailsModel.Email.ToLower()).ToList(); } if (!string.IsNullOrEmpty(patientDetailsModel.MobileNumber)) { patientListModel = patientListModel.Where(p => p.MobileNumber == patientDetailsModel.MobileNumber).ToList(); } if (!string.IsNullOrEmpty(patientDetailsModel.PatientName)) { patientListModel = patientListModel.Where(p => p.PatientName.ToLower() == patientDetailsModel.PatientName.ToLower()).ToList(); } } if (patientListModel.Count() > 0) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "Patient Details Fetched Successfully"; patientResponse.Data = patientListModel; } else { patientResponse.Status = Convert.ToInt32(HttpStatusCode.OK); patientResponse.Message = "No patient found"; patientResponse.Data = patientListModel; } return(patientResponse); } catch (Exception ex) { patientResponse.Status = Convert.ToInt32(HttpStatusCode.InternalServerError); patientResponse.Message = "Error while fetching"; return(patientResponse); } }