public IActionResult RegisterPatient(PatientRegistrationDTO dto)
        {
            var patientAccount    = PatientAccountMapper.DtoToObject(dto);
            var emailTemplatePath = Path.Join(_hostEnvironment.ContentRootPath, "Resources", "verification-mail.html");

            _patientRegistrationService.RegisterPatient(patientAccount, emailTemplatePath);
            return(Ok());
        }
Пример #2
0
 public IActionResult SavePatient([FromBody] PatientRegistrationDTO model)
 {
     try
     {
         int Result = _patientservices.SavePatient(model);
         return(Ok(Result));
     }
     catch (Exception ex) { return(Ok(CommonUtility.GetExResponse <Exception>(ex))); }
 }
Пример #3
0
 public int SavePatient(PatientRegistrationDTO model)
 {
     model.MRNO      = CreateMRNO();
     model.CreatedOn = DateTime.Now;
     model.CreatedBy = "New User";
     if (model.DOB != null)
     {
         model.Age = (int?)(DateTime.Now.Year - model.DOB?.Year);
     }
     return(_PatientDAL.SavePatient(model));
 }
Пример #4
0
        public void Register(PatientRegistrationDTO registrationDTO)
        {
            PatientAccountMemento memento = registrationDTO.ToPatientAccountMemento();

            memento.IsActivated = false;
            memento.IsBlocked   = false;
            memento.City        = _cityRepository.Get(registrationDTO.CityId).GetMemento();
            PatientAccount patientAccount = new PatientAccount(memento);

            _patientRepository.Add(patientAccount);
        }
Пример #5
0
 public static PatientAccountMemento ToPatientAccountMemento(this PatientRegistrationDTO dto)
 {
     return(new PatientAccountMemento()
     {
         Jmbg = dto.Jmbg,
         DateOfBirth = dto.DateOfBirth,
         Email = dto.Email,
         Gender = dto.Gender,
         HomeAddress = dto.HomeAddress,
         ImageName = dto.ImageName,
         IsActivated = false,
         IsBlocked = false,
         Name = dto.Name,
         Password = dto.Password,
         Phone = dto.Phone,
         Surname = dto.Surname
     });
 }
Пример #6
0
        public IActionResult RegisterGuest(PatientRegistrationDTO dto)
        {
            if (_registrationService.PatientExists(dto.Id, dto.Username))
            {
                return(BadRequest("Patient already exists"));
            }

            Patient patient = PatientRegistrationMapper.PatientRegistrationDTOtoPatient(dto);

            patient.IsGuestAccount = true;
            patient.Token          = RegistrationTokenService.GenerateGuidToken();
            Patient registeredPatient = _registrationService.Register(patient);

            if (registeredPatient == null)
            {
                return(BadRequest("Patient already exists"));
            }
            return(Ok());
        }
