示例#1
0
 public PatientAddress UpdatePatientAddressData(int id, PatientAddress patientInfo)
 {
     try
     {
         if (id > 0)
         {
             var patientAddress = _context.PatientAddress.Find(id);
             if (patientAddress != null)
             {
                 patientAddress.PatientID     = patientInfo.PatientID;
                 patientAddress.IsMailingSame = patientInfo.IsMailingSame;
                 patientAddress.Address1      = patientInfo.Address1;
                 patientAddress.Address2      = patientInfo.Address2;
                 patientAddress.City          = patientInfo.City;
                 patientAddress.StateID       = patientInfo.StateID;
                 patientAddress.Zip           = patientInfo.Zip;
                 patientAddress.Phone         = patientInfo.Phone;
                 patientAddress.CountryID     = patientInfo.CountryID;
                 patientAddress.IsActive      = patientInfo.IsActive;
                 patientAddress.UpdatedDate   = DateTime.Now;
                 patientAddress.UpdatedBy     = patientInfo.UpdatedBy;
                 _context.SaveChanges();
             }
             return(patientAddress);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public async Task <IActionResult> PatientAddress(PatientAddressViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.AddressResult = "Model is NOT valid.";
                return(View());
            }

            var patientAddress = new PatientAddress
            {
                Id        = model.Id,
                City      = model.City,
                Street    = model.Street,
                Number    = model.Number,
                PatientId = model.Id,
            };

            var addressTracker = await _polyclinicContext.PatientAddresses.AddAsync(patientAddress);

            if (addressTracker.State == EntityState.Added)
            {
                await _polyclinicContext.SaveChangesAsync();
            }
            else
            {
                ViewBag.AddressResult = "Address NOT saved.";
            }

            return(RedirectToAction("Index", "Home"));
        }
示例#3
0
        public IActionResult Post([FromBody] List <PatientDTO> IPt)
        {
            HttpContext.Session.SetString("key", "add");
            foreach (var itemPatientDTO in IPt)
            {
                PatientAddress newIPT = _mapper.Map <PatientAddress>(itemPatientDTO);

                var validcontext = new System.ComponentModel.DataAnnotations.ValidationContext(newIPT, null, null);
                List <ValidationResult> errresults = new List <ValidationResult>();
                bool isValid = Validator.TryValidateObject(newIPT, validcontext, errresults);

                if (isValid)
                {
                    patientDBContext.patients.Add(newIPT);
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError, errresults));
                }
            }
            patientDBContext.SaveChanges();

            List <PatientAddress> pats = patientDBContext.patients.ToList <PatientAddress>();

            return(Ok(pats));
        }
        public PatientAddress Update(PatientAddress addressChanges)
        {
            var address = _context.PatientAddresses.Attach(addressChanges);

            address.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();
            return(addressChanges);
        }
