class Patient(models.Model): patient_id = models.IntegerField(primary_key=True) first_name = models.CharField(max_length=30) middle_name = models.CharField(max_length=30, null=True) last_name = models.CharField(max_length=30) date_of_birth = models.DateField(null=True) gender = models.CharField(max_length=15, null=True) address = models.CharField(max_length=50, null=True) city = models.CharField(max_length=20, null=True) state = USStateField(max_length=2, null=True) zip_code = USZipCodeField(null=True) cell_phone = PhoneNumberField(null=True) email = models.CharField(max_length=40, null=True) emergency_contact_name = models.CharField(max_length=40, null=True) emergency_contact_phone = PhoneNumberField(null=True) emergency_contact_relation = models.CharField(max_length=20, null=True) ethnicity = models.CharField(max_length=20, null=True) preferred_language = models.CharField(max_length=20, null=True) race = models.CharField(max_length=20, null=True) social_security_number = USSocialSecurityNumberField(null=True) appointment_status = models.CharField(max_length=30, default="Not Arrived") scheduled_time = models.DateTimeField(null=True) duration = models.IntegerField(default=30) arrived_time = models.TimeField(null=True) seen_by_doc = models.TimeField(null=True) def __unicode__(self): return self.first_name
class Patient(models.Model): item_id = models.IntegerField(unique=True) first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) gender = models.CharField(max_length=255) doctor = models.IntegerField(null=True) date_of_birth = models.DateField(null=True) cell_phone = models.CharField(max_length=255, null=True) email = models.EmailField(null=True) state = models.CharField(max_length=255, null=True) ssn = USSocialSecurityNumberField(null=True) def save_from_dict(self, data): if not Patient.objects.filter(item_id=data.get('id')).exists(): self.item_id = data.get('id') self.first_name = data.get('first_name') self.last_name = data.get('last_name') self.gender = data.get('gender') self.doctor = data.get('doctor') self.date_of_birth = data.get('date_of_birth') self.cell_phone = data.get('cell_phone') self.email = data.get('email') self.ssn = data.get('social_security_number') self.state = data.get('state') self.save()
class Personal_Information(models.Model): first_name = models.CharField(max_length=128, default='') middle_name = models.CharField(max_length=128, default='', null=True, blank=True) last_name = models.CharField(max_length=128, default='') dob = models.DateField() sex = models.CharField(choices=GENDER_CHOICES, max_length=32, default='Blank') race = models.CharField(choices=RACE_CHOICES, max_length=64, default='Blank') ethnicity = models.CharField(choices=ETHNICITY_CHOICES, max_length=64, default='Blank') language = LanguageField(default='en') country = CountryField(blank_label='',default='US') ssn = USSocialSecurityNumberField(null=True, blank=True, help_text='XXX-XX-XXXX') address = models.CharField(max_length=128,default='') city = models.CharField(max_length=128,default='') state = USStateField(default='') zip = models.IntegerField(default='') home_phone = PhoneNumberField(help_text='XXX-XXX-XXXX') cell_phone = PhoneNumberField(null=True, blank=True, help_text='XXX-XXX-XXXX') email = models.EmailField(null=True, blank=True) call_pref = models.CharField(choices=CALL_PREF_CHOICES, max_length=10, default='Home') written_pref = models.CharField(choices=WRITTEN_PREF_CHOICES, max_length=12, default='Post') emp_status = models.CharField(choices=EMP_STATUS_CHOICES, max_length=64, default='Blank') #Account Information chart_no = models.AutoField(primary_key=True) date_registered = models.DateField(default=timezone.now) account_type = models.CharField(choices=ACCOUNT_TYPE_CHOICES, max_length=64, default='Blank') account_status = models.CharField(choices=ACCOUNT_STATUS_CHOICES, max_length=64, default='Current') sign = models.CharField(choices=SIGN_CHOICES, max_length=3, default='Yes') audit_log = AuditLog() def __unicode__(self): return self.first_name+' '+self.last_name
class USPlace(models.Model): state = USStateField(blank=True) state_req = USStateField() state_default = USStateField(default="CA", blank=True) postal_code = USPostalCodeField(blank=True) name = models.CharField(max_length=20) ssn = USSocialSecurityNumberField(blank=True)
class Patient(models.Model): """Defines a patient.""" opendental_patient_id = BigIntegerField(primary_key=True, default=0) user = ForeignKey(User, on_delete=models.CASCADE) ssn = USSocialSecurityNumberField(unique=True) first_name = CharField(max_length=100) last_name = CharField(max_length=100)
class HouseholdMember(models.Model): household = models.ForeignKey(Household) first_name = models.CharField(error_messages={'required': 'Please let us know what to call you!'}, max_length=100, verbose_name=_('First Name'), help_text=_('')) last_name = models.CharField(max_length=100, verbose_name=_('Last Name'), help_text=_('')) ssn = USSocialSecurityNumberField(verbose_name=_('Social Security Number'), help_text=_('')) mobile_phone = PhoneNumberField(max_length=100, blank=True, verbose_name=_('Mobile Phone'), help_text=_('')) # blank ok only if household home_phone is not blank birthdate = models.DateField(null=True, verbose_name=_('Birth Date'), help_text=_('')) # no later than 100 years ago gender = models.CharField(null=True, max_length=20, choices=GENDER, verbose_name=_('Gender'), help_text=_(''))
class Vendor(User): ''' Any individual who sells items through the Foundation, whether at events or through the online store. ''' SSN = USSocialSecurityNumberField(null=True) EIN = models.CharField(max_length=10, null=True) UTTaxID = models.CharField(max_length=10, null=True) sales_tax_return_form_given = models.BooleanField(default=False)
class Patient(models.Model): # These values are never edited locally; only in response to information from the server # We cache the minimum number of fields to provide useful info to the doctor. first_name = models.CharField(editable=False, max_length=255, null=True) last_name = models.CharField(editable=False, max_length=255, null=True) date_of_birth = models.DateField(editable=False, null=True) social_security_number = USSocialSecurityNumberField(editable=False, null=True) def __str__(self): return "{self.first_name} {self.last_name}".format(self=self)
class Patient(models.Model): '''Name and title''' TITLE_CHOICES = (('', '-----'), ('Mr.', 'Mr.'), ('Mrs.', 'Mrs.'), ('Ms.', 'Ms.'), ('Dr.', 'Dr.')) title = models.CharField(max_length=5, choices=TITLE_CHOICES) first = models.CharField(max_length=40) middle = models.CharField(max_length=1, blank=True) last = models.CharField(max_length=40) nickname = models.CharField(max_length=20, blank=True) cos_ptid = models.IntegerField() '''Location and address''' OFFICE_CHOICES = (('BV', 'BV'), ('WD', 'WD'), ('PA', 'PA')) location = models.CharField(max_length=5, choices=OFFICE_CHOICES) address = models.CharField(max_length=100) address2 = models.CharField(max_length=100, blank=True) city = models.CharField(max_length=40) state = USStateField() zip = USZipCodeField() '''Communication''' home_phone = models.CharField(max_length=25, blank=True) work_phone = models.CharField(max_length=25, blank=True) cell_phone = models.CharField(max_length=25, blank=True) email = models.EmailField() birthdate = models.DateField() SSN = USSocialSecurityNumberField() GENDER_CHOICES = (('M', 'Male'), ('F', 'Female'), ('O', 'Other')) gender = models.CharField(max_length=5, choices=GENDER_CHOICES) student = models.BooleanField() notes = models.CharField(max_length=500, blank=True) alert = models.CharField(max_length=100, blank=True) outside_doc = models.CharField(max_length=50) referred_to_doc = models.CharField(max_length=50) def get_absolute_url(self): return reverse('patients:view_patient', kwargs={'pk': self.pk}) def __str__(self): return self.first + ' ' + self.middle + ' ' + self.last @property def age(self): '''calculate the age of the person''' today = date.today() return today.year - self.birthdate.year - ( (today.month, today.day) < (self.birthdate.month, self.birthdate.day))
class HouseholdMember(models.Model): household = models.ForeignKey(Household) first_name = models.CharField( error_messages={'required': 'Please let us know what to call you!'}, max_length=100, verbose_name=_('First Name'), help_text=_('')) last_name = models.CharField(max_length=100, verbose_name=_('Last Name'), help_text=_('')) ssn = USSocialSecurityNumberField(verbose_name=_('Social Security Number'), help_text=_('')) mobile_phone = PhoneNumberField( max_length=100, blank=True, verbose_name=_('Mobile Phone'), help_text=_('')) #blank ok only if household home_phone is not blank
class UserProfile(models.Model): user = models.OneToOneField(User, on_delete = models.CASCADE, related_name="profile", unique=True) email = models.EmailField() first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) phone_number = PhoneNumberField(null=True) #Address address1 = models.CharField(max_length=100, null=True) address2 = models.CharField(max_length=100, blank=True, null=True) city = models.CharField(max_length=50, null=True) state = models.CharField(max_length=50, null=True) zip_code = USZipCodeField(null=True) #Confidential ssn = USSocialSecurityNumberField(null=True) def __unicode__(self): return str(self.email)
class Student(models.Model): # STEP 1 BASIC INFO student_id = models.CharField(max_length=128, unique=True) first_name = models.CharField(max_length=128) last_name = models.CharField(max_length=128) ssn = USSocialSecurityNumberField(null=False) gender = models.CharField(max_length=128, choices=GENDER_CHOICES) dob = models.DateField(auto_now=False, auto_now_add=False, db_column="date of birth") address = models.CharField(max_length=128) city = models.CharField(max_length=128) state = USStateField(choices=STATE_CHOICES, default='NJ') zipcode = USZipCodeField(blank=True) country = CountryField(default='US', blank=True) primary_phone = models.CharField(max_length=16) secondary_phone = models.CharField(max_length=16) email = models.EmailField(max_length=254, validators=[validate_email]) background = models.CharField(max_length=128, choices=BACKGROUND_CHOICES) location = models.CharField(max_length=128, choices=LOCATION_CHOICES, default='south_plainfield') workforce = models.CharField(max_length=128, choices=WORKFORCE_CHOICES, default='--') source = models.CharField(max_length=128, choices=SOURCE_CHOICES, default='individual') refer_by = models.CharField(max_length=128, choices=REFER_BY_CHOICES, default='no refer') last_status = models.CharField(max_length=128, choices=LAST_STATUS_CHOICES, default='followup') newsletter = models.BooleanField() created_by = models.CharField(max_length=128) date = models.DateField(auto_now=False, auto_now_add=False) notes = models.TextField() def __str__(self): return self.first_name + self.last_name
class ExternalUser(User): # suer_type user_type = models.CharField(max_length=10,choices=User_type) # SSN. social_security_number = USSocialSecurityNumberField() # First line address. address1 = models.CharField(max_length=128) # Second line address. address2 = models.CharField(max_length=64) # City. city = models.CharField(max_length=64) # State. state = USStateField() # Zip code. zip_code = USZipCodeField() # Username and password fields are already required by default. REQUIRED_FIELDS = ['email', 'first_name', 'last_name', 'social_security_number', 'address1', 'city', 'state', 'zip_code'] # Keep the username field the same. USERNAME_FIELD = 'username'
class Consumer(models.Model): ready_for_send_choices = (('yes', 'Yes'), ('no', 'No')) first_name = models.CharField(max_length=256, blank=True) last_name = models.CharField(max_length=256, blank=False) email = models.EmailField(max_length=256, blank=True, unique=True) alternative_email = models.EmailField(max_length=256, blank=True) primary_address = models.CharField(max_length=256, blank=True) primary_address_line_two = models.CharField(max_length=256, blank=True) primary_city = models.CharField(max_length=256, blank=True) primary_state = USStateField(null=True, blank=True) primary_zip = USZipCodeField(null=True, blank=True) primary_country = models.CharField(max_length=256, blank=True) alternative_address = models.CharField(max_length=256, blank=True) alternative_address_line_two = models.CharField(max_length=256, blank=True) alternative_city = models.CharField(max_length=256, blank=True) alternative_state = models.CharField(max_length=256, blank=True) alternative_zip = USZipCodeField(null=True, blank=True) alternative_country = models.CharField(max_length=256, blank=True) # ssn = models.CharField(max_length=9,blank=True) ssn = USSocialSecurityNumberField(null=True, blank=True) driver_license_number = models.CharField(max_length=10, blank=True) driver_license_state = models.CharField(max_length=2, blank=True) date_of_birth = models.DateField(null=True, blank=True) terms_of_service_signed = models.BooleanField(default=False) identity_verified = models.BooleanField(default=False, null=True) # last_signed_terms_of_service_date = models.DateField(null=True,blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) phone = models.CharField(max_length=13, blank=True) alternative_phone = models.CharField(max_length=13, blank=True) def __str__(self): return self.first_name + " " + self.last_name def get_absolute_url(self): return reverse('user_console:consumer_detail', kwargs={'pk': self.pk})
class Guarantor_Information(models.Model): patient = models.ForeignKey(Personal_Information) relation = models.CharField(choices=RELATION_CHOICES,max_length=128) #If relation is self, auto fill rest of the details first_name = models.CharField(max_length=128, default='') middle_name = models.CharField(max_length=128, default='', null=True, blank=True) last_name = models.CharField(max_length=128, default='') dob = models.DateField() sex = models.CharField(choices=GENDER_CHOICES, max_length=32, default='Blank') race = models.CharField(choices=RACE_CHOICES, max_length=64, default='Blank') ethnicity = models.CharField(choices=ETHNICITY_CHOICES, max_length=64, default='Blank') language = LanguageField(default='en') country = CountryField(blank_label='',default='US') ssn = USSocialSecurityNumberField(null=True, blank=True, help_text='XXX-XX-XXXX') address = models.CharField(max_length=128,default='') city = models.CharField(max_length=128,default='') state = USStateField(default='') zip = models.IntegerField(default='') home_phone = PhoneNumberField(help_text='XXX-XXX-XXXX') def __unicode__(self): return self.patient+' '+self.relation
class ClientSpouse(models.Model): # return_with = models.BooleanField("Is this a return with your Spouse ?") first_name = models.CharField("Spouse First Name", max_length=32, null=False) middle_name = models.CharField("Spouse Middle Name", max_length=32, null=False, blank=True, default='') last_name = models.CharField("Spouse Last Name", max_length=32, null=False) ssn = USSocialSecurityNumberField("Social Security Number on IRS Account", null=True, blank=True, default='') def title(self): mdl = "" if self.middle_name: mdl = " " + self.middle_name return "%s%s %s" % (self.first_name, mdl, self.last_name) def __str__(self): return "Spouse of client %s" % (self.page.form.client.title())
class ConsumerForm(forms.ModelForm): primary_state = USStateField() primary_zip = USZipCodeField() ssn = USSocialSecurityNumberField() class Meta: model = Consumer fields = [ 'first_name', 'last_name', 'email', 'alternative_email', 'primary_address', 'primary_address_line_two', 'primary_city', 'primary_state', 'primary_zip', 'primary_country' ] labels = { 'primary_address': 'Address', 'primary_address_line_two': 'Address 2', 'primary_city': 'City', 'primary_state': 'State', 'primary_zip': 'Zip', } widgets = { 'first_name': forms.TextInput(attrs={'placeholder': 'First Name'}) }
class Request(models.Model): request_source_choices = (('none', 'None'), ('email', 'Email'), ('phone', 'Phone'), ('web', 'Web')) priority_choices = (('low', 'Low'), ('medium', 'Medium'), ('high', 'High')) stage_choices = (('new', 'New'), ('in progress', 'In Progress'), ('ready to review', 'Ready for Review'), ('ready for consumer', 'Ready for Consumer'), ('completed', 'Completed'), ('past due', 'Past Due')) request_choices = (('yes', 'Yes please'), ('no', 'Not right now')) data_ready_to_send_choices = (('yes', 'Yes'), ('no', 'No')) status_choices = ( ('green', 'Green'), ('yellow', 'Yellow'), ('orange', 'Orange'), ('red', 'Red'), ) consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE, null=True, blank=True) company_requested = models.ForeignKey(Company, on_delete=models.CASCADE, null=True, blank=True) request_source = models.CharField(max_length=20, choices=request_source_choices, default='none', blank=True) website_source = models.URLField(max_length=200, blank=True) delete_request = models.CharField(max_length=5, choices=request_choices, default='no', blank=True) what_request = models.CharField(max_length=5, choices=request_choices, default='no', blank=True) who_request = models.CharField(max_length=5, choices=request_choices, default='no', blank=True) opt_out_request = models.CharField(max_length=5, choices=request_choices, default='no', blank=True) priority = models.CharField(max_length=10, choices=priority_choices, default='low') escalated = models.BooleanField(null=True) stage = models.CharField(max_length=20, choices=stage_choices, default='new', blank=True) created_at = models.DateField(auto_now_add=True) updated_at = models.DateField(auto_now=True) first_name = models.CharField(max_length=256, blank=False) last_name = models.CharField(max_length=256, blank=False) email = models.EmailField(max_length=256, blank=False) alternative_email = models.EmailField(max_length=256, blank=True) phone = models.CharField(max_length=13, blank=True) alternative_phone = models.CharField(max_length=13, blank=True) primary_address = models.CharField(max_length=256, blank=True) primary_address_line_two = models.CharField(max_length=256, blank=True) primary_city = models.CharField(max_length=256, blank=True) primary_state = USStateField(null=True, blank=True) primary_zip = USZipCodeField(null=True, blank=True) primary_country = models.CharField(max_length=256, blank=True) alternative_address = models.CharField(max_length=256, blank=True) alternative_address_line_two = models.CharField(max_length=256, blank=True) alternative_city = models.CharField(max_length=256, blank=True) alternative_state = models.CharField(max_length=256, blank=True) alternative_zip = models.CharField(max_length=256, blank=True) alternative_country = models.CharField(max_length=256, blank=True) ssn = USSocialSecurityNumberField(null=True, blank=True) driver_license_number = models.CharField(max_length=10, blank=True) driver_license_state = models.CharField(max_length=2, blank=True) date_of_birth = models.DateField(null=True, blank=True) terms_of_service_signed = models.BooleanField(default=False) data_ready_to_send = models.CharField(max_length=5, choices=data_ready_to_send_choices, default='no', blank=True) status = models.CharField(max_length=10, choices=status_choices, default='green', blank=True) days_open = models.IntegerField(default='1', blank=True, null=True) # date = models.DateField(default=date.today()) def __str__(self): return self.first_name + self.last_name + " (" + self.email + ")" def get_absolute_url(self): return reverse("user_console:request_detail", kwargs={'pk': self.pk}) def save(self, *args, **kwargs): if Consumer.objects.filter(email__iexact=self.email).exists(): self.consumer = Consumer.objects.get(email__iexact=self.email) else: consumer = Consumer(first_name=self.first_name, last_name=self.last_name, email=self.email) consumer.save() return super().save(*args, **kwargs)
class F9465Page1(models.Model): # Page 1, Section 1 form = models.OneToOneField('Form9465', related_name='page1') request_for_form = models.CharField( 'This request is for Form(s)', max_length=128, null=False, blank=True, help_text='for example, Form 1040 or Form 941', default='') request_for_years = models.CharField( 'What tax year(s) is this Installment Arrangement for', max_length=128, null=True, default=None, blank=True, help_text='For example, 2014 and 2015') first_name = models.CharField(max_length=32, null=False) middle_name = models.CharField(max_length=32, null=False, blank=True, default='') last_name = models.CharField(max_length=32, null=False) ssn = USSocialSecurityNumberField("Social Security Number on IRS Account", null=True, blank=True, default='') jointoffer = models.OneToOneField('ClientSpouse', related_name='page', null=True) street = models.CharField(max_length=128, null=False, blank=True, default='') apt = models.CharField(max_length=8, null=False, blank=True, default='') city = models.CharField(max_length=64, null=False, blank=True, default='') state_name = models.CharField('State', choices=STATES_EXTENDED, max_length=64, null=False, blank=True, default='') zipcode = models.CharField('Zip', max_length=10, null=False, blank=True, default='') county = models.ForeignKey(County, null=True, blank=True) country = models.CharField('Foreign Country', max_length=32, null=True, blank=True, default='') foreign_county = models.CharField('Foreign province/state/county', max_length=32, null=True, blank=True, default='') foreign_zip = models.CharField('Foreign postal code', max_length=8, null=True, blank=True, default='') address_new = models.BooleanField( 'Is this address new since you filed your last tax return?', default=False) def city_state_zip(self): return ', '.join(r.strip() for r in [self.city, self.state_name, self.zipcode] if r.strip())
class Person(models.Model): id = models.AutoField(primary_key=True) prefix = models.CharField(verbose_name=_('Prefix'), max_length=100, blank=False, null=False) first_name = models.CharField(verbose_name=_('First name'), max_length=100, blank=False, null=False) last_name = models.CharField(verbose_name=_('Last name'), max_length=100, blank=False, null=False) middle_name = models.CharField(verbose_name=_('Middle name'), max_length=100, blank=False, null=False) suffix = models.CharField(verbose_name=_('Suffix'), max_length=100, blank=False, null=False) social_security_number = USSocialSecurityNumberField(help_text=_('')) date_of_birth = models.DateField(help_text=_('')) gender = models.CharField(verbose_name=_('Gender'), max_length=100, choices=GENDER) race = models.CharField(verbose_name=_('Race'), max_length=100, blank=False, null=False) height = models.FloatField(help_text=_('')) weight = models.FloatField(help_text=_('')) hair = models.CharField(verbose_name=_('Hair'), max_length=100, blank=False, null=False) build = models.CharField(verbose_name=_('Build'), max_length=100, blank=False, null=False) eyes = models.CharField(verbose_name=_('Eyes'), max_length=100, blank=False, null=False) glasses = models.CharField(verbose_name=_('Glasses'), max_length=100, blank=False, null=False) record_owner = models.CharField(verbose_name=_('Record owner'), max_length=100, blank=False, null=False) record_creation_date = models.DateField(auto_now_add=True, help_text=_('')) person_type = models.CharField(verbose_name=_('Person type'), max_length=100, choices=PERSON_TYPE) company = models.ForeignKey(Company, blank=False, null=False, verbose_name=_('Company'), related_name='company_contacts') investigative_case = models.CharField(verbose_name=_('Investigative case'), max_length=100, blank=False, null=False) is_active = models.BooleanField(help_text=_('')) relationship = models.CharField(verbose_name=_('Relationship'), max_length=100, blank=False, null=False) class Meta: verbose_name = _('person') verbose_name_plural = _('person')
class F656Page1(models.Model): # Page 1, Section 1 form = models.OneToOneField('Form656', related_name='page1') first_name = models.CharField(max_length=32, null=False) middle_name = models.CharField(max_length=32, null=False, blank=True, default='') last_name = models.CharField(max_length=32, null=False) ssn = USSocialSecurityNumberField("Social Security Number on IRS Account", null=True, blank=True, default='') jointoffer = models.OneToOneField('ClientSpouse', related_name='page', null=True) ein = models.CharField("Employer Identification Number EIN", max_length=32, null=True, default='', blank=True, help_text="(For self-employed individuals only)") street = models.CharField(max_length=128, null=False, blank=True, default='') apt = models.CharField(max_length=8, null=False, blank=True, default='') city = models.CharField(max_length=64, null=False, blank=True, default='') state_name = models.CharField('State', choices=STATES_EXTENDED, max_length=64, null=False, blank=True, default='') zipcode = models.CharField('Zip', max_length=10, null=False, blank=True, default='') county = models.ForeignKey(County, null=True, blank=True) mailingaddr = models.OneToOneField('MailingAddress', related_name='page', null=True) businessinfo = models.OneToOneField('BusinessInformation', related_name='page', null=True) def __str__(self): return "Page 1 of the form 656 for %s" % (self.form.client.title()) def title(self): mdl = "" if self.middle_name: mdl = " " + self.middle_name return "%s%s %s" % (self.first_name, mdl, self.last_name) def address(self): """ (Street, City, State, ZIP code) (County of Residence). """ retval = make_address(apt=self.apt, street=self.street, city=self.city, state=self.state_name, zip=self.zipcode, county=self.county) return retval def get_mailing_address(self): if self.mailingaddr: return self.mailingaddr.address() return self.address() @property def married(self): return self.jointoffer is not None