diff --git a/src/main/java/org/mitre/synthea/modules/CardiovascularDiseaseModule.java b/src/main/java/org/mitre/synthea/modules/CardiovascularDiseaseModule.java index 4ae6a0663f..a46db83491 100644 --- a/src/main/java/org/mitre/synthea/modules/CardiovascularDiseaseModule.java +++ b/src/main/java/org/mitre/synthea/modules/CardiovascularDiseaseModule.java @@ -14,6 +14,7 @@ import org.mitre.synthea.helpers.Utilities; import org.mitre.synthea.world.agents.Person; import org.mitre.synthea.world.concepts.ClinicianSpecialty; +import org.mitre.synthea.world.concepts.HealthRecord; import org.mitre.synthea.world.concepts.HealthRecord.Code; import org.mitre.synthea.world.concepts.HealthRecord.Encounter; import org.mitre.synthea.world.concepts.HealthRecord.EncounterType; @@ -757,7 +758,11 @@ private static void atrialFibrillationTreatment(Person person, long time) { private static void prescribeMedication(String med, Person person, long time, boolean chronic) { Medication entry = person.record.medicationStart(time, med, chronic); - entry.codes.add(LOOKUP.get(med)); + HealthRecord.Code medicationCode = LOOKUP.get(med); + if (! entry.containsCode(medicationCode.code, medicationCode.system)) { + entry.codes.add(medicationCode); + } + // increment number of prescriptions prescribed Encounter encounter = (Encounter) person.attributes.get(CVD_ENCOUNTER); if (encounter != null) { @@ -780,7 +785,9 @@ public static void performEncounter(Person person, long time, Encounter encounte && !person.record.present.containsKey(diagnosis)) { Code code = LOOKUP.get(diagnosis); Entry conditionEntry = person.record.conditionStart(time, code.display); - conditionEntry.codes.add(code); + if (! conditionEntry.containsCode(code.code, code.system)) { + conditionEntry.codes.add(code); + } } } @@ -908,4 +915,4 @@ public static void inventoryAttributes(Map attributes) { Attributes.inventory(attributes, m, "stroke_points", false, true, "Numeric"); Attributes.inventory(attributes, m, "stroke_history", false, true, "true"); } -} +} \ No newline at end of file