示例#5
0
 public void ValidateAddressFields(PatientAddress address)
 {
     _validator.IsWhitespaceOrEmptyOrNull(address.HouseNo);
     _validator.IsWhitespaceOrEmptyOrNull(address.Street);
     _validator.IsWhitespaceOrEmptyOrNull(address.City);
     _validator.IsWhitespaceOrEmptyOrNull(address.State);
     _validator.IsWhitespaceOrEmptyOrNull(address.Pincode);
 }
 public ActionResult Put(int id, [FromBody] PatientAddress address)
 {
     if (id > 0)
     {
         ar.Update(address);
         return(Ok("Address Updated"));
     }
     return(NotFound());
 }
        public PatientAddress Delete(int id)
        {
            PatientAddress address = _context.PatientAddresses.Find(id);

            if (address != null)
            {
                _context.PatientAddresses.Remove(address);
                _context.SaveChanges();
            }
            return(address);
        }
 public string ForExport(string delimiter)
 {
     return
         (PatientAddress.ToString() + delimiter +
          Country + delimiter +
          Region + delimiter +
          Birthyear + delimiter +
          TreatmentAddress + delimiter +
          TreatmentBeginDate.ToString("yyyy-MM-dd hh:mm:ss") + delimiter +
          Symptoms.Aggregate("", (x, y) => x + y + "|") + delimiter +
          Diagnoses.Aggregate("", (x, y) => x + y + "|"));
 }
 public PatientAddedEvent(string id, string aggregateId, int version, string firstname, string lastname, string nationalIdentityNumber, DateTime createDateTime, DateTime updateDateTime, GenderTypes gender, DateTime birthDate, string logoUrl, string eidCardNumber, DateTime?eidCardValidity, PatientAddress address, ICollection <PatientContactInformation> contactInformations) : base(id, aggregateId, version)
 {
     Firstname = firstname;
     Lastname  = lastname;
     NationalIdentityNumber = nationalIdentityNumber;
     CreateDateTime         = createDateTime;
     UpdateDateTime         = updateDateTime;
     Gender              = gender;
     BirthDate           = birthDate;
     LogoUrl             = logoUrl;
     EidCardNumber       = eidCardNumber;
     EidCardValidity     = eidCardValidity;
     Address             = address;
     ContactInformations = contactInformations;
 }
        public static AttributeCollection Map(this PatientAddress patientAddress)
        {
            AttributeCollection attrCol = new AttributeCollection();

            if (patientAddress.StreetAddressLine != "" && patientAddress.State != "" && patientAddress.City != "" && patientAddress.State != "" && patientAddress.PostalCode != "")
            {
                attrCol.Add("crme_fulladdress", patientAddress.StreetAddressLine + " " + patientAddress.City + " " + patientAddress.State + " " + patientAddress.PostalCode);
            }

            attrCol.Add("crme_address1", patientAddress.StreetAddressLine);
            attrCol.Add("crme_city", patientAddress.City);
            attrCol.Add("crme_addressstate", patientAddress.State);
            attrCol.Add("crme_addresszip", patientAddress.PostalCode);

            return(attrCol);
        }
        public void MapToPatientAddress(PatientAddress patientAddress, PatientAddressDto patientAddressDto)
        {
            if (patientAddressDto == null)
            {
                return;
            }

            patientAddress = patientAddress ?? new PatientAddress();

            patientAddress.Line1      = patientAddressDto.Line1;
            patientAddress.Line2      = patientAddressDto.Line2;
            patientAddress.Suburb     = patientAddressDto.Suburb;
            patientAddress.City       = patientAddressDto.City;
            patientAddress.PostalCode = patientAddressDto.PostalCode;
            patientAddress.ProvinceId = patientAddressDto.ProvinceId;
            patientAddress.CountryId  = patientAddressDto.CountryId;
        }
        public PatientDTO AddPatient(PatientDTO PatientDTO)
        {
            var Patients = new Patient()
            {
                PatientName = PatientDTO.PatientName,
                Age         = PatientDTO.Age,
                Gender      = PatientDTO.Gender,
                PhoneNumber = PatientDTO.PhoneNumber,
                Loginid     = PatientDTO.Loginid
            };

            _context.Patients.Add(Patients);
            _context.SaveChanges();
            int Patientid = Patients.PatientId;


            PatientAddress addr = new PatientAddress()
            {
                StreetNumber = PatientDTO.StreetNumber,
                Area         = PatientDTO.Area,
                City         = PatientDTO.City,
                State        = PatientDTO.State,
                Country      = PatientDTO.Country,
                ZipCode      = PatientDTO.ZipCode,
                Patientid    = Patientid
            };

            _context.PatientAddresses.Add(addr);
            _context.SaveChanges();

            var uid = new UniqueIdType()
            {
                UniqueidType   = PatientDTO.UniqueIdType,
                UniqueidNumber = PatientDTO.UniqueidNumber,
                Patientid      = Patientid
            };

            _context.UniqueIdTypes.Add(uid);
            _context.SaveChanges();

            PatientDTO.PatientId = Patientid;
            return(PatientDTO);
        }
        public PatientAddress Add(PatientAddress address)
        {
            _context.PatientAddresses.Add(address);
            _context.SaveChanges();


            //_context.Addresses.Add(new Address()
            //{
            //    StreetNumber = address.StreetNumber,
            //    Area = address.Area,
            //    Locality = address.Locality,
            //    City = address.City,
            //    State = address.State,
            //    Country = address.Country,
            //    ZipCode = address.ZipCode
            //});
            //_context.SaveChanges();

            return(address);
        }
        public PatientAddressDto MapToPatientAddressDto(PatientAddress patientAddress)
        {
            if (patientAddress == null)
            {
                return(null);
            }

            PatientAddressDto patientAddressDto = new PatientAddressDto();

            patientAddressDto.PatientAddressId = patientAddress.PatientAddressId;
            patientAddressDto.Line1            = patientAddress.Line1;
            patientAddressDto.Line2            = patientAddress.Line2;
            patientAddressDto.Suburb           = patientAddress.Suburb;
            patientAddressDto.City             = patientAddress.City;
            patientAddressDto.PostalCode       = patientAddress.PostalCode;
            patientAddressDto.ProvinceId       = patientAddress.ProvinceId;
            patientAddressDto.CountryId        = patientAddress.CountryId;

            return(patientAddressDto);
        }
        private async System.Threading.Tasks.Task AddPatientDetails_ClickAsync()
        {
            var newAddress = new PatientAddress()
            {
                HouseNo = textBoxHouseNo.Text,
                Street  = textBoxStreet.Text,
                City    = textBoxCity.Text,
                State   = textBoxState.Text,
                Pincode = textBoxPincode.Text
            };

            var newVitals = new VitalsCategory()
            {
                PatientId = textBoxPatientId.Text,
                Spo2      = float.Parse(textBoxSpo2.Text),
                Bpm       = float.Parse(textBoxBpm.Text),
                RespRate  = float.Parse(textBoxResp.Text)
            };

            var newPatient = new PatientDetails()
            {
                PatientId   = textBoxPatientId.Text,
                PatientName = textBoxPatientName.Text,
                Age         = int.Parse(textBoxAge.Text),
                ContactNo   = textBoxContactNo.Text,
                BedId       = textBoxBedId.Text,
                IcuId       = textBoxIcuId.Text,
                Email       = textBoxEmail.Text,
                Address     = newAddress,
                Vitals      = newVitals
            };

            var response = await Client.PostAsync("http://localhost:5000/api/IcuOccupancyDetails/Patients", new StringContent(JsonConvert.SerializeObject(newPatient), Encoding.UTF8, "application/json"));

            var responseString = await response.Content.ReadAsStringAsync();

            textBoxPatientId.Text = responseString;
        }
