Search in sources :

Example 1 with Code

use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.

the class PayerTest method costsUncoveredByNoInsurance.

@Test
public void costsUncoveredByNoInsurance() {
    Costs.loadCostData();
    Payer.loadNoInsurance();
    person = new Person(0L);
    person.coverage.setPayerAtTime(0L, Payer.noInsurance);
    Code code = new Code("SNOMED-CT", "705129", "Fake SNOMED with the same code as an RxNorm code");
    Encounter fakeEncounter = person.record.encounterStart(0L, EncounterType.WELLNESS);
    fakeEncounter.codes.add(code);
    fakeEncounter.provider = new Provider();
    double totalCost = fakeEncounter.getCost().doubleValue();
    person.record.encounterEnd(0L, EncounterType.WELLNESS);
    // The No Insurance payer should have $0.0 coverage.
    assertEquals(0, Payer.noInsurance.getAmountCovered(), 0.001);
    // The No Insurance's uncovered costs should equal the total cost.
    assertEquals(totalCost, Payer.noInsurance.getAmountUncovered(), 0.001);
    // The person's expenses shoudl equal the total cost.
    assertEquals(totalCost, person.coverage.getTotalExpenses(), 0.001);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 2 with Code

use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.

the class PayerTest method payerCoversEncounter.

@Test
public void payerCoversEncounter() {
    person = new Person(0L);
    person.attributes.put(Person.BIRTHDATE, 0L);
    person.coverage.setPayerAtTime(0L, testPrivatePayer1);
    HealthRecord healthRecord = new HealthRecord(person);
    Encounter encounter = healthRecord.encounterStart(0L, EncounterType.INPATIENT);
    encounter.provider = new Provider();
    encounter.codes.add(new Code("SNOMED-CT", "705129", "Fake SNOMED for null entry"));
    assertTrue(testPrivatePayer1.coversService(encounter.type));
    healthRecord.encounterEnd(0L, EncounterType.INPATIENT);
    // Person's coverage should equal the cost of the encounter
    double coverage = encounter.claim.totals.coinsurance + encounter.claim.totals.payer;
    assertEquals(person.coverage.getTotalCoverage(), coverage, 0.001);
    double result = encounter.claim.totals.coinsurance + encounter.claim.totals.copay + encounter.claim.totals.deductible + encounter.claim.totals.payer + encounter.claim.totals.pocket;
    assertEquals(encounter.getCost().doubleValue(), result, 0.001);
    // Person's expenses should equal the copay.
    double expenses = encounter.claim.totals.copay + encounter.claim.totals.deductible + encounter.claim.totals.pocket;
    assertEquals(person.coverage.getTotalExpenses(), expenses, 0.001);
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 3 with Code

use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.

the class PayerTest method costsCoveredByPayer.

@Test
public void costsCoveredByPayer() {
    long time = 0L;
    Costs.loadCostData();
    person = new Person(time);
    person.coverage.setPayerAtTime(time, testPrivatePayer1);
    Code code = new Code("SNOMED-CT", "705129", "Fake SNOMED with the same code as an RxNorm code");
    Encounter fakeEncounter = person.record.encounterStart(time, EncounterType.WELLNESS);
    fakeEncounter.codes.add(code);
    fakeEncounter.provider = new Provider();
    double totalCost = fakeEncounter.getCost().doubleValue();
    person.record.encounterEnd(0L, EncounterType.WELLNESS);
    // check the copays match
    assertEquals(testPrivatePayer1.getDeductible(), fakeEncounter.claim.totals.deductible, 0.001);
    // check that totals match
    assertEquals(totalCost, fakeEncounter.claim.totals.cost, 0.001);
    double result = fakeEncounter.claim.totals.coinsurance + fakeEncounter.claim.totals.copay + fakeEncounter.claim.totals.deductible + fakeEncounter.claim.totals.payer + fakeEncounter.claim.totals.pocket;
    assertEquals(totalCost, result, 0.001);
    // The total cost should equal the Cost to the Payer summed with the Payer's copay amount.
    assertEquals(totalCost, testPrivatePayer1.getAmountCovered() + fakeEncounter.claim.getPatientCost(), 0.001);
    // The total cost should equal the Payer's uncovered costs plus the Payer's covered costs.
    assertEquals(totalCost, testPrivatePayer1.getAmountCovered() + testPrivatePayer1.getAmountUncovered(), 0.001);
    // The total coverage by the payer should equal the person's covered costs.
    assertEquals(person.coverage.getTotalCoverage(), testPrivatePayer1.getAmountCovered(), 0.001);
}
Also used : Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 4 with Code

use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.

the class PayerTest method incrementEncounters.

@Test
public void incrementEncounters() {
    person = new Person(0L);
    person.coverage.setPayerAtTime(0L, testPrivatePayer1);
    HealthRecord healthRecord = new HealthRecord(person);
    Code code = new Code("SNOMED-CT", "705129", "Fake Code");
    Encounter fakeEncounter = healthRecord.encounterStart(0L, EncounterType.INPATIENT);
    fakeEncounter.codes.add(code);
    fakeEncounter.provider = new Provider();
    healthRecord.encounterEnd(0L, EncounterType.INPATIENT);
    fakeEncounter = healthRecord.encounterStart(0L, EncounterType.AMBULATORY);
    fakeEncounter.provider = new Provider();
    fakeEncounter.codes.add(code);
    healthRecord.encounterEnd(0L, EncounterType.AMBULATORY);
    fakeEncounter = healthRecord.encounterStart(0L, EncounterType.EMERGENCY);
    fakeEncounter.codes.add(code);
    fakeEncounter.provider = new Provider();
    healthRecord.encounterEnd(0L, EncounterType.EMERGENCY);
    assertEquals(3, testPrivatePayer1.getEncountersCoveredCount());
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Test(org.junit.Test)

Example 5 with Code

use of org.mitre.synthea.world.concepts.HealthRecord.Code in project synthea by synthetichealth.

the class LossOfCareHealthRecordTest method personRunsOutOfIncomeDueToMonthlyPremium.

@Test
public void personRunsOutOfIncomeDueToMonthlyPremium() {
    Person person = new Person(0L);
    person.attributes.put(Person.BIRTHDATE, time);
    person.attributes.put(Person.GENDER, "F");
    person.coverage.setPayerAtTime(time, testPrivatePayer);
    person.setProvider(EncounterType.WELLNESS, new Provider());
    Code code = new Code("SNOMED-CT", "705129", "Fake Code");
    // Set person's income to be $1 lower than the cost of 8 monthly premiums.
    person.attributes.put(Person.INCOME, (int) (testPrivatePayer.getMonthlyPremium() * 8) - 1);
    // Pay monthly premium 8 times.
    long oneMonth = Utilities.convertTime("years", 1) / 12;
    long currTime = time;
    HealthInsuranceModule healthInsuranceModule = new HealthInsuranceModule();
    for (int i = 0; i < 8; i++) {
        currTime += oneMonth;
        healthInsuranceModule.process(person, currTime);
    }
    // Person should now have no insurance.
    assertTrue(person.coverage.getPayerAtTime(currTime).equals(Payer.noInsurance));
    // Encounter is uncovered and unaffordable.
    Encounter uncoveredEncounter3 = person.encounterStart(time + oneMonth * 7, EncounterType.WELLNESS);
    uncoveredEncounter3.codes.add(code);
    uncoveredEncounter3.provider = new Provider();
    person.record.encounterEnd(time + oneMonth * 7, EncounterType.WELLNESS);
    // Person should have this encounter in the uncoveredHealthRecord.
    assertFalse(person.defaultRecord.encounters.contains(uncoveredEncounter3));
    assertTrue(person.lossOfCareRecord.encounters.contains(uncoveredEncounter3));
}
Also used : HealthInsuranceModule(org.mitre.synthea.modules.HealthInsuranceModule) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Provider(org.mitre.synthea.world.agents.Provider) Test(org.junit.Test)

Aggregations

Code (org.mitre.synthea.world.concepts.HealthRecord.Code)152 Test (org.junit.Test)64 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)49 HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)48 Date (java.util.Date)30 CardiovascularDiseaseModule (org.mitre.synthea.modules.CardiovascularDiseaseModule)30 DeathModule (org.mitre.synthea.modules.DeathModule)30 EncounterModule (org.mitre.synthea.modules.EncounterModule)30 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)30 QualityOfLifeModule (org.mitre.synthea.modules.QualityOfLifeModule)30 WeightLossModule (org.mitre.synthea.modules.WeightLossModule)29 ArrayList (java.util.ArrayList)22 HashMap (java.util.HashMap)20 JsonObject (com.google.gson.JsonObject)19 Person (org.mitre.synthea.world.agents.Person)19 Medication (org.mitre.synthea.world.concepts.HealthRecord.Medication)15 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)14 Reference (org.hl7.fhir.r4.model.Reference)14 Provider (org.mitre.synthea.world.agents.Provider)14 Meta (org.hl7.fhir.r4.model.Meta)13