From 1a51a215ad03eec28f3ec39852918f2c7f089faf Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Sun, 20 Jan 2019 21:09:48 +0300 Subject: [PATCH] RA-429 : deleting duplicate concepts --- .../AdministrativeNotification.java | 20 ++++++++++++++ api/src/main/resources/liquibase.xml | 27 +++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 api/src/main/java/org/openmrs/module/referencemetadata/AdministrativeNotification.java diff --git a/api/src/main/java/org/openmrs/module/referencemetadata/AdministrativeNotification.java b/api/src/main/java/org/openmrs/module/referencemetadata/AdministrativeNotification.java new file mode 100644 index 0000000..17cc9bf --- /dev/null +++ b/api/src/main/java/org/openmrs/module/referencemetadata/AdministrativeNotification.java @@ -0,0 +1,20 @@ +package org.openmrs.module.referencemetadata; + +import java.util.Collection; + +import org.openmrs.Concept; +import org.openmrs.api.context.Context; + +public class AdministrativeNotification { + + public void notify_duplicate_concepts() { + Collection concepts = Context.getConceptService().getConceptsByName("YES"); + + if (concepts.size() == 2) { + + + } else { + + } +} +} diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml index 262ed7f..4e222f1 100644 --- a/api/src/main/resources/liquibase.xml +++ b/api/src/main/resources/liquibase.xml @@ -1,8 +1,31 @@ - - + + + + + + select count(*) from concept_name where name = 'YES' + select count(*) from concept_name where name = 'NO' + + + + it checks whether the duplicate concepts exists and deletes one + + + + + SET FOREIGN_KEY_CHECKS = 0; + delete from concept_name where concept_id =1 or concept_id =2; + delete from concept where concept_id =1 or concept_id =2 ; + SET FOREIGN_KEY_CHECKS = 1; + + + \ No newline at end of file