示例#16
0
        public override async Task <IActionResult> PatchAsync(int id, [FromBody] PatientAddress patientAddress)
        {
            //var attrToUpdate = _jsonApiContext.AttributesToUpdate;
            //var patientAddressOld = _dbContextResolver.GetDbSet<PatientAddress>().Where(m => m.Id == id).FirstOrDefault();

            //CommonMethods commonMethods = new CommonMethods();


            //int eventID = _dbContextResolver.GetDbSet<Event>().LastOrDefault().Id + 1;
            //List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientAddressOld, patientAddress, "PatientAddress", attrToUpdate)
            //    //.Where(i => attrToUpdate.Keys.Any(a1 => a1.InternalAttributeName == i.PropertyName))
            //    .Select(q => new AuditLogs()
            //    {
            //        NewValue = q.NewValue,
            //        OldValue = q.OldValue,
            //        PrimaryKeyID = q.PrimaryKeyID,
            //        TableName = q.TableName,
            //        PropertyName = q.PropertyName,
            //        EventID = eventID
            //    }).ToList();
            //await _dbContextResolver.GetDbSet<AuditLogs>().AddRangeAsync(auditLogs);
            return(await base.PatchAsync(id, patientAddress));
        }
        public AddPatientRecordDetailsViewModel()
        {
            Department = new ObservableCollection <string>
            {
                "Orthopedic", "Cardiology", "Oncology", "Obstetrics and Gynaecology", "Cardiovascular ICU"
            };

            Ward = new ObservableCollection <string>
            {
                "Cardiology Ward", "Neurology Ward", "Obstetrics and Gynaecology Ward", "Oncology Ward", "Maternity Ward"
            };

            DocInCharge = new ObservableCollection <string>
            {
                "Dr. Asala Perera", "Dr. Janaka Thisera", "Dr. Manik Perera", "Dr. Seetha Fonseka", "Dr. Athula Dissanayake"
            };

            m_windowService = new WindowService();

            Patient = new PatientRecordDetailsModel();

            PatientAddress = new PatientAddress();
        }
示例#18
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 31, Configuration.FieldSeparator),
                       Id,
                       SetIdPid.HasValue ? SetIdPid.Value.ToString(culture) : null,
                       PatientId?.ToDelimitedString(),
                       PatientIdentifierList != null ? string.Join(Configuration.FieldRepeatSeparator, PatientIdentifierList.Select(x => x.ToDelimitedString())) : null,
                       AlternatePatientIdPid != null ? string.Join(Configuration.FieldRepeatSeparator, AlternatePatientIdPid.Select(x => x.ToDelimitedString())) : null,
                       PatientName != null ? string.Join(Configuration.FieldRepeatSeparator, PatientName.Select(x => x.ToDelimitedString())) : null,
                       MothersMaidenName != null ? string.Join(Configuration.FieldRepeatSeparator, MothersMaidenName.Select(x => x.ToDelimitedString())) : null,
                       DateTimeOfBirth.HasValue ? DateTimeOfBirth.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       AdministrativeSex,
                       PatientAlias != null ? string.Join(Configuration.FieldRepeatSeparator, PatientAlias.Select(x => x.ToDelimitedString())) : null,
                       Race != null ? string.Join(Configuration.FieldRepeatSeparator, Race.Select(x => x.ToDelimitedString())) : null,
                       PatientAddress != null ? string.Join(Configuration.FieldRepeatSeparator, PatientAddress.Select(x => x.ToDelimitedString())) : null,
                       CountyCode,
                       PhoneNumberHome != null ? string.Join(Configuration.FieldRepeatSeparator, PhoneNumberHome.Select(x => x.ToDelimitedString())) : null,
                       PhoneNumberBusiness != null ? string.Join(Configuration.FieldRepeatSeparator, PhoneNumberBusiness.Select(x => x.ToDelimitedString())) : null,
                       PrimaryLanguage?.ToDelimitedString(),
                       MaritalStatus?.ToDelimitedString(),
                       Religion?.ToDelimitedString(),
                       PatientAccountNumber?.ToDelimitedString(),
                       SsnNumberPatient,
                       DriversLicenseNumberPatient?.ToDelimitedString(),
                       MothersIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, MothersIdentifier.Select(x => x.ToDelimitedString())) : null,
                       EthnicGroup != null ? string.Join(Configuration.FieldRepeatSeparator, EthnicGroup.Select(x => x.ToDelimitedString())) : null,
                       BirthPlace,
                       MultipleBirthIndicator,
                       BirthOrder.HasValue ? BirthOrder.Value.ToString(Consts.NumericFormat, culture) : null,
                       Citizenship != null ? string.Join(Configuration.FieldRepeatSeparator, Citizenship.Select(x => x.ToDelimitedString())) : null,
                       VeteransMilitaryStatus?.ToDelimitedString(),
                       Nationality?.ToDelimitedString(),
                       PatientDeathDateAndTime.HasValue ? PatientDeathDateAndTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       PatientDeathIndicator
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
 private void ChangePatientAddress(PatientAddressDto patientAddressDto, Patient patient, PatientAddress patientAddress)
 {
     RemovePatientAddress(patientAddressDto, patient, patientAddress);
     AddPatientAddress(patientAddressDto, patient);
 }
 private static void RemovePatientAddress(PatientAddressDto patientAddressDto, Patient patient, PatientAddress patientAddress)
 {
     patient.RemoveAddress(patientAddress);
 }