Пример #7
0
        public int SavePatient(PatientRegistrationDTO model)
        {
            int Result = 0;

            using (var db = new HMISDBContext())
            {
                var trans = db.Database.BeginTransaction();
                try
                {
                    if (model != null && !string.IsNullOrEmpty(model.CNIC))
                    {
                        var PatientData = db.PatientRegistrations.Where(a => a.ID == model.id).FirstOrDefault();
                        if (PatientData != null)
                        {
                            var UpdatedHealthFacility = this._mapper.Map <PatientRegistrationDTO, PatientRegistration>(model, PatientData);
                            db.Entry(UpdatedHealthFacility).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                        }
                        else
                        {
                            var CurrentDate = DateTime.Now;
                            var NewPatient  = this._mapper.Map <PatientRegistration>(model);
                            db.PatientRegistrations.AddAsync(NewPatient);
                        }
                    }
                    else
                    {
                        Result = -1;
                    }

                    db.SaveChanges();
                    trans.Commit();
                    Result = 1;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    Result = -1;
                }
                return(Result);
            }
        }
 public static PatientAccount DtoToObject(PatientRegistrationDTO dto)
 {
     return(new PatientAccount
     {
         AvatarUrl = dto.AvatarUrl,
         Credentials = new Credentials
         {
             Email = dto.Email,
             Password = dto.Password,
             Username = dto.Username
         },
         Role = "Patient",
         UserGuid = Guid.NewGuid(),
         IsActivated = false,
         RespondedToSurvey = false,
         Patient = new Patient
         {
             PersonId = dto.Jmbg,
             InsuranceNumber = dto.InsuranceNumber,
             Status = PatientStatus.Alive,
             Allergies = dto.Allergies,
             Person = new Person
             {
                 Address = dto.Address,
                 Age = dto.Age,
                 Citizenships = dto.Citizenships,
                 CityOfBirthId = dto.CityOfBirthId,
                 CityOfResidenceId = dto.CityOfResidenceId,
                 DateOfBirth = dto.DateOfBirth,
                 Gender = dto.Gender,
                 Id = dto.Jmbg,
                 Name = dto.Name,
                 Surname = dto.Surname,
                 TelephoneNumber = dto.TelephoneNumber,
                 MiddleName = dto.MiddleName,
                 MaritalStatus = dto.MaritalStatus,
             },
         }
     });
 }
Пример #9
0
        public IActionResult Register(PatientRegistrationDTO dto)
        {
            try
            {
                ValidateRegistrationInput.Validate(dto);
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }

            if (_registrationService.PatientExists(dto.Id, dto.Username))
            {
                return(BadRequest("Patient already exists"));
            }


            Patient patient = PatientRegistrationMapper.PatientRegistrationDTOtoPatient(dto);

            patient.Token = RegistrationTokenService.GenerateGuidToken();

            Patient registeredPatient = _registrationService.Register(patient);

            if (registeredPatient == null)
            {
                return(BadRequest("Patient already exists"));
            }


            _patientDocumentsGateway.SaveMedicalRecord(new MedicalRecord
            {
                PatientId = dto.Id,
                BloodType = PatientEnumMapper.StringToBloodType(dto.BloodType)
            });

            GenerateEmailInfo(patient);

            return(Ok("Please check your mail to confirm registration"));
        }
Пример #10
0
        public static Patient PatientRegistrationDTOtoPatient(PatientRegistrationDTO patientRegistrationDTO)
        {
            Patient patient = new Patient
            {
                Id             = patientRegistrationDTO.Id,
                Name           = patientRegistrationDTO.Name,
                Surname        = patientRegistrationDTO.Surname,
                DateOfBirth    = patientRegistrationDTO.DateOfBirth,
                Phone          = patientRegistrationDTO.Phone,
                Email          = patientRegistrationDTO.Email,
                Username       = patientRegistrationDTO.Username,
                Password       = patientRegistrationDTO.Password,
                Profession     = patientRegistrationDTO.Profession,
                ChosenDoctorId = patientRegistrationDTO.Doctor,
                Gender         = RegisteredUserEnumMapper.StringToGender(patientRegistrationDTO.Gender),
                EducationLevel = RegisteredUserEnumMapper.StringToEducationalLevel(patientRegistrationDTO.EducationLevel),
                PlaceOfBirth   = new City {
                    Name = patientRegistrationDTO.CityOfBirth, State = new State {
                        Name = patientRegistrationDTO.StateOfBirth
                    }
                },
                CurrResidence = new Address
                {
                    Apartment = patientRegistrationDTO.Apartment,
                    City      = new City {
                        Name = patientRegistrationDTO.City, State = new State {
                            Name = patientRegistrationDTO.State
                        }
                    },
                    Floor  = patientRegistrationDTO.Floor,
                    Number = patientRegistrationDTO.Number,
                    Street = patientRegistrationDTO.Street
                },
                InsurancePolicy = new InsurancePolicy(patientRegistrationDTO.PolicyNumber, patientRegistrationDTO.Company, new Period(patientRegistrationDTO.PolicyStart, patientRegistrationDTO.PolicyEnd))
            };

            return(patient);
        }
