Search in sources :

Example 1 with Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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 Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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 Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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 Encounter

use of org.mitre.synthea.world.concepts.HealthRecord.Encounter 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 Encounter

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

the class HealthRecordTest method testReportAllObs.

@Test
public void testReportAllObs() {
    Person person = new Person(0L);
    person.coverage.setPayerAtTime(time, noInsurance);
    HealthRecord record = new HealthRecord(person);
    Encounter encounter = record.encounterStart(time, EncounterType.WELLNESS);
    record.observation(time, "A", "A");
    record.observation(time, "B", "B");
    record.observation(time, "C", "C");
    Report report = record.report(time, "R", 3);
    Assert.assertEquals(3, encounter.observations.size());
    Assert.assertEquals(3, report.observations.size());
    Assert.assertEquals("A", report.observations.get(0).value);
    Assert.assertEquals("B", report.observations.get(1).value);
    Assert.assertEquals("C", report.observations.get(2).value);
}
Also used : Report(org.mitre.synthea.world.concepts.HealthRecord.Report) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Person(org.mitre.synthea.world.agents.Person) Test(org.junit.Test)

Aggregations

Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)98 Test (org.junit.Test)53 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)50 Person (org.mitre.synthea.world.agents.Person)28 HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)28 ArrayList (java.util.ArrayList)16 DeathModule (org.mitre.synthea.modules.DeathModule)16 QualityOfLifeModule (org.mitre.synthea.modules.QualityOfLifeModule)16 Provider (org.mitre.synthea.world.agents.Provider)16 Medication (org.mitre.synthea.world.concepts.HealthRecord.Medication)16 Procedure (org.mitre.synthea.world.concepts.HealthRecord.Procedure)16 CardiovascularDiseaseModule (org.mitre.synthea.modules.CardiovascularDiseaseModule)15 EncounterModule (org.mitre.synthea.modules.EncounterModule)15 LifecycleModule (org.mitre.synthea.modules.LifecycleModule)15 WeightLossModule (org.mitre.synthea.modules.WeightLossModule)15 Observation (org.mitre.synthea.world.concepts.HealthRecord.Observation)15 Report (org.mitre.synthea.world.concepts.HealthRecord.Report)14 Date (java.util.Date)13 Claim (org.mitre.synthea.world.concepts.Claim)12 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)11