示例#21
0
 public PatientAddress UpdatePatientAddressData(int id, PatientAddress patientInfo)
 {
     return(_patientCommonRepository.UpdatePatientAddressData(id, patientInfo));
 }
示例#22
0
        public void CreatePatientMapping()
        {
            try
            {
                var dataSet = TableAgent.DataSet.Tables[FbTableName].Rows;
                RecordCount = TableAgent.RowCount;
                //Guid instId = nHelper.GetInstitutionId(MigrationVariables.CurrentSiteId);

                foreach (DataRow row in dataSet)
                {
                    User user = new User();

                    // get userid from old aspnetdb matching on patientid #####.#####
                    // if no userid then create new one for this patient
                    var patId  = row["KEYID"].ToString();
                    var uid    = aHelper.GetUserIdFromPatientId(patId);
                    var userId = (uid != Guid.Empty) ? uid : Guid.NewGuid();
                    userId = nHelper.ValidGuid(userId);

                    if (mHelper.HasPatientMigrated(patId))
                    {
                        MappingStatistics.LogFailedMapping("PATIENTS", patId, "Patients", typeof(Patient), String.Empty, "Patient previously migrated.");
                        FailedCount++;
                    }
                    else
                    {
                        var medRecId = (row["MEDICALRECORDIDENTIFIER"] is DBNull) ? String.Empty : row["MEDICALRECORDIDENTIFIER"].ToString();

                        if (!String.IsNullOrEmpty(medRecId) && !medRecId.StartsWith("PR_"))
                        {
                            MemoryMappings.AddMRID(new MedicalRecordIdentifier {
                                MRID = medRecId,
                                //InstitutionId = instId,
                                PatientUserId = userId
                            });
                        }

                        var pat = new Patient
                        {
                            UserId      = userId,
                            Firstname   = (row["FIRSTNAME"] is DBNull) ? String.Empty : row["FIRSTNAME"].ToString(),
                            Lastname    = (row["LASTNAME"] is DBNull) ? String.Empty : row["LASTNAME"].ToString(),
                            Middlename  = (row["MIDDLENAME"] is DBNull) ? String.Empty : row["MIDDLENAME"].ToString(),
                            Gender      = (row["GENDER"] is DBNull) ? 1 : (row["GENDER"].ToString().ToLower().StartsWith("m", StringComparison.CurrentCulture)) ? 2 : 3, //From the GlobalStandards database, 'Gender' table
                            DateofBirth = (row["DOB"] is DBNull) ? new DateTime(1800, 1, 1) : mu.ParseFirebirdDateTime(row["DOB"].ToString()),
                            Email       = (row["EMAIL"] is DBNull) ? String.Empty : row["EMAIL"].ToString(),
                            //InstitutionId = instId,
                            LastUpdatedByUser = userId
                        };

                        var adr = new PatientAddress
                        {
                            Street1           = (row["STREET1"] is DBNull) ? String.Empty : row["STREET1"].ToString(),
                            Street2           = (row["STREET2"] is DBNull) ? String.Empty : row["STREET2"].ToString(),
                            Street3           = (row["STREET3"] is DBNull) ? String.Empty : row["STREET3"].ToString(),
                            City              = (row["CITY"] is DBNull) ? String.Empty : row["CITY"].ToString(),
                            County            = (row["COUNTY"] is DBNull) ? String.Empty : row["COUNTY"].ToString(),
                            State             = (row["STATE"] is DBNull) ? String.Empty : row["STATE"].ToString(),
                            Zip               = (row["ZIP"] is DBNull) ? String.Empty : row["ZIP"].ToString(),
                            Country           = (row["COUNTRY"] is DBNull) ? String.Empty : row["COUNTRY"].ToString(),
                            LastUpdatedByUser = userId
                        };

                        pat.PatientAddresses.Add(adr);

                        // must create clinipro user to store new userid for future usage
                        if (uid == Guid.Empty || uid != userId)
                        {
                            aHelper.CreateCliniProUser(userId, patId);

                            user.UserId = userId;
                            user.AssignedUserTypes.Add(new AssignedUserType {
                                UserId = userId, UserType = (int)UserType.Patient
                            });
                            user.CreationDate = DateTime.Now;

                            pat.User = user;
                        }

                        // add patient info to in-memery collection for use throughout application
                        MemoryMappings.AddPatientInfo(MigrationVariables.CurrentSiteId, patId, pat.UserId);

                        if (CanAddToContext(user.UserId))
                        {
                            CompletedMappings.Add(pat);
                        }
                        else
                        {
                            MappingStatistics.LogFailedMapping("PATIENTS", patId, "Patients", typeof(Patient), JsonConvert.SerializeObject(user), "Patient already exist in database.");
                            FailedCount++;
                        }
                    }
                }

                MappingStatistics.LogMappingStat("PATIENTS", RecordCount, "Patients", CompletedMappings.Count, FailedCount);
            }
            catch (Exception e)
            {
                throw new Exception("Error creating Patient mapping.", e);
            }
        }
 public ActionResult Post([FromBody] PatientAddress address)
 {
     ar.Add(address);
     return(Ok());
 }
