from __future__ import unicode_literals

from django.db import models

# Create your models here.
# field types: NullBooleanField, CharField(null=True, max_length),
# IntegerField(null=True, default), DateTimeField

class Profile(models.Model):
    clientId = models.IntegerField(null=True)
    externalId = models.IntegerField(null=True)
    firstName = models.CharField(null=True, max_length=200)
    lastName = models.CharField(null=True, max_length=200)
    middleInitial = models.CharField(null=True, max_length=1)
    dateOfBirth = models.DateTimeField(null=True)
    address1 = models.CharField(null=True, max_length=200)
    address2 = models.CharField(null=True, max_length=200)
    city = models.CharField(null=True, max_length=200)
    stateAbbreviation = models.CharField(null=True, max_length=2)
    zipCode = models.IntegerField(null=True)
    billingLastName = models.CharField(null=True, max_length=200)
    billingFirstName = models.CharField(null=True, max_length=200)
    billingAddress1 = models.CharField(null=True, max_length=200)
    billingAddress2 = models.CharField(null=True, max_length=200)
    billingCity = models.CharField(null=True, max_length=200)
    billingStateAbbreviation = models.CharField(null=True, max_length=2)
    billingZipCode = models.IntegerField(null=True)
    geographicalArea = models.CharField(null=True, max_length=200)
    company = models.CharField(null=True, max_length=200)
    residenceType = models.CharField(null=True, max_length=200)
    status = models.CharField(null=True, max_length=200)
    statusDate = models.DateTimeField(null=True)
    homePhone = models.CharField(null=True, max_length=200)
    emergencyPhone = models.CharField(null=True, max_length=200)
    emergencyContact = models.CharField(null=True, max_length=200)
    ssn = models.CharField(null=True, max_length=200)
    maritalStatus = models.CharField(null=True, max_length=200)
    sex = models.CharField(null=True, max_length=200)
    isDeaf = models.NullBooleanField()
    employeeStatus = models.CharField(null=True, max_length=200)
    spouseName = models.CharField(null=True, max_length=200)
    referredBy = models.CharField(null=True, max_length=200)
    referredNPI = models.CharField(null=True, max_length=200)
    referredUPIN = models.CharField(null=True, max_length=200)
    referredSource = models.CharField(null=True, max_length=200)
    firstSVCDate = models.DateTimeField(null=True)
    firstBillSVCDate = models.DateTimeField(null=True)
    lastSVCDate = models.DateTimeField(null=True)
    lastBillSVCDate = models.DateTimeField(null=True)
    referralDate = models.DateTimeField(null=True)
    assessmentDate = models.DateTimeField(null=True)
    intakeDate = models.DateTimeField(null=True)
    admissionDate = models.DateTimeField(null=True)
    dischargeDate = models.DateTimeField(null=True)
    reportingUnit = models.CharField(null=True, max_length=200)
    assignedBenefits = models.CharField(null=True, max_length=200)
    releaseInformation = models.CharField(null=True, max_length=200)
    signatureSource = models.CharField(null=True, max_length=200)
    isGenderRequired = models.NullBooleanField()
    isHighNoShow = models.NullBooleanField()
    isDeleted = models.NullBooleanField()
    liability = models.CharField(null=True, max_length=200)
    doNotCall = models.NullBooleanField()
    severityLevel = models.CharField(null=True, max_length=200)
    isLegalGuardianSignatureRequired = models.NullBooleanField()
    claimNote = models.CharField(null=True, max_length=200)
    isFosterparent = models.NullBooleanField()
    fosterhomeId = models.IntegerField(null=True)
    cisClientId = models.IntegerField(null=True)
    email = models.CharField(null=True, max_length=200)
    doNotBillDirect = models.NullBooleanField()
    sureScriptsFileId = models.IntegerField(null=True)
    caseManagerEmpId = models.IntegerField(null=True)
    raceId = models.IntegerField(null=True)
    ethnicityId = models.IntegerField(null=True)
    raceDescription = models.CharField(null=True, max_length=200)
    ethnicityDescription = models.CharField(null=True, max_length=200)
    state = models.CharField(null=True, max_length=200)
    date = models.DateTimeField(null=True)

class Allergies(models.Model):
    profile = models.ForeignKey(Profile, on_delete=models.CASCADE, null=True)
    clientAllergyId = models.IntegerField(null=True)
    clientId = models.IntegerField(null=True)
    allergyName = models.CharField(null=True, max_length=200)
    additionalText = models.CharField(null=True, max_length=400)
    reaction = models.CharField(null=True, max_length=200)
    severity = models.CharField(null=True, max_length=200)
    createdByEmployeeId = models.IntegerField(null=True)
    updatedByEmployeeId = models.IntegerField(null=True)
    isDiscontinued = models.NullBooleanField()
    discontinuedReason = models.CharField(null=True, max_length=200)
    dateDiscontinued = models.CharField(null=True, max_length=200)
    discontinuedByEmployeeId = models.IntegerField(null=True)
    fdbConceptId = models.IntegerField(null=True)
    fdbConceptTypeId = models.IntegerField(null=True)
    isMedAllergy = models.NullBooleanField()
    source = models.CharField(null=True, max_length=200)
    rxNormId = models.IntegerField(null=True)
    isReconciledCDA = models.NullBooleanField()
    dateCreated = models.DateTimeField(null=True)
    dateUpdated = models.DateTimeField(null=True)
    state = models.CharField(null=True, max_length=200)
    date = models.DateTimeField(null=True)