Пример #11
0
 public static void Validate(PatientRegistrationDTO dto)
 {
     IsNameValid(dto.Name);
     IsSurnameValid(dto.Surname);
     IsIdValid(dto.Id);
     IsDateValid(dto.DateOfBirth);
     IsEmailValid(dto.Email);
     IsPhoneValid(dto.Phone);
     IsUsernameValid(dto.Username);
     IsPasswordValid(dto.Password, dto.ConfirmPassword);
     IsProfessionValid(dto.Profession);
     IsInsuranceNumberValid(dto.PolicyNumber);
     IsInsuranceCompanyValid(dto.Company);
     IsDateValid(dto.PolicyStart);
     IsDateValid(dto.PolicyEnd);
     IsCityValid(dto.CityOfBirth);
     IsPostalCodeValid(dto.PostalCodeBirth);
     IsStateValid(dto.State);
     IsStreetValid(dto.Street);
     IsNumberValid(dto.Number);
     IsApartmentValid(dto.Apartment);
     IsFloorValid(dto.Floor);
 }
Пример #12
0
        public PatientRegistrationEntity PatientRegistration(PatientRegistrationDTO entity, MessageEventArgs messageEvent)
        {
            PatientRegistrationEntity patientRegistration = new PatientRegistrationEntity();

            string messageType = null;

            if (messageEvent.MessageType == MessageType.NewClientRegistration)
            {
                messageType = "ADT^A04";
            }
            else if (messageEvent.MessageType == MessageType.UpdatedClientInformation)
            {
                messageType = "ADT^A08";
            }

            int facilityId = messageEvent.FacilityId;

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <PatientRegistrationDTO, PatientRegistrationEntity>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.MESSAGEHEADER, MappingEntities.MESSAGEHEADER>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.PATIENTIDENTIFICATION, MappingEntities.PATIENTIDENTIFICATION>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.NEXTOFKIN, MappingEntities.NEXTOFKIN>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.VISIT, MappingEntities.VISIT>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.EXTERNALPATIENTID, MappingEntities.EXTERNALPATIENTID>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.INTERNALPATIENTID, MappingEntities.INTERNALPATIENTID>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.PATIENTNAME, MappingEntities.PATIENTNAME>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.PATIENTADDRESS, MappingEntities.PATIENTADDRESS>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.PHYSICAL_ADDRESS, MappingEntities.PHYSICALADDRESS>().ReverseMap();
                cfg.CreateMap <DTO.CommonEntities.NOKNAME, MappingEntities.NOKNAME>().ReverseMap();
            });

            patientRegistration = Mapper.Map <PatientRegistrationEntity>(entity);

            patientRegistration.MESSAGE_HEADER = GetMessageHeader(messageType, facilityId.ToString(), "P");
            return(patientRegistration);
        }