示例#24
0
    public string Update_Patient(PatientName Pat_Name, PatientPersonalDetails Pat_Per_Details, PatientAddress Pat_Add,
                           PatientInsuranceDetails Pat_Ins_Details, PatientAllergies Pat_Allergies,
                           FacilityInfo Fac_Info, PharmacyInfo Phrm_Info,ProviderInfo Prov_Info)
    {
        SqlConnection sqlCon = new SqlConnection(ConStr);
        SqlCommand sqlCmd = new SqlCommand("sp_update_Patient", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter P_ID = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int);
        P_ID.Value = Pat_Name.Pat_ID;

        SqlParameter P_MName = sqlCmd.Parameters.Add("@Pat_MName", SqlDbType.VarChar, 50);
        if (Pat_Name.MiddleName != null)
            P_MName.Value = Pat_Name.MiddleName;
        else
            P_MName.Value = Convert.DBNull;

        SqlParameter P_Gender = sqlCmd.Parameters.Add("@Pat_Gender", SqlDbType.Char, 1);
        if (Pat_Per_Details.Gender != null)
            P_Gender.Value = Pat_Per_Details.Gender;
        else
            P_Gender.Value = Convert.DBNull;

        SqlParameter P_DOB = sqlCmd.Parameters.Add("@Pat_DOB", SqlDbType.DateTime);
        if (Pat_Per_Details.DOB != null)
            P_DOB.Value = DateTime.Parse(Pat_Per_Details.DOB);
        else
        {
            Nullable<DateTime> NullDate = null;
            P_DOB.Value = NullDate;
        }

        SqlParameter P_SSN = sqlCmd.Parameters.Add("@Pat_SSN", SqlDbType.VarChar, 50);
        if (Pat_Per_Details.SSN != null)
            P_SSN.Value = Pat_Per_Details.SSN;
        else
            P_SSN.Value = Convert.DBNull;

        SqlParameter P_Address1 = sqlCmd.Parameters.Add("@Pat_Address1", SqlDbType.VarChar, 50);
        if (Pat_Add.Address1 != null)
            P_Address1.Value = Pat_Add.Address1;
        else
            P_Address1.Value = Convert.DBNull;

        SqlParameter P_Address2 = sqlCmd.Parameters.Add("@Pat_Address2", SqlDbType.VarChar, 50);
        if (Pat_Add.Address2 != null)
            P_Address2.Value = Pat_Add.Address2;
        else
            P_Address2.Value = Convert.DBNull;

        SqlParameter P_City = sqlCmd.Parameters.Add("@Pat_City", SqlDbType.VarChar, 50);
        if (Pat_Add.City != null)
            P_City.Value = Pat_Add.City;
        else
            P_City.Value = Convert.DBNull;
        SqlParameter P_State = sqlCmd.Parameters.Add("@Pat_State", SqlDbType.VarChar, 50);
        if (Pat_Add.State != null)
            P_State.Value = Pat_Add.State;
        else
            P_State.Value = Convert.DBNull;
        SqlParameter P_ZIP = sqlCmd.Parameters.Add("@Pat_Zip", SqlDbType.VarChar, 50);
        if (Pat_Add.Zip != null)
            P_ZIP.Value = Pat_Add.Zip;
        else
            P_ZIP.Value = Convert.DBNull;
        SqlParameter P_PDoc = sqlCmd.Parameters.Add("@Pat_PDoc", SqlDbType.VarChar, 50);
        if (Pat_Per_Details.Pat_Pre_Doc != null)
            P_PDoc.Value = Pat_Per_Details.Pat_Pre_Doc;
        else
            P_PDoc.Value = Convert.DBNull;

        SqlParameter P_MRN = sqlCmd.Parameters.Add("@Pat_MRN", SqlDbType.VarChar, 15);
        if (Pat_Per_Details.MRN != null)
            P_MRN.Value = Pat_Per_Details.MRN;
        else
            P_MRN.Value = Convert.DBNull;

        SqlParameter Fac_ID = sqlCmd.Parameters.Add("@Fac_ID", SqlDbType.Int);
        if (Fac_Info.FacilityNO != null)
            Fac_ID.Value = Fac_Info.FacilityNO;
        else
            Fac_ID.Value = Convert.DBNull;

        SqlParameter Phrm_ID = sqlCmd.Parameters.Add("@Phrm_ID", SqlDbType.Int);
        if (Phrm_Info.PhrmID != null)
            Phrm_ID.Value = Phrm_Info.PhrmID;
        else
            Phrm_ID.Value = Convert.DBNull;

        //SqlParameter PI_InsName = sqlCmd.Parameters.Add("@Ins_Name", SqlDbType.VarChar, 50);
        //if (Pat_Ins_Details.InsuranceName != null)
        //    PI_InsName.Value = Pat_Ins_Details.InsuranceName;
        //else
        //    PI_InsName.Value = Convert.DBNull;

        int InsID = getInsuranceID(Pat_Ins_Details);
        Pat_Ins_Details.InsuranceID = InsID;

        SqlParameter Ins_ID = sqlCmd.Parameters.Add("@Ins_ID", SqlDbType.Int);
        if (Pat_Ins_Details.InsuranceID.ToString() != "0")
            Ins_ID.Value = Pat_Ins_Details.InsuranceID;
        else
            Ins_ID.Value = Convert.DBNull;

        SqlParameter PI_No = sqlCmd.Parameters.Add("@PI_Number", SqlDbType.Int);
        if (Pat_Ins_Details.PI_PolicyNo.ToString() != "0")
            PI_No.Value = Pat_Ins_Details.PI_PolicyNo;
        else
            PI_No.Value = Convert.DBNull;

        SqlParameter PI_PolicyID = sqlCmd.Parameters.Add("@PI_PolicyID", SqlDbType.Int);
        if (Pat_Ins_Details.PI_PolicyID.ToString() != "0")
            PI_PolicyID.Value = Pat_Ins_Details.PI_PolicyID;
        else
            PI_PolicyID.Value = Convert.DBNull;

        SqlParameter PI_GroupNo = sqlCmd.Parameters.Add("@PI_GroupNo", SqlDbType.Int);
        if (Pat_Ins_Details.PI_GroupNo.ToString() != "0")
            PI_GroupNo.Value = Pat_Ins_Details.PI_GroupNo;
        else
            PI_GroupNo.Value = Convert.DBNull;

        SqlParameter PI_BINNo = sqlCmd.Parameters.Add("@PI_BINNo", SqlDbType.Int);
        if (Pat_Ins_Details.PI_BINNo.ToString() != "0")
            PI_BINNo.Value = Pat_Ins_Details.PI_BINNo;
        else
            PI_BINNo.Value = Convert.DBNull;

        SqlParameter PI_InsdName = sqlCmd.Parameters.Add("@PI_InsdName", SqlDbType.VarChar, 50);
        if (Pat_Ins_Details.InsuredName != null)
            PI_InsdName.Value = Pat_Ins_Details.InsuredName;
        else
            PI_InsdName.Value = Convert.DBNull;

        SqlParameter PI_InsdDOB = sqlCmd.Parameters.Add("@PI_InsdDOB", SqlDbType.DateTime);
        if (Pat_Ins_Details.InsuredDOB != null)
            PI_InsdDOB.Value = DateTime.Parse( Pat_Ins_Details.InsuredDOB);
        else
        {
            Nullable<DateTime> NullDate = null;
            PI_InsdDOB.Value = NullDate;
        }
        SqlParameter PI_InsdSSN = sqlCmd.Parameters.Add("@PI_InsdSSN", SqlDbType.VarChar, 50);
        if (Pat_Ins_Details.InsuredSSN != null)
            PI_InsdSSN.Value = Pat_Ins_Details.InsuredSSN;
        else
            PI_InsdSSN.Value = Convert.DBNull;
        SqlParameter PI_InsdRel = sqlCmd.Parameters.Add("@PI_InsdRel", SqlDbType.VarChar, 50);
        if (Pat_Ins_Details.InsuredRelation != null)
            PI_InsdRel.Value = Pat_Ins_Details.InsuredRelation;
        else
            PI_InsdRel.Value = Convert.DBNull;

        SqlParameter PA_Desc = sqlCmd.Parameters.Add("@PA_Desc", SqlDbType.VarChar, 200);
        if (Pat_Allergies.AllergyDescription != null)
            PA_Desc.Value = Pat_Allergies.AllergyDescription;
        else
            PA_Desc.Value = Convert.DBNull;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            return ex.ToString();
        }
        finally
        {
            sqlCon.Close();
        }

        return "Updated Patient Information Successfully";
    }
