Search in sources :

Example 11 with HealthRecord

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

the class LogicTest method test_allergy_condition.

@Test
public void test_allergy_condition() {
    person.record = new HealthRecord(person);
    assertFalse(doTest("penicillinAllergyTest"));
    HealthRecord.Code penicillinCode = new HealthRecord.Code("RxNorm", "7984", "Penicillin V");
    person.record.allergyStart(time, penicillinCode.code);
    assertTrue(doTest("penicillinAllergyTest"));
    time += Utilities.convertTime("years", 10);
    person.record.allergyEnd(time, penicillinCode.code);
    assertFalse(doTest("penicillinAllergyTest"));
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Test(org.junit.Test)

Example 12 with HealthRecord

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

the class LogicTest method test_careplan_condition.

@Test
public void test_careplan_condition() {
    HealthRecord.Code diabetesCode = new HealthRecord.Code("SNOMED-CT", "698360004", "Diabetes self management plan");
    person.record = new HealthRecord(person);
    assertFalse(doTest("diabetesCarePlanTest"));
    assertFalse(doTest("anginaCarePlanTest"));
    CarePlan dcp = person.record.careplanStart(time, diabetesCode.code);
    dcp.codes.add(diabetesCode);
    assertTrue(doTest("diabetesCarePlanTest"));
    assertFalse(doTest("anginaCarePlanTest"));
    time += Utilities.convertTime("years", 10);
    person.record.careplanEnd(time, diabetesCode.code, new HealthRecord.Code("SNOMED-CT", "444110003", "Type II Diabetes Mellitus Well Controlled"));
    assertFalse(doTest("diabetesCarePlanTest"));
    HealthRecord.Code anginaCode = new HealthRecord.Code("SNOMED-CT", "698360004", "Diabetes self management plan");
    CarePlan acp = person.record.careplanStart(time, anginaCode.code);
    acp.codes.add(anginaCode);
    person.attributes.put("Angina_CarePlan", acp);
    assertTrue(doTest("anginaCarePlanTest"));
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) CarePlan(org.mitre.synthea.world.concepts.HealthRecord.CarePlan) Test(org.junit.Test)

Example 13 with HealthRecord

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

the class PayerFinderBestRates method find.

/**
 * Find a provider with a specific service for the person.
 *
 * @param payers  The list of eligible payers.
 * @param person  The patient who requires the service.
 * @param service The service required.
 * @param time    The date/time within the simulated world, in milliseconds.
 * @return Service provider or null if none is available.
 */
@Override
public Payer find(List<Payer> payers, Person person, EncounterType service, long time) {
    int numberOfExpectedEncounters = 0;
    if (person.hasMultipleRecords) {
        for (HealthRecord record : person.records.values()) {
            numberOfExpectedEncounters += numberOfEncounterDuringLastTwelveMonths(record, time);
        }
    } else {
        numberOfExpectedEncounters = numberOfEncounterDuringLastTwelveMonths(person.defaultRecord, time);
    }
    HealthRecord.Encounter dummy = person.record.new Encounter(time, EncounterType.AMBULATORY.toString());
    Payer bestRatePayer = Payer.noInsurance;
    double bestExpectedRate = Double.MAX_VALUE;
    for (Payer payer : payers) {
        if (IPayerFinder.meetsBasicRequirements(payer, person, service, time)) {
            // First, calculate the annual premium.
            double expectedRate = (payer.getMonthlyPremium() * 12.0);
            // Second, calculate expected copays based on last years visits.
            expectedRate += (payer.determineCopay(dummy) * numberOfExpectedEncounters);
            // TODO consider deductibles, coinsurance, covered services, etc.
            if (expectedRate < bestExpectedRate) {
                bestExpectedRate = expectedRate;
                bestRatePayer = payer;
            }
        }
    }
    return bestRatePayer;
}
Also used : Payer(org.mitre.synthea.world.agents.Payer) HealthRecord(org.mitre.synthea.world.concepts.HealthRecord)

Example 14 with HealthRecord

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

the class Person method getHealthRecord.

/**
 * Returns the current HealthRecord based on the provider. If the person has no more remaining
 * income, Uncovered HealthRecord is returned.
 *
 * @param provider the provider of the encounter
 * @param time the current time (To determine person's current income and payer)
 */
private synchronized HealthRecord getHealthRecord(Provider provider, long time) {
    // meaning we can guarantee that they currently have no insurance.
    if (lossOfCareEnabled && !this.stillHasIncome(time)) {
        return this.lossOfCareRecord;
    }
    HealthRecord returnValue = this.defaultRecord;
    if (hasMultipleRecords) {
        String key = provider.getResourceID();
        if (!records.containsKey(key)) {
            HealthRecord record = null;
            if (this.record != null && this.record.provider == null) {
                record = this.record;
            } else {
                record = new HealthRecord(this);
            }
            record.provider = provider;
            records.put(key, record);
        }
        returnValue = records.get(key);
    }
    return returnValue;
}
Also used : HealthRecord(org.mitre.synthea.world.concepts.HealthRecord)

Aggregations

HealthRecord (org.mitre.synthea.world.concepts.HealthRecord)14 Test (org.junit.Test)9 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)5 Person (org.mitre.synthea.world.agents.Person)4 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)4 Observation (org.mitre.synthea.world.concepts.HealthRecord.Observation)2 IParser (ca.uhn.fhir.parser.IParser)1 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1