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