示例#25
0
 public override async Task <IActionResult> PostAsync([FromBody] PatientAddress patientAddress)
 {
     return(await base.PostAsync(patientAddress));
 }
示例#26
0
 /// <summary>
 /// Determines whether [is homeless address] [the specified patient address].
 /// </summary>
 /// <param name="patientAddress">The patient address.</param>
 /// <returns>
 ///   <c>true</c> if [is homeless address] [the specified patient address]; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsHomelessAddress(this PatientAddress patientAddress)
 {
     return(patientAddress.PatientAddressType.WellKnownName == PatientAddressType.Homeless);
 }
 public PatientAddViewModel()
 {
     errresults = new List <ValidationResult>();
     CopyMe     = new PatientAddress();
 }
        public PatientModel PostEditMethod(PatientModel rm)
        {
            //string date = rm.DOB.ToString("d");
            //string result = objRegisterModel.DOB.Substring(6);
            int birthyear   = Convert.ToDateTime(rm.DOB).Year;
            int currentyear = DateTime.Now.Year;

            //int age = currentyear - Convert.ToInt32(result);
            int Yourage = currentyear - birthyear;

            using (var parepo = new PatientRepository())
            {
                if (rm.userId == 0)
                {
                    Patient _patient = new Patient();

                    _patient.PatientId     = rm.userId;
                    _patient.Email         = rm.Email;
                    _patient.FullName      = rm.FullName;
                    _patient.Surname       = rm.Surname;
                    _patient.Title         = rm.Title;
                    _patient.Age           = Convert.ToString(Yourage);
                    _patient.MaritalStatus = rm.Status;
                    _patient.DOB           = rm.DOB;
                    _patient.Sex           = rm.Sex;
                    List <string> list = new List <string>();
                    foreach (PatientAddressModel pa in rm.PatientAddresses.ToList())
                    {
                        if (pa.DeleteAddress == true)
                        {
                            // Delete address which is marked to remove
                            rm.PatientAddresses.Remove(pa);
                        }
                    }
                    ;

                    foreach (var item in rm.PatientAddresses.ToList())
                    {
                        PatientAddress padd = new PatientAddress();
                        padd.Address = item.Address;
                        _patient.PatientAddresses.Add(padd);
                    }

                    _patient.Address1          = rm.Address1;
                    _patient.Address2          = rm.Address2;
                    _patient.Address3          = rm.Address3;
                    _patient.PostalCode        = rm.PostalCode;
                    _patient.Telephone         = rm.Telephone;
                    _patient.Employer          = rm.Employer;
                    _patient.EmployerTelephone = rm.EmployerTelephone;
                    _patient.Occupation        = rm.Occupation;
                    _patient.NationalId        = rm.NationalId;
                    _patient.Status            = "Alive";
                    _patient.PatientAllergy    = rm.PatientAllergy;
                    _patient.MedicalAidName    = rm.MedicalAidName;
                    _patient.MedicalAidNo      = rm.MedicalAidNo;
                    _patient.registeredDate    = DateTime.Now;

                    //Code to save the image to the Db
                    if (rm.File != null && rm.File.ContentLength > 0)
                    {
                        _patient.FileName    = System.IO.Path.GetFileName(rm.File.FileName);
                        _patient.FileType    = GlenwoodMed.Model.ViewModels.FileType.Avatar;
                        _patient.ContentType = rm.File.ContentType;

                        using (var reader = new System.IO.BinaryReader(rm.File.InputStream))
                        {
                            _patient.File = reader.ReadBytes(rm.File.ContentLength);
                        }
                    }

                    parepo.Insert(_patient);
                }

                else
                {
                    Patient _patient = parepo.GetById(rm.userId);

                    _patient.PatientId         = rm.userId;
                    _patient.Email             = rm.Email;
                    _patient.FullName          = rm.FullName;
                    _patient.Surname           = rm.Surname;
                    _patient.Age               = Convert.ToString(Yourage);
                    _patient.Title             = rm.Title;
                    _patient.MaritalStatus     = rm.MaritalStatus;
                    _patient.DOB               = rm.DOB;
                    _patient.Sex               = rm.Sex;
                    _patient.Address1          = rm.Address1;
                    _patient.Address2          = rm.Address2;
                    _patient.Address3          = rm.Address3;
                    _patient.PostalCode        = rm.PostalCode;
                    _patient.Telephone         = rm.Telephone;
                    _patient.Employer          = rm.Employer;
                    _patient.EmployerTelephone = rm.EmployerTelephone;
                    _patient.Occupation        = rm.Occupation;
                    _patient.NationalId        = rm.NationalId;
                    _patient.Status            = rm.Status;
                    _patient.PatientAllergy    = rm.PatientAllergy;
                    _patient.MedicalAidName    = rm.MedicalAidName;
                    _patient.MedicalAidNo      = rm.MedicalAidNo;

                    if (rm.File != null && rm.File.ContentLength > 0)
                    {
                        _patient.FileName    = System.IO.Path.GetFileName(rm.File.FileName);
                        _patient.FileType    = GlenwoodMed.Model.ViewModels.FileType.Avatar;
                        _patient.ContentType = rm.File.ContentType;

                        using (var reader = new System.IO.BinaryReader(rm.File.InputStream))
                        {
                            _patient.File = reader.ReadBytes(rm.File.ContentLength);
                        }
                    }

                    foreach (var item in rm.PatientAddresses.ToList())
                    {
                        PatientAddress padd = new PatientAddress();
                        padd.Address = item.Address;
                        _patient.PatientAddresses.Add(padd);
                    }
                    parepo.Update(_patient);
                }

                return(rm);
            }
        }
        public void CreateMethod(PatientModel rm, string Gender, string Status, string Title, string Patient_No)
        {
            Email_serviceViewModel es  = new Email_serviceViewModel();
            Email_serviceBusiness  esb = new Email_serviceBusiness();

            using (var parepo = new PatientRepository())
            {
                //if (rm.userId == null)
                //{
                //string result = objRegisterModel.DOB.Substring(6);
                int birthyear   = Convert.ToDateTime(rm.DOB).Year;
                int currentyear = DateTime.Now.Year;

                //int age = currentyear - Convert.ToInt32(result);
                int Yourage = currentyear - birthyear;

                Patient _patient = new Patient();

                _patient.PatientId     = rm.userId;
                _patient.Email         = rm.Email;
                _patient.FullName      = rm.FullName;
                _patient.Surname       = rm.Surname;
                _patient.Title         = Title;
                _patient.Age           = Convert.ToString(Yourage);
                _patient.MaritalStatus = Status;
                _patient.DOB           = rm.DOB;
                _patient.Sex           = Gender;
                List <string> list = new List <string>();
                foreach (PatientAddressModel pa in rm.PatientAddresses.ToList())
                {
                    if (pa.DeleteAddress == true)
                    {
                        // Delete address which is marked to remove
                        rm.PatientAddresses.Remove(pa);
                    }
                }
                ;

                foreach (var item in rm.PatientAddresses.ToList())
                {
                    PatientAddress padd = new PatientAddress();
                    padd.Address = item.Address;
                    _patient.PatientAddresses.Add(padd);
                }

                _patient.Address1          = rm.Address1;
                _patient.Address2          = rm.Address2;
                _patient.Address3          = rm.Address3;
                _patient.PostalCode        = rm.PostalCode;
                _patient.Telephone         = rm.Telephone;
                _patient.Employer          = rm.Employer;
                _patient.EmployerTelephone = rm.EmployerTelephone;
                _patient.Occupation        = rm.Occupation;
                _patient.NationalId        = rm.NationalId;
                _patient.Status            = "Alive";
                _patient.PatientAllergy    = rm.PatientAllergy;
                _patient.MedicalAidName    = rm.MedicalAidName;
                _patient.MedicalAidNo      = rm.MedicalAidNo;
                _patient.registeredDate    = DateTime.Now;
                _patient.PatientNo         = Patient_No;

                //Code to save the image to the Db
                if (rm.File != null && rm.File.ContentLength > 0)
                {
                    _patient.FileName    = System.IO.Path.GetFileName(rm.File.FileName);
                    _patient.FileType    = GlenwoodMed.Model.ViewModels.FileType.Avatar;
                    _patient.ContentType = rm.File.ContentType;

                    using (var reader = new System.IO.BinaryReader(rm.File.InputStream))
                    {
                        _patient.File = reader.ReadBytes(rm.File.ContentLength);
                    }
                }

                es.To      = rm.Email;
                es.Subject = "Registration Details";
                es.Body    = "Patient Number: " + Patient_No + "<br/>"
                             + "Username: "******"<br/>"
                             + "Password: "******"PatientId"] = _patient.PatientId;
                //}
            }
        }