Пример #13
0
        public static PatientRegistrationDTO Get(int patientId)
        {
            PatientMessageManager  patientMessageManager = new PatientMessageManager();
            PatientMessage         patientMessage        = patientMessageManager.GetPatientMessageByEntityId(patientId);
            PatientRegistrationDTO registration          = new PatientRegistrationDTO();
            var personIdentifierManager = new PersonIdentifierManager();

            if (patientMessage != null)
            {
                IdentifierManager identifierManager = new IdentifierManager();
                Identifier        identifier        = identifierManager.GetIdentifierByCode("GODS_NUMBER");
                var personIdentifiers = personIdentifierManager.GetPersonIdentifiers(patientMessage.Id, identifier.Id);

                INTERNALPATIENTID internalPatientId = new INTERNALPATIENTID();
                internalPatientId.ID = patientMessage.IdentifierValue;
                internalPatientId.IDENTIFIER_TYPE     = "CCC_NUMBER";
                internalPatientId.ASSIGNING_AUTHORITY = "CCC";


                registration.PATIENT_IDENTIFICATION = registration.PATIENT_IDENTIFICATION == null ? new PATIENTIDENTIFICATION() : registration.PATIENT_IDENTIFICATION;
                registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID = registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID == null ? new List <INTERNALPATIENTID>() : registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID;
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID = registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID == null ? new EXTERNALPATIENTID() : registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID;
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME        = registration.PATIENT_IDENTIFICATION.PATIENT_NAME == null ? new PATIENTNAME() : registration.PATIENT_IDENTIFICATION.PATIENT_NAME;
                registration.PATIENT_IDENTIFICATION.MOTHER_NAME         = registration.PATIENT_IDENTIFICATION.MOTHER_NAME == null ? (dynamic)null : registration.PATIENT_IDENTIFICATION.MOTHER_NAME;
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS     = registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS == null ? new PATIENTADDRESS() : registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS;
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS = registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS == null ? new PHYSICAL_ADDRESS() : registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS;
                registration.PATIENT_VISIT = registration.PATIENT_VISIT == null ? new VISIT() : registration.PATIENT_VISIT;
                registration.NEXT_OF_KIN   = registration.NEXT_OF_KIN == null ? new List <NEXTOFKIN>() : registration.NEXT_OF_KIN;

                //External Patient Id
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.ID = personIdentifiers.Count > 0 ? personIdentifiers[0].IdentifierValue : String.Empty;
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.ASSIGNING_AUTHORITY = "MPI";
                registration.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.IDENTIFIER_TYPE     = "GODS_NUMBER";
                //Start setting values
                registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID.Add(internalPatientId);
                if (!String.IsNullOrWhiteSpace(patientMessage.NATIONAL_ID) && patientMessage.NATIONAL_ID != "99999999")
                {
                    INTERNALPATIENTID internalNationalId = new INTERNALPATIENTID();
                    internalNationalId.ID = patientMessage.NATIONAL_ID;
                    internalNationalId.IDENTIFIER_TYPE     = "NATIONAL_ID";
                    internalNationalId.ASSIGNING_AUTHORITY = "GOK";

                    registration.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID.Add(internalNationalId);
                }
                //set names
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME.FIRST_NAME  = !string.IsNullOrWhiteSpace(patientMessage.FIRST_NAME) ? patientMessage.FIRST_NAME: "";
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME.MIDDLE_NAME = !string.IsNullOrWhiteSpace(patientMessage.MIDDLE_NAME) ? patientMessage.MIDDLE_NAME : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_NAME.LAST_NAME   = !string.IsNullOrWhiteSpace(patientMessage.LAST_NAME) ? patientMessage.LAST_NAME : "";
                //set DOB
                registration.PATIENT_IDENTIFICATION.DATE_OF_BIRTH           = !string.IsNullOrWhiteSpace(patientMessage.DATE_OF_BIRTH) ? patientMessage.DATE_OF_BIRTH : "";
                registration.PATIENT_IDENTIFICATION.DATE_OF_BIRTH_PRECISION = !string.IsNullOrWhiteSpace(patientMessage.DATE_OF_BIRTH_PRECISION) ? patientMessage.DATE_OF_BIRTH_PRECISION : "";
                //set sex
                registration.PATIENT_IDENTIFICATION.SEX = !string.IsNullOrWhiteSpace(patientMessage.SEX) ? patientMessage.SEX : "";
                //set phone number
                registration.PATIENT_IDENTIFICATION.PHONE_NUMBER = !string.IsNullOrWhiteSpace(patientMessage.MobileNumber) ? patientMessage.MobileNumber : "";
                //set marital status
                registration.PATIENT_IDENTIFICATION.MARITAL_STATUS = !string.IsNullOrWhiteSpace(patientMessage.MARITAL_STATUS) ? patientMessage.MARITAL_STATUS : "";
                //set patient address variables
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.POSTAL_ADDRESS                    = !string.IsNullOrWhiteSpace(patientMessage.PhysicalAddress) ? patientMessage.PhysicalAddress : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.VILLAGE          = !string.IsNullOrWhiteSpace(patientMessage.Village) ? patientMessage.Village : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.WARD             = !string.IsNullOrWhiteSpace(patientMessage.WardName) ? patientMessage.WardName : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.SUB_COUNTY       = !string.IsNullOrWhiteSpace(patientMessage.Subcountyname) ? patientMessage.Subcountyname : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.COUNTY           = !string.IsNullOrWhiteSpace(patientMessage.CountyName) ? patientMessage.CountyName : "";
                registration.PATIENT_IDENTIFICATION.PATIENT_ADDRESS.PHYSICAL_ADDRESS.NEAREST_LANDMARK = !string.IsNullOrWhiteSpace(patientMessage.Landmark) ? patientMessage.Landmark : "";
                //set visit variables
                registration.PATIENT_VISIT.HIV_CARE_ENROLLMENT_DATE = !string.IsNullOrWhiteSpace(patientMessage.DateOfEnrollment) ? patientMessage.DateOfEnrollment : "";
                registration.PATIENT_VISIT.PATIENT_SOURCE           = !string.IsNullOrWhiteSpace(patientMessage.EntryPoint) ? patientMessage.EntryPoint : "";
                registration.PATIENT_VISIT.PATIENT_TYPE             = !string.IsNullOrWhiteSpace(patientMessage.PatientType) ? patientMessage.PatientType : "";
                registration.PATIENT_VISIT.VISIT_DATE = !string.IsNullOrWhiteSpace(patientMessage.DateOfRegistration) ? patientMessage.DateOfRegistration : "";
                //set if patient is dead
                registration.PATIENT_IDENTIFICATION.DEATH_DATE      = !string.IsNullOrWhiteSpace(patientMessage.DateOfDeath) ? patientMessage.DateOfDeath : "";
                registration.PATIENT_IDENTIFICATION.DEATH_INDICATOR = !string.IsNullOrWhiteSpace(patientMessage.DeathIndicator) ? patientMessage.DeathIndicator : "";

                if (!string.IsNullOrWhiteSpace(patientMessage.TFIRST_NAME) && !string.IsNullOrWhiteSpace(patientMessage.TLAST_NAME))
                {
                    NEXTOFKIN treatmentSupporter = new NEXTOFKIN();
                    treatmentSupporter.NOK_NAME.FIRST_NAME  = !string.IsNullOrWhiteSpace(patientMessage.TFIRST_NAME) ? patientMessage.TFIRST_NAME : "";
                    treatmentSupporter.NOK_NAME.MIDDLE_NAME = !string.IsNullOrWhiteSpace(patientMessage.TMIDDLE_NAME) ? patientMessage.TMIDDLE_NAME : "";
                    treatmentSupporter.NOK_NAME.LAST_NAME   = !string.IsNullOrWhiteSpace(patientMessage.TLAST_NAME) ? patientMessage.TLAST_NAME : "";
                    treatmentSupporter.DATE_OF_BIRTH        = !string.IsNullOrWhiteSpace(patientMessage.TDATE_OF_BIRTH) ? patientMessage.TDATE_OF_BIRTH : "";
                    treatmentSupporter.PHONE_NUMBER         = !string.IsNullOrWhiteSpace(patientMessage.TPHONE_NUMBER) ? patientMessage.TPHONE_NUMBER : "";
                    treatmentSupporter.ADDRESS      = !string.IsNullOrWhiteSpace(patientMessage.TADDRESS) ? patientMessage.TADDRESS : "";
                    treatmentSupporter.CONTACT_ROLE = "T";
                    treatmentSupporter.RELATIONSHIP = String.Empty;
                    treatmentSupporter.SEX          = !string.IsNullOrWhiteSpace(patientMessage.TSEX) ? patientMessage.TSEX : "";

                    registration.NEXT_OF_KIN.Add(treatmentSupporter);
                }
            }

            return(registration);
        }
Пример #14
0
 public IActionResult Register(PatientRegistrationDTO patient)
 {
     _patientService.Register(patient);
     return(NoContent());
 }