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);
}
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);
}
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);
}
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());
}
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);
}
Aggregations