private void SavePcp(long customerId, string primaryCarePhysicianName, long updatorOrgRoleUserId, long eventCustomerId) { var pcp = _primaryCarePhysicianRepository.Get(customerId); if (!string.IsNullOrEmpty(primaryCarePhysicianName)) { if (pcp == null) { pcp = new PrimaryCarePhysician { CustomerId = customerId, Name = new Name(primaryCarePhysicianName), DataRecorderMetaData = new DataRecorderMetaData(updatorOrgRoleUserId, DateTime.Now, null) }; } else { pcp.Name = new Name(primaryCarePhysicianName); } _primaryCarePhysicianRepository.Save(pcp); SaveCustomerHealthAnswer("Yes", customerId, eventCustomerId); } else if (pcp != null) { _primaryCarePhysicianRepository.Delete(pcp); SaveCustomerHealthAnswer("No", customerId, eventCustomerId); } }
public void Delete(PrimaryCarePhysician domainObject) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { adapter.DeleteEntitiesDirectly("CustomerPrimaryCarePhysicianEntity", new RelationPredicateBucket(CustomerPrimaryCarePhysicianFields.PrimaryCarePhysicianId == domainObject.Id)); } }
public void AddShippingForPcp(long customerId, long eventId, PrimaryCarePhysician pcp) { // var pcp = _primaryCarePhysicianRepository.Get(customerId); if (pcp == null || pcp.Address == null) { return; } var shippingOption = _shippingOptionRepository.GetShippingOptionByProductId((long)Product.UltraSoundImages, true); if (shippingOption == null) { return; } var shippingDetails = _shippingDetailRepository.GetShippingDetailsForEventCustomer(eventId, customerId); if (!shippingDetails.IsNullOrEmpty()) { if (shippingDetails.Any(sd => sd.ShippingOption.Id == shippingOption.Id)) { return; } } var order = _orderRepository.GetOrder(customerId, eventId); //added As Admin User Role var organizationRoleUser = new OrganizationRoleUser { Id = customerId }; AddPcpShipping(order, shippingOption, pcp, organizationRoleUser); }
private void SetPcpPracticeAddress(PrimaryCarePhysician pcp, CorporateCustomerEditModel model) { if (model.PcpAddress1.Length > 0 && model.PcpState.Length > 0 && model.PcpCity.Length > 0 && model.PcpZip.Length > 0) { long addressId = 0; if (pcp.Address != null) { addressId = pcp.Address.Id; } pcp.Address = new Address(addressId) { StreetAddressLine1 = model.PcpAddress1, StreetAddressLine2 = model.PcpAddress2, City = model.PcpCity, State = model.PcpState, ZipCode = model.PcpZip.Length >= 5 ? new ZipCode(model.PcpZip.Substring(0, 5)) : new ZipCode(model.PcpZip.PadLeft(5, '0')), CountryId = (long)CountryCode.UnitedStatesAndCanada }; } else { pcp.Address = null; } }
private void SetPcpMailingAddress(PrimaryCarePhysician pcp, CorporateCustomerEditModel model) { if ((model.PCPMailingAddress1.Length > 0 && model.PCPMailingState.Length > 0 && model.PCPMailingCity.Length > 0 && model.PCPMailingZip.Length > 0)) { bool isAddress = false; long addressId = 0; if (pcp.MailingAddress != null && (pcp.Address == null || pcp.MailingAddress.Id != pcp.Address.Id)) { isAddress = IsPcpAddressSame(pcp); if (isAddress == false) { addressId = pcp.MailingAddress.Id; } } pcp.MailingAddress = new Address(addressId) { StreetAddressLine1 = model.PCPMailingAddress1, StreetAddressLine2 = model.PCPMailingAddress2, City = model.PCPMailingCity, State = model.PCPMailingState, ZipCode = model.PCPMailingZip.Length >= 5 ? new ZipCode(model.PCPMailingZip.Substring(0, 5)) : new ZipCode(model.PCPMailingZip.PadLeft(5, '0')), CountryId = (long)CountryCode.UnitedStatesAndCanada }; } else { pcp.MailingAddress = null; } }
private void SetPcpMaillingAddress(PrimaryCarePhysician pcp, long countryId) { if (UCPCPInfo1.IsMaillingAddressSame || IsMailingAddressSame()) { pcp.MailingAddress = null; return; } long mailingAddressId = 0; if (pcp.MailingAddress != null && (pcp.Address == null || pcp.MailingAddress.Id != pcp.Address.Id)) { mailingAddressId = pcp.MailingAddress.Id; } pcp.MailingAddress = new Address(mailingAddressId) { StreetAddressLine1 = UCPCPInfo1.MaillingAddress1, StreetAddressLine2 = UCPCPInfo1.MaillingAddress2, City = UCPCPInfo1.MaillingCity, StateId = Convert.ToInt64(UCPCPInfo1.MaillingState), ZipCode = new ZipCode(UCPCPInfo1.MaillingZip), CountryId = countryId }; }
private bool IsPcpAddressSame(PrimaryCarePhysician pcp) { if (pcp.Address != null && pcp.MailingAddress != null) { return(pcp.Address.StreetAddressLine1 == pcp.MailingAddress.StreetAddressLine1 && pcp.Address.StreetAddressLine2 == pcp.MailingAddress.StreetAddressLine2 && pcp.Address.City == pcp.MailingAddress.City && pcp.Address.State == pcp.MailingAddress.State && pcp.Address.ZipCode.Zip == pcp.MailingAddress.ZipCode.Zip); } return(false); }
private bool IsPcpUpdated(PrimaryCarePhysician pcp, CorporateCustomerEditModel model) { if (!(string.IsNullOrEmpty(model.PcpFirstName) || model.PcpFirstName.Equals(pcp.Name.FirstName, StringComparison.InvariantCultureIgnoreCase)) || !(string.IsNullOrEmpty(model.PcpLastName) || model.PcpLastName.Equals(pcp.Name.LastName, StringComparison.InvariantCultureIgnoreCase))) { return(true); } return(false); }
private PotentialPcpChangeReportListModel GetNonTargetableReportModel(IEnumerable <EventCustomer> eventCustomers) { if (eventCustomers.IsNullOrEmpty()) { _logger.Info("eventCustomers provided is null or empty"); return(null); } var listModel = new PotentialPcpChangeReportListModel(); var collection = new List <PotentialPcpChangeReportViewModel>(); var customerIds = eventCustomers.Select(x => x.CustomerId).ToArray(); var customers = _customerRepository.GetCustomers(customerIds); var customerPcpCollection = (IReadOnlyCollection <PrimaryCarePhysician>)_primaryCarePhysicianRepository.GetForPcpChangeReport(customerIds); foreach (var eventCustomer in eventCustomers) { var currentCustomerId = eventCustomer.CustomerId; var customer = customers.FirstOrDefault(x => x.CustomerId == currentCustomerId); var customerPrimaryCarePhysicians = customerPcpCollection.Where(x => x.CustomerId == currentCustomerId); PrimaryCarePhysician newPcpDetail = null; PrimaryCarePhysician oldPcpDetail = null; if (!customerPrimaryCarePhysicians.IsNullOrEmpty()) { newPcpDetail = customerPrimaryCarePhysicians.SingleOrDefault(x => x.IsActive); if (newPcpDetail != null) { var orderCpcp = (from cpcp in customerPrimaryCarePhysicians where cpcp.Id != newPcpDetail.Id orderby cpcp.DataRecorderMetaData.DateCreated select cpcp).ToArray(); if (!orderCpcp.IsNullOrEmpty()) { oldPcpDetail = orderCpcp.LastOrDefault(x => x.Source.HasValue && x.Source.Value == (long)CustomerPcpUpdateSource.CorporateUpload); if (oldPcpDetail == null) { oldPcpDetail = orderCpcp.FirstOrDefault(); } } } } var viewModel = _potentialPcpChangeReportFactory.CreateModel(oldPcpDetail, newPcpDetail, customer); collection.Add(viewModel); } listModel.Collection = collection; return(listModel); }
private void AddPcpShipping(Order order, ShippingOption shippingOption, PrimaryCarePhysician pcp, OrganizationRoleUser organizationRoleUser) { var orderDetail = _orderController.GetActiveOrderDetail(order); var shippingDetails = SavePcpShippingDetail(pcp.Address, organizationRoleUser, shippingOption); var shippingDetailOrderDetail = new ShippingDetailOrderDetail { Amount = shippingDetails.ActualPrice, IsActive = true, OrderDetailId = orderDetail.Id, ShippingDetailId = shippingDetails.Id }; _shippingDetailOrderDetailRepository.Save(shippingDetailOrderDetail); }
private bool IsMailingAddressSame(PrimaryCarePhysician pcp) { if (pcp.Address == null && pcp.MailingAddress == null) { return(true); } if (pcp.Address != null && pcp.MailingAddress == null) { return(true); } if (pcp.Address == null && pcp.MailingAddress != null) { return(true); } return(pcp.MailingAddress.Id == pcp.Address.Id); }
private UniversalProviderViewModel GetProviderViewModel(PrimaryCarePhysician primaryCarePhysician, CorporateAccount account) { var model = new UniversalProviderViewModel { ClientID = account.ClientId, ClientProviderId = primaryCarePhysician.Id.ToString(), FirstName = primaryCarePhysician.Name != null?ClearText(primaryCarePhysician.Name.FirstName) : string.Empty, MiddleName = primaryCarePhysician.Name != null?ClearText(primaryCarePhysician.Name.MiddleName) : string.Empty, LastName = primaryCarePhysician.Name != null?ClearText(primaryCarePhysician.Name.LastName) : string.Empty, Suffix = primaryCarePhysician.SuffixText, TaxonomyCode = string.Empty, Gender = string.Empty, Npi = string.Empty, TelephoneNumber1 = CleanPhone(primaryCarePhysician.Primary), FaxTelephoneNumber = CleanPhone(primaryCarePhysician.Fax), SecureFaxTelephoneNumber = string.Empty, EmailAddress = (primaryCarePhysician.Email != null ? primaryCarePhysician.Email.ToString() : string.Empty), WebSiteAddress = string.Empty }; if (primaryCarePhysician.Address != null && !primaryCarePhysician.Address.IsEmpty()) { model.Street1 = ClearText(primaryCarePhysician.Address.StreetAddressLine1); model.Street2 = ClearText(primaryCarePhysician.Address.StreetAddressLine2); model.City = primaryCarePhysician.Address.City; model.State = primaryCarePhysician.Address.StateCode; model.Zip = primaryCarePhysician.Address.ZipCode != null ? primaryCarePhysician.Address.ZipCode.Zip : string.Empty; } if (primaryCarePhysician.MailingAddress != null && !primaryCarePhysician.MailingAddress.IsEmpty()) { model.Street1 = ClearText(primaryCarePhysician.MailingAddress.StreetAddressLine1); model.Street2 = ClearText(primaryCarePhysician.MailingAddress.StreetAddressLine2); model.City = primaryCarePhysician.MailingAddress.City; model.State = primaryCarePhysician.MailingAddress.StateCode; model.Zip = primaryCarePhysician.MailingAddress.ZipCode != null ? primaryCarePhysician.MailingAddress.ZipCode.Zip : string.Empty; } return(model); }
private DocumentationOfCcd GetDocumentationOf(PrimaryCarePhysician pcp, Event theEventData) { if (pcp == null) { return(null); } AssignedPerson assingedPerson = null; if (pcp.Name != null) { assingedPerson = new AssignedPerson { Name = GetName(pcp.Name) }; } return(new DocumentationOfCcd { ServiceEvent = new ServiceEvent { EffectiveTime = new EffectiveTime { Low = new DocumentGenerationDate(theEventData.EventDate), High = new DocumentGenerationtime(DateTime.Now) }, ClassCode = PerformerTypeCode.Perfromer, Performer = new Performer { AssingnedEntity = new AssingnedEntity { Address = GetClinicalAddress(pcp.Address, AddressType.Workplace), AssignedPerson = assingedPerson, ClinicalTeleCom = (pcp.Fax != null && !pcp.Fax.IsEmpty()) ? new ClinicalTeleCom(TelecomType.Workplace, pcp.Fax.FaxNumberFormat) : null }, TypeCode = PerformerTypeCode.Perfromer } } }); }
public PrimaryCarePhysician Save(PrimaryCarePhysician domainObject) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { if (domainObject.Id <= 0) { DecativatePhysician(domainObject.CustomerId, domainObject.DataRecorderMetaData.DataRecorderCreator.Id); } var isSkipAddressCheck = domainObject.Source.HasValue && domainObject.Source.Value == (long)CustomerPcpUpdateSource.CorporateUpload ? true : false; if (domainObject.Address != null) { domainObject.Address = _addressService.SaveAfterSanitizing(domainObject.Address, true); } if (domainObject.MailingAddress != null) { domainObject.MailingAddress = _addressService.SaveAfterSanitizing(domainObject.MailingAddress, true); } var entity = _mapper.Map(domainObject); if (domainObject.Address != null && domainObject.MailingAddress == null) { entity.MailingAddressId = domainObject.Address.Id; } if (domainObject.Address == null && domainObject.MailingAddress != null) { entity.Pcpaddress = domainObject.MailingAddress.Id; } adapter.SaveEntity(entity, true); return(Get(domainObject.CustomerId)); } }
public EventCustomerPcpAppointmentViewModel GetEventCustomerPcpAppointmentViewModel(Event eventData, Customer customer, CorporateAccount account, PrimaryCarePhysician pcp, EventCustomer eventCustomer) { var pcpDispositions = _pcpDispositionRepository.GetByEventCustomerId(eventCustomer.Id); var pcpAppointment = GetPcpAppointment(eventCustomer, pcpDispositions); var logoUrl = string.Empty; if (account != null) { var org = _organizationRepository.GetOrganizationbyId(account.Id); var file = org.LogoImageId > 0 ? _fileRepository.GetById(org.LogoImageId) : null; if (file != null) { var location = _mediaRepository.GetOrganizationLogoImageFolderLocation(); logoUrl = location.Url + file.Path; } } return new EventCustomerPcpAppointmentViewModel { CustomerId = customer.CustomerId, CustomerName = customer.Name, AppointmentDateTime = pcpAppointment != null ? pcpAppointment.AppointmentOn : (DateTime?)null, Pcp = pcp, AccountLogoUrl = logoUrl, BookAfterNumberOfDays = account != null ? account.NumberOfDays : 0, EventDate = eventData.EventDate, }; }
private PrimaryCarePhysician UpdatePcpAddressesFromMaster(PhysicianMaster physicianMaster, PrimaryCarePhysician pcp) { var stateRepository = IoC.Resolve <IStateRepository>(); if (physicianMaster.PracticeAddress1.Trim().Length > 0 && physicianMaster.PracticeState.Trim().Length > 0 && physicianMaster.PracticeCity.Trim().Length > 0 && physicianMaster.PracticeZip.Trim().Length > 0) { var state = stateRepository.GetStatebyCode(physicianMaster.PracticeState) ?? stateRepository.GetState(physicianMaster.PracticeState); long addressId = 0; if (pcp.Address != null) { addressId = pcp.Address.Id; } pcp.Address = SetPCPAddressFromPhysicianMaster(addressId, physicianMaster.PracticeAddress1, physicianMaster.PracticeAddress2, physicianMaster.PracticeCity, state.Id, state.CountryId, physicianMaster.PracticeZip); } else { pcp.Address = null; } if (!isPhysicianMasterMailinAddressSame(physicianMaster) && physicianMaster.MailingAddress1.Trim().Length > 0 && physicianMaster.MailingState.Trim().Length > 0 && physicianMaster.MailingCity.Trim().Length > 0 && physicianMaster.MailingZip.Trim().Length > 0) { var state = stateRepository.GetStatebyCode(physicianMaster.MailingState) ?? stateRepository.GetState(physicianMaster.MailingState); long addressId = 0; if (pcp.MailingAddress != null && (pcp.Address != null && pcp.MailingAddress.Id != pcp.Address.Id)) { addressId = pcp.MailingAddress.Id; } pcp.MailingAddress = SetPCPAddressFromPhysicianMaster(addressId, physicianMaster.MailingAddress1, physicianMaster.MailingAddress2, physicianMaster.MailingCity, state.Id, state.CountryId, physicianMaster.MailingZip); } else { pcp.MailingAddress = null; } return(pcp); }
public CustomerEventCriticalTestDataViewModel Create(CustomerCriticalData criticalData, Customer customer, PrimaryCarePhysician pcp, IEnumerable <OrderedPair <long, string> > idNamePairs, string testName) { var model = new CustomerEventCriticalTestDataViewModel { DateOfSubmission = criticalData.DateofSubmission, CustomerName = customer.NameAsString, ContactNumber = criticalData.ContactNumber, PrimaryCarePhysician = pcp != null?pcp.Name.ToString() : "", TestName = testName, TechnicianNotes = criticalData.TechnicianNotes, TechnicianNotesForPhysician = criticalData.TechnicianNotesforPhysician, TechnicianName = idNamePairs.Where(inp => inp.FirstValue == criticalData.TechnicianId).Select(inp => inp.SecondValue).SingleOrDefault(), ValidatingTechnicianName = idNamePairs.Where(inp => inp.FirstValue == criticalData.ValidatingTechnicianId).Select(inp => inp.SecondValue).SingleOrDefault(), PrimaryPhysicianName = criticalData.Physician, HasPcp = (pcp != null && !string.IsNullOrEmpty(pcp.Name.ToString())) ? true : criticalData.HasPcp, IsDefaultFollowup = criticalData.IsDefaultFollowup, IsPatientReceivedImages = criticalData.IsPatientReceivedImages, Symptoms = criticalData.Symptoms }; return(model); }
public CustomerEventCriticalTestDataEditModel Create(long eventId, long testId, Customer customer, CustomerCriticalData criticalData, EventCustomer eventCustomer, IEnumerable <OrderedPair <long, string> > physicians, PrimaryCarePhysician pcp, EventCustomerResult eventCustomerResult) { var model = new CustomerEventCriticalTestDataEditModel { CustomerName = customer.NameAsString, ContactNumber = (customer.HomePhoneNumber ?? customer.OfficePhoneNumber) ?? customer.MobilePhoneNumber, EventId = eventId, TestId = testId, CustomerId = customer.CustomerId, DateOfBirth = customer.DateOfBirth, EventCustomerId = eventCustomer.Id, Gender = customer.Gender, DateOfSubmission = DateTime.Now, PrimaryPhysician = physicians != null && physicians.Any() ? physicians.ElementAt(0).SecondValue : "", PrimaryCarePhysicianName = pcp != null?pcp.Name.ToString() : "", PrimaryCarePhysicianPhoneNumber = pcp != null ? pcp.Primary : null, ResultState = eventCustomerResult != null ? eventCustomerResult.ResultState : 1 }; if (criticalData != null) { model.CustomerEventScreeningTestId = criticalData.Id; model.DateOfSubmission = criticalData.DateofSubmission; model.IsCustomerSigned = criticalData.IsCustomerSigned; model.IsTechnicianSigned = criticalData.IsTechnicianSigned; model.TechnicianNotes = criticalData.TechnicianNotes; model.TechnicianNotesForPhysician = criticalData.TechnicianNotesforPhysician; model.ContactNumber = criticalData.ContactNumber ?? model.ContactNumber; model.TechnicianId = criticalData.TechnicianId; model.ValidatingTechnicianId = criticalData.ValidatingTechnicianId; model.PrimaryPhysician = criticalData.Physician; model.HasPcp = !string.IsNullOrEmpty(model.PrimaryCarePhysicianName) ? true : criticalData.HasPcp; model.IsDefaultFollowup = criticalData.IsDefaultFollowup; model.IsPatientReceivedImages = criticalData.IsPatientReceivedImages; model.Symptoms = criticalData.Symptoms; } else { model.HasPcp = !string.IsNullOrEmpty(model.PrimaryCarePhysicianName) ? true : false; model.IsDefaultFollowup = true; } return(model); }
public PatientInputFileViewModel Create(Customer customer, Event eventData, string serialKey, PrimaryCarePhysician primaryCarePhysician) { var model = new PatientInputFileViewModel { PatientCid = customer.InsuranceId, OrdDate = eventData.EventDate, //LocationName = eventData.Name, FirstName = customer.Name.FirstName, MiddleName = string.IsNullOrEmpty(customer.Name.MiddleName) ? string.Empty : customer.Name.MiddleName.Substring(0, 1), LastName = customer.Name.LastName, Address = customer.Address, PhoneHome = customer.HomePhoneNumber != null?customer.HomePhoneNumber.ToString() : string.Empty, //EmailHome = customer.Email != null ? customer.Email.ToString() : string.Empty, Gender = customer.Gender == Gender.Male ? "M" : customer.Gender == Gender.Female ? "F" : string.Empty, DateOfBirth = customer.DateOfBirth, LanguageSpoken = string.Empty, BoxCode = serialKey, TestModel = "FIT", Custom1 = "Healthfair", Custom2 = customer.CustomerId.ToString() }; if (primaryCarePhysician != null) { model.PcpName = primaryCarePhysician.Name.ToString(); model.PcpPhone = primaryCarePhysician.Primary != null?primaryCarePhysician.Primary.ToString() : string.Empty; model.PcpFax = primaryCarePhysician.Fax != null?primaryCarePhysician.Fax.ToString() : string.Empty; model.PcpAddress = primaryCarePhysician.Address; } return(model); }
private void UpdateCustomerPrimaryCarePhysician(CorporateCustomerEditModel model, OrganizationRoleUser createdByOrgRoleUser, Customer customer, IEnumerable <EventCustomer> eventCustomers) { if (!string.IsNullOrEmpty(model.PcpFirstName) || !string.IsNullOrEmpty(model.PcpLastName)) { var pcp = _primaryCarePhysicianRepository.Get(customer.CustomerId); var ispcpUpdated = pcp != null && IsPcpUpdated(pcp, model); pcp = ispcpUpdated ? null : pcp; if (pcp == null) { pcp = new PrimaryCarePhysician { CustomerId = customer.CustomerId, DataRecorderMetaData = new DataRecorderMetaData(createdByOrgRoleUser.Id, DateTime.Now, null) }; } else { pcp.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(createdByOrgRoleUser.Id); pcp.DataRecorderMetaData.DateModified = DateTime.Now; } pcp.IsPcpAddressVerified = null; pcp.PcpAddressVerifiedBy = null; pcp.PcpAddressVerifiedOn = null; pcp.Source = (long)CustomerPcpUpdateSource.CorporateUpload; pcp.Name = new Name(model.PcpFirstName, "", model.PcpLastName); pcp.Fax = PhoneNumber.Create(PhoneNumber.ToNumber(model.PcpFax), PhoneNumberType.Unknown); pcp.Primary = PhoneNumber.Create(PhoneNumber.ToNumber(model.PcpPhone), PhoneNumberType.Office); if (!string.IsNullOrEmpty(model.PcpEmail)) { pcp.Email = new Email(model.PcpEmail); } pcp.Npi = model.PcpNpi; pcp.PhysicianMasterId = null; SetPcpPracticeAddress(pcp, model); SetPcpMailingAddress(pcp, model); if (IsPcpAddressSame(pcp)) { pcp.MailingAddress = null; } pcp.IsActive = true; pcp = _primaryCarePhysicianRepository.Save(pcp); if (pcp != null) { model.CustomerAddressId = customer.Address != null ? customer.Address.Id : 0; model.PCPAddressId = pcp.Address != null ? pcp.Address.Id : 0; model.PCPMailingAddressId = pcp.MailingAddress != null ? pcp.MailingAddress.Id : 0; } if (ispcpUpdated) { foreach (var eventCustomer in eventCustomers) { _eventCustomerPrimaryCarePhysicianRepository.Save(new EventCustomerPrimaryCarePhysician { EventCustomerId = eventCustomer.Id, IsPcpAddressVerified = false, PcpAddressVerifiedBy = createdByOrgRoleUser.Id, PcpAddressVerifiedOn = DateTime.Now, PrimaryCarePhysicianId = pcp.Id }); } } } }
public ModifyPatientResp CreatePatient(Customer customer, Eligibility eligibility, IEnumerable <InsuranceCompany> insuranceCompanies, 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 newPatient = new PatientCreate { FirstName = customer.Name.FirstName, MiddleName = customer.Name.MiddleName, LastName = customer.Name.MiddleName, 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 }; // Create the case details for the patient var patientCase = new PatientCaseCreateReq { CaseName = CaseName, //patientCase.PayerScenario Active = true, SendPatientStatements = true }; var eligibleResponse = JsonConvert.DeserializeObject <EligibleResponse>(eligibility.Response); InsuranceCompany insuranceCompany = null; if (eligibleResponse.PrimaryInsurance != null) { insuranceCompany = insuranceCompanies.FirstOrDefault(ic => ic.Code == eligibleResponse.PrimaryInsurance.Id); } else if (eligibleResponse.Insurance != null) { insuranceCompany = insuranceCompanies.FirstOrDefault(ic => ic.Code == eligibleResponse.Insurance.Id); } if (insuranceCompany == null) { insuranceCompany = insuranceCompanies.First(ic => ic.Id == eligibility.InsuranceCompanyId); } // Create the insurance policies for the patient case var primaryPolicy = new InsurancePolicyCreateReq { CompanyName = insuranceCompany.Name, PlanName = eligibleResponse.Plan.PlanName, PolicyNumber = eligibleResponse.Demographics.Subscriber.MemberId, PolicyGroupNumber = eligibleResponse.Demographics.Subscriber.GroupId, Copay = eligibility.CoPayment.ToString("0.00") }; //primaryPolicy.PlanID = eligibleResponse.Plan.PlanNumber; patientCase.Policies = new InsurancePolicyCreateReq[] { primaryPolicy }; newPatient.Practice = practice; newPatient.Cases = new PatientCaseCreateReq[] { patientCase }; if (pcp != null) { newPatient.PrimaryCarePhysician = new PhysicianIdentifierReq { FullName = pcp.Name.FullName }; } // Create the create patient request object var request = new CreatePatientReq { RequestHeader = requestHeader, Patient = newPatient }; // Call the Create Patient method var response = client.CreatePatient(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); } }
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); } }
public MammoConsentEditModel() { Pcp = new PrimaryCarePhysician(); }
public ClinicalDocument Create(EventCustomerResult eventCustomerResult, Customer customer, PrimaryCarePhysician pcp, Event theEventData) { var patientIds = GetClinicalRoots(null, customer.CustomerId.ToString(), ClinicalDocumentRoots.PatinetMedicalRecordNumber); if (!string.IsNullOrWhiteSpace(customer.Hicn)) { patientIds = GetClinicalRoots(patientIds, customer.Hicn.Trim(), ClinicalDocumentRoots.PatientAdditionalIds); } if (!string.IsNullOrWhiteSpace(customer.InsuranceId)) { patientIds = GetClinicalRoots(patientIds, customer.InsuranceId.Trim(), ClinicalDocumentRoots.PatientAdditionalIds); } var telecom = new List <ClinicalTeleCom>(); if (customer.HomePhoneNumber != null && !customer.HomePhoneNumber.IsEmpty()) { telecom.Add(new ClinicalTeleCom(TelecomType.PrimaryHome, customer.HomePhoneNumber.GlobalPhoneNumberFormat)); } if (customer.MobilePhoneNumber != null && !customer.MobilePhoneNumber.IsEmpty()) { telecom.Add(new ClinicalTeleCom(TelecomType.MobileContact, customer.MobilePhoneNumber.GlobalPhoneNumberFormat)); } if (customer.OfficePhoneNumber != null && !customer.OfficePhoneNumber.IsEmpty()) { telecom.Add(new ClinicalTeleCom(TelecomType.Workplace, customer.OfficePhoneNumber.GlobalPhoneNumberFormat)); } var orderId = _orderRepository.GetOrderIdByEventIdCustomerId(theEventData.Id, customer.CustomerId); var package = _eventPackageRepository.GetPackageForOrder(orderId); var eventTests = _eventTestRepository.GetTestsForOrder(orderId); if (package != null) { eventTests = eventTests.Concat(package.Tests.ToArray()); } var tests = eventTests.Select(et => et.Test).ToArray(); var structureBodySection = new List <StructuredBodyComponent>() { new StructuredBodyComponent() { Section = _ccdVitalSectionFactory.GetVitalSection(customer, theEventData, tests, _settings) }, GetResultSection(customer, theEventData, tests), }; return(new ClinicalDocument { Realm = new RealmCode("US"), Title = "Summary of Patient Chart", EffectiveTime = new DocumentGenerationtime(DateTime.Now), // LanguageCode = new LanguageCode("en-US"), RecordTarget = new RecordTarget { PatientRole = new PatientRole { PatientIds = patientIds, PatinetAddress = GetClinicalAddress(customer.BillingAddress, AddressType.HomeAddress), Patient = GetPatient(customer), TeleCom = telecom.IsNullOrEmpty() ? null : telecom.ToArray(), ProviderOrganization = GetProviderOrganization() } }, DocumentationOfCcd = GetDocumentationOf(pcp, theEventData), CdaBodyComponent = new CdaBodyComponent() { StructuredBody = new StructuredBody { VitalSigns = structureBodySection.ToArray() } } }); }
private static PcpAppointmentViewModel GetPcpAppointmentViewModel(long customerId, Customer customer, string customTags, string eligibilityStatus, EventVolumeModel eventModel, PrimaryCarePhysician pcp) { var pcpAppointmentViewModel = new PcpAppointmentViewModel { CustomerId = customerId, CustomerName = customer.NameAsString, InsuranceId = string.IsNullOrEmpty(customer.InsuranceId) ? "N/A" : customer.InsuranceId, Hicn = string.IsNullOrEmpty(customer.Hicn) ? "N/A" : customer.Hicn, Mbi = string.IsNullOrEmpty(customer.Mbi) ? "N/A" : customer.Mbi, Tag = string.IsNullOrEmpty(customer.Tag) ? "N/A" : customer.Tag, CustomerTag = customTags, IsEligible = eligibilityStatus, EventId = eventModel.EventCode, EventName = eventModel.Location, EventDate = eventModel.EventDate, Pod = eventModel.Pod, PcpName = pcp != null ? pcp.Name.FullName : "N/A", PcpPhoneNumber = pcp != null && pcp.Primary != null && !string.IsNullOrEmpty(pcp.Primary.ToString()) ? pcp.Primary.ToString() : "N/A", PcpFax = pcp != null && pcp.Fax != null && !string.IsNullOrEmpty(pcp.Fax.ToString()) ? pcp.Fax.ToString() : "N/A", }; return(pcpAppointmentViewModel); }
public AwvPcpConsentViewModel GetAwvPcpConsentViewModel(Customer customer, Event eventData, PrimaryCarePhysician pcp, string signatureUrl, DateTime?signedDate = null) { var model = new AwvPcpConsentViewModel { CustomerId = customer.CustomerId, CustomerName = customer.Name, PhoneNumber = customer.HomePhoneNumber, DateOfBirth = customer.DateOfBirth, SignatureImageUrl = signatureUrl, ConsentSignedDate = signedDate.HasValue ? signedDate.Value.ToString("MM/dd/yyyy") : string.Empty }; if (pcp != null) { model.Pcp = pcp; } model.ScreeningDate = eventData.EventDate; return(model); }
public void SavePrimaryCarePhysician(PrimaryCarePhysicianEditModel pcpEditModel, long customerId, long orgRoleUserId = 0) { var pcp = _primaryCarePhysicianRepository.Get(customerId); if (pcp == null && pcpEditModel == null) { return; } if (pcp != null && pcpEditModel == null) { _primaryCarePhysicianRepository.DecativatePhysician(customerId, orgRoleUserId > 0 ? orgRoleUserId : customerId); } else { if (pcp == null) { pcp = new PrimaryCarePhysician { Name = pcpEditModel.FullName, Primary = !string.IsNullOrEmpty(pcpEditModel.Phone) ? PhoneNumber.Create(pcpEditModel.Phone, PhoneNumberType.Unknown) : pcpEditModel.PhoneNumber, Email = string.IsNullOrEmpty(pcpEditModel.Email) ? new Email(string.Empty, string.Empty) : new Email(pcpEditModel.Email), CustomerId = customerId, DataRecorderMetaData = new DataRecorderMetaData(orgRoleUserId > 0 ? orgRoleUserId : customerId, DateTime.Now, null) }; } else { pcp.Name = pcpEditModel.FullName; pcp.Primary = !string.IsNullOrEmpty(pcpEditModel.Phone) ? PhoneNumber.Create(pcpEditModel.Phone, PhoneNumberType.Unknown) : pcpEditModel.PhoneNumber; pcp.Email = string.IsNullOrEmpty(pcpEditModel.Email) ? new Email(string.Empty, string.Empty) : new Email(pcpEditModel.Email); pcp.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(orgRoleUserId > 0 ? orgRoleUserId : customerId); pcp.DataRecorderMetaData.DateModified = DateTime.Now; } if (pcpEditModel.Address != null && !pcpEditModel.Address.IsEmpty()) { long addressId = 0; if (pcp.Address != null) { addressId = pcp.Address.Id; } pcp.Address = Mapper.Map <AddressEditModel, Address>(pcpEditModel.Address); pcp.Address.Id = addressId; } else { pcp.Address = null; } if (pcpEditModel.MailingAddress != null && !pcpEditModel.MailingAddress.IsEmpty() && !IsAddressSame(pcpEditModel)) { long addressId = 0; if (pcp.MailingAddress != null && pcp.Address != null && pcp.MailingAddress.Id != pcp.Address.Id) { addressId = pcp.MailingAddress.Id; } pcp.MailingAddress = Mapper.Map <AddressEditModel, Address>(pcpEditModel.MailingAddress); pcp.MailingAddress.Id = addressId; } else { pcp.MailingAddress = null; } _primaryCarePhysicianRepository.Save(pcp); } }
public PotentialPcpChangeReportViewModel CreateModel(PrimaryCarePhysician oldPcpDetails, PrimaryCarePhysician newPcpDetails, Customer customerInfo) { var model = new PotentialPcpChangeReportViewModel { Market = string.IsNullOrEmpty(customerInfo.Market) ? EmptyString : customerInfo.Market, MemberId = string.IsNullOrEmpty(customerInfo.InsuranceId) ? EmptyString : customerInfo.InsuranceId, Gmpi = customerInfo.AdditionalField3, FirstName = customerInfo.Name.FirstName, LastName = customerInfo.Name.LastName }; if (oldPcpDetails == null) { model.ExistingPcpFullName = EmptyString; model.ExistingPcpAddress1 = EmptyString; model.ExistingPcpAddress2 = EmptyString; model.ExistingPcpCity = EmptyString; model.ExistingPcpState = EmptyString; model.ExistingPcpZip = EmptyString; } else { model.ExistingPcpFullName = oldPcpDetails.Name == null ? EmptyString : oldPcpDetails.Name.FullName; if (oldPcpDetails.Address == null) { model.ExistingPcpAddress1 = EmptyString; model.ExistingPcpAddress2 = EmptyString; model.ExistingPcpCity = EmptyString; model.ExistingPcpState = EmptyString; model.ExistingPcpZip = EmptyString; } else { model.ExistingPcpAddress1 = oldPcpDetails.Address.StreetAddressLine1; model.ExistingPcpAddress2 = oldPcpDetails.Address.StreetAddressLine2; model.ExistingPcpCity = oldPcpDetails.Address.City; model.ExistingPcpState = oldPcpDetails.Address.State; model.ExistingPcpZip = oldPcpDetails.Address.ZipCode.ToString(); } } if (newPcpDetails == null) { model.NewPcpFullName = EmptyString; model.NewPcpAddress1 = EmptyString; model.NewPcpAddress2 = EmptyString; model.NewPcpCity = EmptyString; model.NewPcpState = EmptyString; model.NewPcpZip = EmptyString; } else { model.NewPcpFullName = newPcpDetails.Name == null ? EmptyString : newPcpDetails.Name.FullName; if (newPcpDetails.Address == null) { model.NewPcpAddress1 = EmptyString; model.NewPcpAddress2 = EmptyString; model.NewPcpCity = EmptyString; model.NewPcpState = EmptyString; model.NewPcpZip = EmptyString; } else { model.NewPcpAddress1 = newPcpDetails.Address.StreetAddressLine1; model.NewPcpAddress2 = newPcpDetails.Address.StreetAddressLine2; model.NewPcpCity = newPcpDetails.Address.City; model.NewPcpState = newPcpDetails.Address.State; model.NewPcpZip = newPcpDetails.Address.ZipCode.ToString(); } } model.HfComment = EmptyString; return(model); }
private bool SavePcpDetails() { if (rbtnYes.Checked) { try { var countryRepository = IoC.Resolve <ICountryRepository>(); var countryId = countryRepository.GetAll().First().Id; var primaryCarePhysicianRepository = IoC.Resolve <IPrimaryCarePhysicianRepository>(); PrimaryCarePhysician pcp = null; if (!chkPCPChange.Checked) { pcp = primaryCarePhysicianRepository.Get(CustomerId); } var currentOrganizationRole = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole; var physicianMasterRepository = IoC.Resolve <IPhysicianMasterRepository>(); var newPcp = false; if (Convert.ToInt64(PhysicianMasterIdHiddenField.Value) > 0) { var physicianMaster = physicianMasterRepository.GetById(Convert.ToInt64(PhysicianMasterIdHiddenField.Value)); if (pcp == null) { pcp = new PrimaryCarePhysician { Name = new Name(physicianMaster.FirstName, physicianMaster.MiddleName, physicianMaster.LastName), Primary = physicianMaster.PracticePhone, Fax = physicianMaster.PracticeFax, PrefixText = physicianMaster.PrefixText, SuffixText = physicianMaster.SuffixText, CredentialText = physicianMaster.CredentialText, Npi = physicianMaster.Npi, PhysicianMasterId = physicianMaster.Id, CustomerId = CustomerId, DataRecorderMetaData = new DataRecorderMetaData(currentOrganizationRole.OrganizationRoleUserId, DateTime.Now, null), IsActive = true }; } else { pcp.Name = new Name(physicianMaster.FirstName, physicianMaster.MiddleName, physicianMaster.LastName); pcp.Primary = physicianMaster.PracticePhone; pcp.Fax = physicianMaster.PracticeFax; pcp.PrefixText = physicianMaster.PrefixText; pcp.SuffixText = physicianMaster.SuffixText; pcp.CredentialText = physicianMaster.CredentialText; pcp.Npi = physicianMaster.Npi; pcp.PhysicianMasterId = physicianMaster.Id; pcp.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(currentOrganizationRole.OrganizationRoleUserId); pcp.DataRecorderMetaData.DateModified = DateTime.Now; pcp.IsActive = true; } pcp = UpdatePcpAddressesFromMaster(physicianMaster, pcp); } else { if (pcp == null) { newPcp = true; pcp = new PrimaryCarePhysician { Name = new Name(UCPCPInfo1.FirstName, UCPCPInfo1.MiddleName, UCPCPInfo1.LastName), Primary = string.IsNullOrEmpty(UCPCPInfo1.Phone) ? null : PhoneNumber.Create(UCPCPInfo1.Phone, PhoneNumberType.Home), Secondary = string.IsNullOrEmpty(UCPCPInfo1.AlternatePhone) ? null : PhoneNumber.Create(UCPCPInfo1.AlternatePhone, PhoneNumberType.Office), Fax = string.IsNullOrEmpty(UCPCPInfo1.Fax) ? null : PhoneNumber.Create(UCPCPInfo1.Fax, PhoneNumberType.Unknown), Email = string.IsNullOrEmpty(UCPCPInfo1.Email) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.Email), SecondaryEmail = string.IsNullOrEmpty(UCPCPInfo1.AlternateEmail) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.AlternateEmail), Website = UCPCPInfo1.WebsiteUrl, CustomerId = CustomerId, DataRecorderMetaData = new DataRecorderMetaData(currentOrganizationRole.OrganizationRoleUserId, DateTime.Now, null), IsActive = true, }; } else { pcp.Name = new Name(UCPCPInfo1.FirstName, UCPCPInfo1.MiddleName, UCPCPInfo1.LastName); pcp.Primary = string.IsNullOrEmpty(UCPCPInfo1.Phone) ? null : PhoneNumber.Create(UCPCPInfo1.Phone, PhoneNumberType.Home); pcp.Secondary = string.IsNullOrEmpty(UCPCPInfo1.AlternatePhone) ? null : PhoneNumber.Create(UCPCPInfo1.AlternatePhone, PhoneNumberType.Office); pcp.Fax = string.IsNullOrEmpty(UCPCPInfo1.Fax) ? null : PhoneNumber.Create(UCPCPInfo1.Fax, PhoneNumberType.Unknown); pcp.Email = string.IsNullOrEmpty(UCPCPInfo1.Email) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.Email); pcp.SecondaryEmail = string.IsNullOrEmpty(UCPCPInfo1.AlternateEmail) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.AlternateEmail); pcp.Website = UCPCPInfo1.WebsiteUrl; pcp.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(currentOrganizationRole.OrganizationRoleUserId); pcp.DataRecorderMetaData.DateModified = DateTime.Now; pcp.IsActive = true; } if (UCPCPInfo1.Address1.Trim().Length > 0 && UCPCPInfo1.State != "0" && UCPCPInfo1.City.Trim().Length > 0 && UCPCPInfo1.Zip.Trim().Length > 0) { long addressId = 0; if (pcp.Address != null) { addressId = pcp.Address.Id; } pcp.Address = new Address(addressId) { StreetAddressLine1 = UCPCPInfo1.Address1, StreetAddressLine2 = UCPCPInfo1.Address2, City = UCPCPInfo1.City, StateId = Convert.ToInt64(UCPCPInfo1.State), ZipCode = new ZipCode(UCPCPInfo1.Zip), CountryId = countryId }; } else { pcp.Address = null; } SetPcpMaillingAddress(pcp, countryId); } var isPcpAddressVerified = false; if (Convert.ToInt64(PhysicianMasterIdHiddenField.Value) > 0) { isPcpAddressVerified = chkVerifiedPcpInfo.Checked; } else { isPcpAddressVerified = UCPCPInfo1.IsPcpAddressVerified; } pcp.IsPcpAddressVerified = isPcpAddressVerified; pcp.PcpAddressVerifiedBy = currentOrganizationRole.OrganizationRoleUserId; pcp.PcpAddressVerifiedOn = DateTime.Now; pcp = primaryCarePhysicianRepository.Save(pcp); var currentActivePcp = primaryCarePhysicianRepository.Get(CustomerId); var eventCustomerRepository = IoC.Resolve <IEventCustomerRepository>(); if (EventId > 0) { var eventCustomer = eventCustomerRepository.GetRegisteredEventForUser(CustomerId, EventId); if (eventCustomer != null && currentActivePcp != null) { var eventCustomerPrimaryCarePhysicianRepository = IoC.Resolve <IEventCustomerPrimaryCarePhysicianRepository>(); var eventCustomerPrimarycarePhysician = new EventCustomerPrimaryCarePhysician { EventCustomerId = eventCustomer.Id, PrimaryCarePhysicianId = currentActivePcp.Id, IsPcpAddressVerified = isPcpAddressVerified, PcpAddressVerifiedOn = DateTime.Now, PcpAddressVerifiedBy = currentOrganizationRole.OrganizationRoleUserId }; eventCustomerPrimaryCarePhysicianRepository.Save(eventCustomerPrimarycarePhysician); } } if (newPcp && pcp.PhysicianMasterId == null) { var physicianMaster = new PhysicianMaster() { LastName = pcp.Name.LastName, FirstName = pcp.Name.FirstName, MiddleName = pcp.Name.MiddleName, PracticePhone = pcp.Primary, PracticeFax = pcp.Fax, IsImported = false, IsActive = true, DateCreated = DateTime.Now, Npi = "" }; if (pcp.Address != null) { physicianMaster.PracticeAddress1 = pcp.Address.StreetAddressLine1; physicianMaster.PracticeAddress2 = pcp.Address.StreetAddressLine2; physicianMaster.PracticeCity = pcp.Address.City; physicianMaster.PracticeState = pcp.Address.StateCode; physicianMaster.PracticeZip = pcp.Address.ZipCode.Zip; } if (pcp.MailingAddress != null) { physicianMaster.MailingAddress1 = pcp.MailingAddress.StreetAddressLine1; physicianMaster.MailingAddress2 = pcp.MailingAddress.StreetAddressLine2; physicianMaster.MailingCity = pcp.MailingAddress.City; physicianMaster.MailingState = pcp.MailingAddress.StateCode; physicianMaster.MailingZip = pcp.MailingAddress.ZipCode.Zip; } if (pcp.Address != null && pcp.MailingAddress == null) { physicianMaster.MailingAddress1 = pcp.Address.StreetAddressLine1; physicianMaster.MailingAddress2 = pcp.Address.StreetAddressLine2; physicianMaster.MailingCity = pcp.Address.City; physicianMaster.MailingState = pcp.Address.StateCode; physicianMaster.MailingZip = pcp.Address.ZipCode.Zip; } physicianMaster = physicianMasterRepository.Save(physicianMaster); pcp.PhysicianMasterId = physicianMaster.Id; primaryCarePhysicianRepository.Save(pcp); } } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(typeof(string), "jscodecityvalidate", "alert('" + ex.Message + "');", true); return(false); } } if (Request.QueryString["Call"] != null && Request.QueryString["Call"] == "No") { if (Request.QueryString["CustomerID"] != null) { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=no&CustomerID=" + Request.QueryString["CustomerID"] + "&Name=" + Request.QueryString["Name"] + "&Call=No&EventRegistered=Yes" + "&guid=" + GuId); } else { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=no&Call=No&EventRegistered=Yes" + "&guid=" + GuId); } } else { if (Request.QueryString["CustomerID"] != null) { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=yes &CustomerID=" + Request.QueryString["CustomerID"] + "&Name=" + Request.QueryString["Name"] + "&guid=" + GuId); } else { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=yes" + "&guid=" + GuId); } } return(true); }