class Contacts(models.Model):
    allergies = models.ForeignKey(Allergies, on_delete=models.CASCADE, null=True)
    clientContactId = models.IntegerField(null=True)
    clientId = models.IntegerField(null=True)
    contactTypeId = models.IntegerField(null=True)
    contactTypeName = models.CharField(null=True, max_length=200)
    name = models.CharField(null=True, max_length=200)
    address1 = models.CharField(null=True, max_length=200)
    city = models.CharField(null=True, max_length=200)
    stateAbbreviation = models.CharField(null=True, max_length=200)
    zipCode = models.CharField(null=True, max_length=200)
    phone = models.CharField(null=True, max_length=200)
    phoneAlternative = models.CharField(null=True, max_length=200)
    phoneMobile = models.CharField(null=True, max_length=200)
    email = models.CharField(null=True, max_length=200)
    relationship = models.CharField(null=True, max_length=200)
    externalId = models.IntegerField(null=True)
    clientVisitId = models.IntegerField(null=True)
    visitMapGroup = models.CharField(null=True, max_length=200)
    isAbleToReleaseInformation = models.NullBooleanField()
    dateReleasedInfoExpires = models.DateTimeField(null=True)
    updatedByEmployeeId = models.IntegerField(null=True)
    dateReleasedInfoStarts = models.DateTimeField(null=True)
    notes = models.CharField(null=True, max_length=200)
    address2 = models.CharField(null=True, max_length=200)
    agencyId = models.IntegerField(null=True)
    agencyName = models.CharField(null=True, max_length=200)
    source = models.CharField(null=True, max_length=200)
    dateCreated = models.DateTimeField(null=True)
    dateUpdated = models.DateTimeField(null=True)
    state = models.CharField(null=True, max_length=200)
    date = models.CharField(null=True, max_length=200)


class Medications(models.Model):
    Contacts = models.ForeignKey(Contacts, on_delete=models.CASCADE, null=True)
    medicationId = models.IntegerField(null=True)
    clientId = models.IntegerField(null=True)
    providerId = models.IntegerField(null=True)
    providerIdInt = models.IntegerField(null=True)
    fdbMedicationId = models.IntegerField(null=True)
    fdbMedicationIdGuess = models.IntegerField(null=True)
    medication = models.CharField(null=True, max_length=200)
    dosage = models.CharField(null=True, max_length=200)
    frequency = models.CharField(null=True, max_length=200)
    dateStarted = models.DateTimeField(null=True)
    dateChanged = models.DateTimeField(null=True)
    dateDiscontinued = models.DateTimeField(null=True)
    externalId = models.IntegerField(null=True)
    rationale = models.CharField(null=True, max_length=200)
    isCurrent = models.NullBooleanField()
    quantity = models.CharField(null=True, max_length=200)
    refills = models.IntegerField(null=True)
    pharmacy = models.CharField(null=True, max_length=200)
    instructions = models.CharField(null=True, max_length=200)
    clientVisitId = models.IntegerField(null=True)
    visitMapGroup = models.CharField(null=True, max_length=200)
    isPrescription = models.NullBooleanField()
    createdBy = models.IntegerField(null=True)
    updatedBy = models.IntegerField(null=True)
    isRx = models.NullBooleanField()
    rxSig = models.CharField(null=True, max_length=200)
    rxStatus = models.CharField(null=True, max_length=200)
    rxStatusText = models.CharField(null=True, max_length=200)
    dosageAction = models.CharField(null=True, max_length=200)
    dosageQuantity = models.CharField(null=True, max_length=200)
    route = models.CharField(null=True, max_length=200)
    routePer = models.CharField(null=True, max_length=200)
    routeTime = models.CharField(null=True, max_length=200)
    quantityUnit = models.CharField(null=True, max_length=200)
    dosageText = models.CharField(null=True, max_length=200)
    originalPrinted = models.NullBooleanField()
    originalSent = models.NullBooleanField()
    pharmacyNcpdPid = models.IntegerField(null=True)
    changeAction = models.CharField(null=True, max_length=200)
    daw = models.NullBooleanField()
    rrMessageId = models.IntegerField(null=True)
    sigActionNum = models.IntegerField(null=True)
    addtlComments = models.CharField(null=True, max_length=200)
    refillNotes = models.CharField(null=True, max_length=200)
    sigComments = models.CharField(null=True, max_length=200)
    daysSupply = models.IntegerField(null=True)
    originalFaxed = models.CharField(null=True, max_length=200)
    drugClassification = models.CharField(null=True, max_length=200)
    notes = models.CharField(null=True, max_length=200)
    drugSchedule = models.CharField(null=True, max_length=200)
    ndc = models.CharField(null=True, max_length=200)
    isDispensed = models.NullBooleanField()
    isDispensedFromInventory = models.NullBooleanField()
    isAdministered = models.NullBooleanField()
    geoareasId = models.IntegerField(null=True)
    source = models.CharField(null=True, max_length=200)
    clientAxisDetailId = models.IntegerField(null=True)
    supervisingEmpId = models.IntegerField(null=True)
    rxNormId = models.IntegerField(null=True)
    rxNormName = models.CharField(null=True, max_length=200)
    routeOfAdmin = models.CharField(null=True, max_length=200)
    isReconciledCDA = models.CharField(null=True, max_length=200)
    rxNormClassCode = models.CharField(null=True, max_length=200)
    providerName = models.CharField(null=True, max_length=200)
    dosageDescription = models.CharField(null=True, max_length=200)
    dateCreated = models.DateTimeField(null=True)
    dateUpdated = models.DateTimeField(null=True)
    state = models.CharField(null=True, max_length=200)
    date = models.DateTimeField(null=True)


# class Diagnoses(models.Model):

