Example #1
0
        public async Task <IActionResult> UpdatePatient(int id, [FromBody] PatientUpdate patientUpdate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var currentPatientId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);
            var patient          = await _patientRepo.GetPatient(id);

            if (patient == null)
            {
                return(NotFound($"Пользователя с Id {id} не существует"));
            }

            if (currentPatientId != patient.Id)
            {
                return(Unauthorized());
            }

            _patientMapper.Map(patientUpdate, patient);

            if (await _patientRepo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Пользователь {id} НЕ обновлен!");
        }
        public async Task <ActionResult> UpdatePatient([FromRoute] int id, [FromBody] PatientUpdate request)
        {
            var patientDto = request.ToDto();
            var updated    = await _context.Update(patientDto, id);

            if (updated is null)
            {
                return(NotFound());
            }

            return(Ok());
        }
Example #3
0
        protected string GetUserInformation(PatientUpdate data)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Transaction Information\n");
            sb.Append(string.Format("   Transaction UID: {0}\n", data.TransactionID));
            sb.Append(string.Format("   Station Name   : {0}\n", data.Station));
            sb.Append(string.Format("   User Name      : {0}\n", data.Operator));
            sb.Append(string.Format("   Description    : {0}\n", data.Description));
            sb.Append(string.Format("   Reason         : {0}\n", data.Reason));
            sb.Append(string.Format("   Date           : {0}\n", data.Date.HasValue ? data.Date.Value.ToShortDateString() : string.Empty));
            sb.Append(string.Format("   Time           : {0}\n", data.Time.HasValue ? data.Time.Value.ToShortDateString() : string.Empty));
            return(sb.ToString());
        }
        public Patients_tests()
        {
            _patientController = new PatientController(_IPatientRepository.Object);

            _patientDto = new PatientDto()
            {
                Name         = "Gvidas",
                Surname      = "Nor",
                Address      = "Sauletekio ave. 18., Vilnius",
                BirthDate    = DateTime.Now,
                Email        = "*****@*****.**",
                Password     = "******",
                PersonalCode = "3888888878",
                Phone        = "8655547558",
                RiskLevel    = 2,
                Id           = 2,
            };

            _patientCreate = new PatientCreate()
            {
                Name         = "Gvidas",
                Surname      = "Nor",
                Address      = "Sauletekio ave. 18., Vilnius",
                BirthDate    = DateTime.Now,
                Email        = "*****@*****.**",
                Password     = "******",
                PersonalCode = "3888888878",
                Phone        = "8655547558",
                RiskLevel    = 2
            };

            _patientUpdate = new PatientUpdate()
            {
                Name         = "Gvidas",
                Surname      = "Nor",
                Address      = "Sauletekio ave. 18., Vilnius",
                BirthDate    = DateTime.Now,
                Email        = "*****@*****.**",
                Password     = "******",
                PersonalCode = "3888888878",
                Phone        = "8655547558",
                RiskLevel    = 2
            };
        }
Example #5
0
        public ModifyPatientResp UpdatePatient(long patientId, Customer customer, PrimaryCarePhysician pcp, BillingAccount billingAccount)
        {
            try
            {
                var client = new KareoServicesClient();

                var requestHeader = new RequestHeader
                {
                    ClientVersion = ClientVersion,
                    CustomerKey   = billingAccount.CustomerKey,
                    User          = billingAccount.UserName,
                    Password      = billingAccount.Password
                };

                // Create the patient to insert.
                var updatePatient = new PatientUpdate
                {
                    PatientID           = Convert.ToInt32(patientId),
                    FirstName           = customer.Name.FirstName,
                    MiddleName          = customer.Name.MiddleName,
                    LastName            = customer.Name.LastName,
                    DateofBirth         = customer.DateOfBirth,
                    Gender              = customer.Gender == Gender.Male ? GenderCode.Male : customer.Gender == Gender.Female ? GenderCode.Female : GenderCode.Unknown,
                    MedicalRecordNumber = customer.CustomerId.ToString(),
                    AddressLine1        = customer.Address.StreetAddressLine1,
                    AddressLine2        = customer.Address.StreetAddressLine2,
                    City         = customer.Address.City,
                    State        = customer.Address.StateCode,
                    ZipCode      = customer.Address.ZipCode.Zip,
                    HomePhone    = customer.HomePhoneNumber != null ? customer.HomePhoneNumber.FormatPhoneNumber : string.Empty,
                    WorkPhone    = customer.OfficePhoneNumber != null ? customer.OfficePhoneNumber.FormatPhoneNumber : string.Empty,
                    MobilePhone  = customer.MobilePhoneNumber != null ? customer.MobilePhoneNumber.FormatPhoneNumber : string.Empty,
                    EmailAddress = customer.Email != null?customer.Email.ToString() : string.Empty,
                                       PatientExternalID = customer.CustomerId.ToString()
                };

                // Set the practice we want to add this patient to
                var practice = new PracticeIdentifierReq
                {
                    PracticeName = billingAccount.Name
                };
                updatePatient.Practice = practice;

                // Create the case details for the patient
                var patientCase = new PatientCaseUpdateReq
                {
                    CaseName = CaseName,
                    //patientCase.PayerScenario
                    Active = true,
                    SendPatientStatements = true
                };
                updatePatient.Cases = new[] { patientCase };

                if (pcp != null)
                {
                    updatePatient.PrimaryCarePhysician = new PhysicianIdentifierReq
                    {
                        FullName = pcp.Name.FullName
                    };
                }

                // Create the create patient request object
                var request = new UpdatePatientReq
                {
                    RequestHeader = requestHeader,
                    Patient       = updatePatient
                };

                // Call the Create Patient method
                var response = client.UpdatePatient(request);

                // Check the response for an error
                if (response.ErrorResponse.IsError)
                {
                    throw new Exception(response.ErrorResponse.ErrorMessage);
                }

                if (!response.SecurityResponse.SecurityResultSuccess)
                {
                    throw new Exception(response.SecurityResponse.SecurityResult);
                }

                client.Close();

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }