diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml
index 5e37aff0ec..b7af747675 100644
--- a/.github/workflows/build_publish.yml
+++ b/.github/workflows/build_publish.yml
@@ -43,7 +43,13 @@ jobs:
run: |
sudo gem install compass -v 1.0.3
- name: Build and deploy with Maven
- run: ./mvnw --no-transfer-progress clean -U deploy
+ run: |
+ PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
+ if [[ "$PROJECT_VERSION" == *"-SNAPSHOT" ]]; then
+ ./mvnw --no-transfer-progress clean -U deploy
+ else
+ echo "❌ The current push is for release. So skipping build."
+ fi
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
diff --git a/.github/workflows/release_deploy.yml b/.github/workflows/release_deploy.yml
new file mode 100644
index 0000000000..4388e95024
--- /dev/null
+++ b/.github/workflows/release_deploy.yml
@@ -0,0 +1,44 @@
+name: Build and Release package
+on:
+ push:
+ tags:
+ - '[0-9]+.[0-9]+.[0-9]+'
+
+jobs:
+ build-release-package:
+ name: Build and Release package
+ runs-on: macos-14
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: 1.8
+ server-id: nexus-sonatype
+ server-username: NEXUS_USERNAME
+ server-password: NEXUS_PASSWORD
+ gpg-private-key: ${{ secrets.BAHMNI_INFRA_GPG_KEY }}
+ - name: Compare Git tag with Maven version
+ run: |
+ export GIT_TAG=${GITHUB_REF#refs/tags/}
+ PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
+ if [ "$PROJECT_VERSION" != "$GIT_TAG" ]; then
+ echo "❌ The Git tag ($GIT_TAG) does not match the Maven version ($PROJECT_VERSION)."
+ exit 1
+ else
+ echo "✅ The Git tag matches the Maven version."
+ fi
+ - name: Install Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: '2.7'
+ bundler-cache: true
+ - name: Install compass
+ run: |
+ sudo gem install compass -v 1.0.3
+ - name: Build and deploy with Maven
+ run: ./mvnw --no-transfer-progress clean -U deploy -DperformRelease=true
+ env:
+ NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
+ NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
+ GPG_PASSPHRASE: ${{ secrets.BAHMNI_INFRA_GPG_PASSPHRASE }}
diff --git a/.github/workflows/validate_pr.yml b/.github/workflows/validate_pr.yml
index c5823a9cda..da4b9f183f 100644
--- a/.github/workflows/validate_pr.yml
+++ b/.github/workflows/validate_pr.yml
@@ -6,7 +6,7 @@ on:
jobs:
build:
name: Build
- runs-on: macos-11
+ runs-on: macos-14
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
diff --git a/.gitignore b/.gitignore
index ab4edec445..ac7e5e5d4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@ classes/
sass-external
bahmnicore-omod/src/main/webapp/resources/styles/bahmnicore.css
.mvn/wrapper/*.jar
+.vscode
+
# Eclipse project files
.settings
diff --git a/admin/pom.xml b/admin/pom.xml
index 1dd3b325ec..eeb512fd81 100644
--- a/admin/pom.xml
+++ b/admin/pom.xml
@@ -5,7 +5,7 @@
bahmni
org.bahmni.module
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
admin
diff --git a/bahmni-emr-api/pom.xml b/bahmni-emr-api/pom.xml
index 4cb2ee1efe..69b8d2543d 100644
--- a/bahmni-emr-api/pom.xml
+++ b/bahmni-emr-api/pom.xml
@@ -5,7 +5,7 @@
bahmni
org.bahmni.module
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
4.0.0
@@ -68,6 +68,12 @@
org.bahmni.module
bahmni-commons-api
+
+ org.openmrs.module
+ webservices.rest-omod-common
+ ${openMRSWebServicesVersion}
+ test
+
org.openmrs.web
openmrs-web
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadata.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadata.java
index ea35d9169a..81be0b3332 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadata.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadata.java
@@ -18,6 +18,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import static java.util.stream.Collectors.toList;
@@ -37,16 +38,21 @@ public class BahmniDiagnosisMetadata {
private EncounterTransactionMapper encounterTransactionMapper;
+ private Concept getConceptsByNameAndLocale(String name, Locale locale) {
+ List conceptList = conceptService.getConceptsByName(name, locale, false);
+ return conceptList.isEmpty() ? null : conceptList.get(0);
+ }
+
public Concept getBahmniInitialDiagnosisConcept() {
- return conceptService.getConceptByName(BAHMNI_INITIAL_DIAGNOSIS);
+ return getConceptsByNameAndLocale(BAHMNI_INITIAL_DIAGNOSIS, Locale.ENGLISH);
}
public Concept getBahmniDiagnosisRevisedConcept() {
- return conceptService.getConceptByName(BAHMNI_DIAGNOSIS_REVISED);
+ return getConceptsByNameAndLocale(BAHMNI_DIAGNOSIS_REVISED, Locale.ENGLISH);
}
public Concept getBahmniDiagnosisStatusConcept() {
- return conceptService.getConceptByName(BAHMNI_DIAGNOSIS_STATUS);
+ return getConceptsByNameAndLocale(BAHMNI_DIAGNOSIS_STATUS, Locale.ENGLISH);
}
@Autowired
@@ -179,8 +185,8 @@ public Obs findMatchingDiagnosis(Collection observations, BahmniDiagnosis b
private boolean isDiagnosisNotRevised(Obs obs) {
return !obs.getGroupMembers(false).stream()
.anyMatch(groupMember -> {
- return groupMember.getConcept().equals(getBahmniDiagnosisRevisedConcept())
- && groupMember.getValueAsBoolean();});
+ return groupMember.getConcept().equals(getBahmniDiagnosisRevisedConcept())
+ && groupMember.getValueAsBoolean();});
}
private boolean isDiagnosisMatching(Obs obs, EncounterTransaction.Diagnosis diagnosis) {
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/disposition/mapper/BahmniDispositionMapper.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/disposition/mapper/BahmniDispositionMapper.java
index e5c3835935..36543abfcc 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/disposition/mapper/BahmniDispositionMapper.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/disposition/mapper/BahmniDispositionMapper.java
@@ -3,11 +3,14 @@
import org.openmrs.Concept;
import org.openmrs.User;
import org.openmrs.api.ConceptService;
+import org.openmrs.api.context.Context;
import org.openmrs.module.bahmniemrapi.disposition.contract.BahmniDisposition;
import org.openmrs.module.emrapi.encounter.domain.EncounterTransaction;
+import org.openmrs.util.LocaleUtility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
import java.util.Set;
import java.util.Locale;
@@ -32,7 +35,13 @@ public BahmniDisposition map(EncounterTransaction.Disposition disposition, Set conceptsByName = Context.getConceptService().getConceptsByName(disposition.getConceptName(), LocaleUtility.getDefaultLocale(), false);
+ if (!conceptsByName.isEmpty()) {
+ concept = conceptsByName.get(0);
+ }
+ }
+ if(concept != null && concept.getPreferredName(locale) != null) {
bahmniDisposition.setPreferredName(concept.getPreferredName(locale).getName());
}
return bahmniDisposition;
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/document/service/impl/VisitDocumentServiceImpl.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/document/service/impl/VisitDocumentServiceImpl.java
index b674ec7075..87d1c00ebf 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/document/service/impl/VisitDocumentServiceImpl.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/document/service/impl/VisitDocumentServiceImpl.java
@@ -29,7 +29,8 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-//comment
+
+import java.util.Locale;
@Service
public class VisitDocumentServiceImpl implements VisitDocumentService {
@@ -87,8 +88,13 @@ private void linkDocumentAndImpressionObs(VisitDocumentRequest visitDocumentRequ
}
}
+ private Concept getConceptsByNameAndLocale(String name, Locale locale) {
+ List conceptList = conceptService.getConceptsByName(name, locale, false);
+ return conceptList.isEmpty() ? null : conceptList.get(0);
+ }
+
private void updateEncounter(Encounter encounter, Date encounterDateTime, List documents) {
- Concept imageConcept = conceptService.getConceptByName(DOCUMENT_OBS_GROUP_CONCEPT_NAME);
+ Concept imageConcept = getConceptsByNameAndLocale(DOCUMENT_OBS_GROUP_CONCEPT_NAME, Locale.ENGLISH);
for (Document document : documents) {
Concept testConcept = conceptService.getConceptByUuid(document.getTestUuid());
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/drugorder/mapper/BahmniDrugOrderMapper.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/drugorder/mapper/BahmniDrugOrderMapper.java
index 6d63028ff6..e7ba05e633 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/drugorder/mapper/BahmniDrugOrderMapper.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/drugorder/mapper/BahmniDrugOrderMapper.java
@@ -30,39 +30,10 @@ public List mapToResponse(List activeDrugOrders,
Map discontinuedOrderMap,
String locale) throws IOException {
- OrderMapper1_12 drugOrderMapper = new OrderMapper1_12();
-
List bahmniDrugOrders = new ArrayList<>();
for (DrugOrder openMRSDrugOrder : activeDrugOrders) {
- BahmniDrugOrder bahmniDrugOrder = new BahmniDrugOrder();
-
- bahmniDrugOrder.setDrugOrder(drugOrderMapper.mapDrugOrder(openMRSDrugOrder));
- if(locale != null) {
- Locale tempLocale = new Locale(locale);
- String localeSpecificName = "";
- if (openMRSDrugOrder != null) {
- localeSpecificName = openMRSDrugOrder.getDrug().getFullName(tempLocale);
- bahmniDrugOrder.getDrugOrder().getDrug().setName(localeSpecificName);
- }
- }
-
- if((locale != null) && (openMRSDrugOrder.getFrequency().getConcept() != null) && (openMRSDrugOrder.getFrequency().getConcept().getPreferredName(new Locale((locale))) != null)) {
- bahmniDrugOrder.getDrugOrder().getDosingInstructions().setFrequency(openMRSDrugOrder.getFrequency().getConcept().getPreferredName(new Locale((locale))).getName());
- }
- bahmniDrugOrder.setVisit(openMRSDrugOrder.getEncounter().getVisit());
- bahmniDrugOrder.setProvider(providerMapper.map(openMRSDrugOrder.getOrderer()));
- if(openMRSDrugOrder.getDrug() != null){
- bahmniDrugOrder.setRetired(openMRSDrugOrder.getDrug().getRetired());
- }
- bahmniDrugOrder.setEncounterUuid(openMRSDrugOrder.getEncounter().getUuid());
-
- bahmniDrugOrder.setCreatorName(openMRSDrugOrder.getCreator().getPersonName().toString());
- if(discontinuedOrderMap.containsKey(openMRSDrugOrder.getOrderNumber())){
- bahmniDrugOrder.setOrderReasonText(discontinuedOrderMap.get(openMRSDrugOrder.getOrderNumber()).getOrderReasonNonCoded());
- bahmniDrugOrder.setOrderReasonConcept(conceptMapper.map(discontinuedOrderMap.get(openMRSDrugOrder.getOrderNumber()).getOrderReason()));
- }
-
+ BahmniDrugOrder bahmniDrugOrder = mapDrugOrderToBahmniDrugOrder(openMRSDrugOrder, locale, discontinuedOrderMap);
bahmniDrugOrders.add(bahmniDrugOrder);
}
if(CollectionUtils.isNotEmpty(orderAttributeObs)){
@@ -71,9 +42,44 @@ public List mapToResponse(List activeDrugOrders,
return bahmniDrugOrders;
}
+ private BahmniDrugOrder mapDrugOrderToBahmniDrugOrder(DrugOrder openMRSDrugOrder, String locale, Map discontinuedOrderMap) {
+ OrderMapper1_12 drugOrderMapper = new OrderMapper1_12();
+ BahmniDrugOrder bahmniDrugOrder = new BahmniDrugOrder();
+ bahmniDrugOrder.setDrugOrder(drugOrderMapper.mapDrugOrder(openMRSDrugOrder));
+ if(locale != null) {
+ Locale tempLocale = new Locale(locale);
+ String localeSpecificName = "";
+ if (openMRSDrugOrder != null) {
+ localeSpecificName = openMRSDrugOrder.getDrug().getFullName(tempLocale);
+ bahmniDrugOrder.getDrugOrder().getDrug().setName(localeSpecificName);
+ }
+ }
+
+ if((locale != null) && (openMRSDrugOrder.getFrequency().getConcept() != null) && (openMRSDrugOrder.getFrequency().getConcept().getPreferredName(new Locale((locale))) != null)) {
+ bahmniDrugOrder.getDrugOrder().getDosingInstructions().setFrequency(openMRSDrugOrder.getFrequency().getConcept().getPreferredName(new Locale((locale))).getName());
+ }
+ bahmniDrugOrder.setVisit(openMRSDrugOrder.getEncounter().getVisit());
+ bahmniDrugOrder.setProvider(providerMapper.map(openMRSDrugOrder.getOrderer()));
+ if(openMRSDrugOrder.getDrug() != null){
+ bahmniDrugOrder.setRetired(openMRSDrugOrder.getDrug().getRetired());
+ }
+ bahmniDrugOrder.setEncounterUuid(openMRSDrugOrder.getEncounter().getUuid());
+
+ bahmniDrugOrder.setCreatorName(openMRSDrugOrder.getCreator().getPersonName().toString());
+ if(discontinuedOrderMap.containsKey(openMRSDrugOrder.getOrderNumber())){
+ bahmniDrugOrder.setOrderReasonText(discontinuedOrderMap.get(openMRSDrugOrder.getOrderNumber()).getOrderReasonNonCoded());
+ bahmniDrugOrder.setOrderReasonConcept(conceptMapper.map(discontinuedOrderMap.get(openMRSDrugOrder.getOrderNumber()).getOrderReason()));
+ }
+ return bahmniDrugOrder;
+ }
+
public void setMappers(BahmniProviderMapper bahmniProviderMapper, OrderAttributesMapper orderAttributesMapper, ConceptMapper conceptMapper){
providerMapper = bahmniProviderMapper;
this.orderAttributesMapper = orderAttributesMapper;
this.conceptMapper = conceptMapper;
}
+
+ public BahmniDrugOrder mapToResponse(DrugOrder drugOrder, Map discontinuedDrugOrderMap) {
+ return mapDrugOrderToBahmniDrugOrder(drugOrder, null, discontinuedDrugOrderMap);
+ }
}
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/contract/BahmniObservation.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/contract/BahmniObservation.java
index cad649dd35..62f85be997 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/contract/BahmniObservation.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/contract/BahmniObservation.java
@@ -43,6 +43,7 @@ public class BahmniObservation implements Comparable{
private String interpretation;
private String status;
private String encounterTypeName;
+ private String conceptFSN;
@JsonIgnore
private Serializable complexData;
@@ -431,4 +432,12 @@ public String getEncounterTypeName() {
public void setEncounterTypeName(String encounterTypeName) {
this.encounterTypeName = encounterTypeName;
}
+
+ public void setConceptFSN(String conceptFSN) {
+ this.conceptFSN = conceptFSN;
+ }
+
+ public String getConceptFSN() {
+ return this.conceptFSN;
+ }
}
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/OMRSObsToBahmniObsMapper.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/OMRSObsToBahmniObsMapper.java
index 512c6ef393..bf4c88fcff 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/OMRSObsToBahmniObsMapper.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/OMRSObsToBahmniObsMapper.java
@@ -2,13 +2,17 @@
import org.apache.commons.collections.CollectionUtils;
import org.openmrs.Concept;
+import org.openmrs.ConceptName;
import org.openmrs.EncounterProvider;
import org.openmrs.Obs;
+import org.openmrs.api.ConceptNameType;
import org.openmrs.module.bahmniemrapi.drugorder.mapper.BahmniProviderMapper;
import org.openmrs.module.bahmniemrapi.encountertransaction.contract.BahmniObservation;
import org.openmrs.module.bahmniemrapi.encountertransaction.mapper.parameters.AdditionalBahmniObservationFields;
import org.openmrs.module.emrapi.encounter.ObservationMapper;
import org.openmrs.module.emrapi.encounter.matcher.ObservationTypeMatcher;
+import org.openmrs.module.emrapi.utils.HibernateLazyLoader;
+import org.openmrs.util.LocaleUtility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -16,6 +20,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
@Component(value = "omrsObsToBahmniObsMapper")
public class OMRSObsToBahmniObsMapper {
@@ -33,9 +38,10 @@ public OMRSObsToBahmniObsMapper(ETObsToBahmniObsMapper etObsToBahmniObsMapper, O
public Collection map(List obsList, Collection rootConcepts) {
Collection bahmniObservations = new ArrayList<>();
+ Locale implementationLocale = LocaleUtility.getDefaultLocale();
for (Obs obs : obsList) {
if(observationTypeMatcher.getObservationType(obs).equals(ObservationTypeMatcher.ObservationType.OBSERVATION)){
- BahmniObservation bahmniObservation =map(obs);
+ BahmniObservation bahmniObservation = map(obs, implementationLocale);
if(CollectionUtils.isNotEmpty(rootConcepts )){
bahmniObservation.setConceptSortWeight(ConceptSortWeightUtil.getSortWeightFor(bahmniObservation.getConcept().getName(), rootConcepts));
}
@@ -45,7 +51,7 @@ public Collection map(List obsList, Collection
return bahmniObservations;
}
- public BahmniObservation map(Obs obs) {
+ public BahmniObservation map(Obs obs, Locale implementationLocale) {
if(obs == null)
return null;
String obsGroupUuid = obs.getObsGroup() == null? null : obs.getObsGroup().getUuid();
@@ -61,6 +67,28 @@ public BahmniObservation map(Obs obs) {
for (EncounterProvider encounterProvider : obs.getEncounter().getEncounterProviders()) {
additionalBahmniObservationFields.addProvider(bahmniProviderMapper.map(encounterProvider.getProvider()));
}
- return etObsToBahmniObsMapper.map(observationMapper.map(obs), additionalBahmniObservationFields, Collections.singletonList(obs.getConcept()), true);
+ BahmniObservation bahmniObservation = etObsToBahmniObsMapper.map(observationMapper.map(obs), additionalBahmniObservationFields, Collections.singletonList(obs.getConcept()), true);
+ bahmniObservation.setConceptFSN(getConceptFSNInDefaultLocale(obs, implementationLocale));
+ return bahmniObservation;
+ }
+
+ private String getConceptFSNInDefaultLocale(Obs obs, Locale implementationLocale) {
+ if (obs.getConcept() == null) {
+ return null;
+ }
+ Concept concept = new HibernateLazyLoader().load(obs.getConcept());
+ if (implementationLocale == null) {
+ return concept.getName().getName();
+ }
+ ConceptName fsn = concept.getName(implementationLocale, ConceptNameType.FULLY_SPECIFIED, null);
+ if (fsn == null) {
+ fsn = concept.getNames().stream().filter(name -> !name.getVoided() && name.getLocale().equals(implementationLocale)
+ && name.getConceptNameType().equals(ConceptNameType.FULLY_SPECIFIED)).findFirst().orElse(null);
+ }
+ if (fsn != null) {
+ return fsn.getName();
+ } else {
+ return concept.getName().getName();
+ }
}
}
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapper.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapper.java
index d8eadc662b..b7d37510a4 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapper.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapper.java
@@ -34,7 +34,7 @@ public List map(List bahmniObservations, S
new org.openmrs.module.bahmniemrapi.obsrelation.contract.ObsRelationship();
targetObsRelation.setRelationshipType(obsRelationship.getObsRelationshipType().getName());
targetObsRelation.setUuid(obsRelationship.getUuid());
- targetObsRelation.setTargetObs(OMRSObsToBahmniObsMapper.map(obsRelationship.getTargetObs()));
+ targetObsRelation.setTargetObs(OMRSObsToBahmniObsMapper.map(obsRelationship.getTargetObs(), null));
bahmniObservation.setTargetObsRelation(targetObsRelation);
// bahmniObservation.setProviders(providers);
}
@@ -47,8 +47,8 @@ public List map(List obsRelationships) {
List bahmniObservations = new ArrayList<>();
for (ObsRelationship obsRelationship : obsRelationships) {
- BahmniObservation sourceObservation = OMRSObsToBahmniObsMapper.map(obsRelationship.getSourceObs());
- BahmniObservation targetObservation = OMRSObsToBahmniObsMapper.map(obsRelationship.getTargetObs());
+ BahmniObservation sourceObservation = OMRSObsToBahmniObsMapper.map(obsRelationship.getSourceObs(), null);
+ BahmniObservation targetObservation = OMRSObsToBahmniObsMapper.map(obsRelationship.getTargetObs(), null);
sourceObservation.setProviders(encounterProviderMapper.convert(obsRelationship.getSourceObs().getEncounter().getEncounterProviders()));
org.openmrs.module.bahmniemrapi.obsrelation.contract.ObsRelationship targetObsRelation =
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/LabOrderResults.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/LabOrderResults.java
index 8f029fb640..828b99ccae 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/LabOrderResults.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/LabOrderResults.java
@@ -33,7 +33,7 @@ private TabularLabOrderResults tabulate() {
dateMap.put(orderDate, new TabularLabOrderResults.DateLabel(dateLabelIndexCounter++, orderDate.toString("dd-MMM-yyyy")));
}
if(orderMap.get(result.getTestName()) == null) {
- orderMap.put(result.getTestName(), new TabularLabOrderResults.TestOrderLabel(testOrderLabelCounter++, result.getTestName(), result.getMinNormal(), result.getMaxNormal(), result.getTestUnitOfMeasurement()));
+ orderMap.put(result.getTestName(), new TabularLabOrderResults.TestOrderLabel(testOrderLabelCounter++, result.getTestName(), result.getMinNormal(), result.getMaxNormal(), result.getTestUnitOfMeasurement(), result.getPanelName()));
}
if(result.getResult() != null || result.getReferredOut() || result.getUploadedFileName() != null) {
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/TabularLabOrderResults.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/TabularLabOrderResults.java
index 2d89b5e0ec..3dd72e608e 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/TabularLabOrderResults.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/contract/TabularLabOrderResults.java
@@ -55,18 +55,21 @@ public static class TestOrderLabel {
private Double minNormal;
private Double maxNormal;
private String testUnitOfMeasurement;
+ private String panelName;
@JsonCreator
public TestOrderLabel(@JsonProperty("index")Integer index,
@JsonProperty("testName")String testName,
@JsonProperty("minNormal")Double minNormal,
@JsonProperty("maxNormal")Double maxNormal,
- @JsonProperty("testUnitOfMeasurement")String testUnitOfMeasurement) {
+ @JsonProperty("testUnitOfMeasurement")String testUnitOfMeasurement,
+ @JsonProperty("panelName")String panelName) {
this.index = index;
this.testName = testName;
this.minNormal = minNormal;
this.maxNormal = maxNormal;
this.testUnitOfMeasurement = testUnitOfMeasurement;
+ this.panelName = panelName;
}
public Integer getIndex() {
@@ -108,8 +111,15 @@ public String getTestUnitOfMeasurement() {
public void setTestUnitOfMeasurement(String testUnitOfMeasurement) {
this.testUnitOfMeasurement = testUnitOfMeasurement;
}
- }
+ public String getPanelName() {
+ return panelName;
+ }
+
+ public void setPanelName(String panelName) {
+ this.panelName = panelName;
+ }
+ }
public static class CoordinateValue {
private Date accessionDateTime;
diff --git a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/mapper/LabOrderResultMapper.java b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/mapper/LabOrderResultMapper.java
index 9113a523a2..98683a29f4 100644
--- a/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/mapper/LabOrderResultMapper.java
+++ b/bahmni-emr-api/src/main/java/org/openmrs/module/bahmniemrapi/laborder/mapper/LabOrderResultMapper.java
@@ -4,6 +4,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.Concept;
+import org.openmrs.ConceptNumeric;
import org.openmrs.Obs;
import org.openmrs.Order;
import org.openmrs.api.APIException;
@@ -14,6 +15,7 @@
import java.text.ParseException;
import java.util.Date;
+import java.util.Optional;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@@ -21,6 +23,7 @@
@Component
public class LabOrderResultMapper {
private static final Log log = LogFactory.getLog(LabOrderResultMapper.class);
+ private static final String EMPTY_STRING = "";
public static final String LAB_RESULT = "LAB_RESULT";
public static final String LAB_ABNORMAL = "LAB_ABNORMAL";
public static final String LAB_MINNORMAL = "LAB_MINNORMAL";
@@ -72,13 +75,14 @@ private Obs newResultObs(Order testOrder, Date obsDate, Concept concept, LabOrde
obs.setConcept(concept);
obs.setOrder(testOrder);
obs.setObsDatetime(obsDate);
+ String accessionUuid = Optional.ofNullable(labOrderResult.getAccessionUuid()).orElseGet(() -> Optional.ofNullable(obs.getOrder()).map(Order::getAccessionNumber).orElse(EMPTY_STRING));
if (concept.getDatatype().getHl7Abbreviation().equals("CWE")) {
String resultUuid = labOrderResult.getResultUuid();
Concept conceptAnswer = isEmpty(resultUuid) ? null : conceptService.getConceptByUuid(resultUuid);
obs.setValueCoded(conceptAnswer);
if (conceptAnswer == null) {
- log.warn(String.format("Concept is not available in OpenMRS for ConceptUuid : [%s] , In Accession : [%s]"
- , resultUuid,labOrderResult.getAccessionUuid()));
+ log.error(String.format("Concept [%s] does not not have coded answer with ConceptUuid [%s] in OpenMRS, In Accession [%s]",
+ obs.getConcept().getName(), resultUuid, accessionUuid));
return null;
}
return obs;
@@ -88,9 +92,29 @@ private Obs newResultObs(Order testOrder, Date obsDate, Concept concept, LabOrde
return null;
}
obs.setValueAsString(labOrderResult.getResult());
+ checkResultRangesForAbsolutes(obs, accessionUuid);
return obs;
}
+ /**
+ * This method just logs error if the results are out of absolute ranges. This will be errored out (ValidationException)
+ * by openmrs by the {@link org.openmrs.validator.ObsValidator} during save
+ */
+ private void checkResultRangesForAbsolutes(Obs obs, String accessionUuid) {
+ if (!obs.getConcept().isNumeric()) {
+ return;
+ }
+ if (obs.getValueNumeric() != null) {
+ ConceptNumeric cn = conceptService.getConceptNumeric(obs.getConcept().getId());
+ if (cn.getHiAbsolute() != null && cn.getHiAbsolute() < obs.getValueNumeric()) {
+ log.error(String.format("Test results for [%s] is beyond the absolute high range, in Accession [%s]", cn.getName(), accessionUuid));
+ }
+ if (cn.getLowAbsolute() != null && cn.getLowAbsolute() > obs.getValueNumeric()) {
+ log.error(String.format("Test results for [%s] is beyond the absolute low range, in Accession [%s]", cn.getName(), accessionUuid));
+ }
+ }
+ }
+
private Concept getConceptByName(String conceptName) {
return conceptService.getConceptByName(conceptName);
}
diff --git a/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadataTest.java b/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadataTest.java
index 0d2bb1f73b..ed831ba371 100644
--- a/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadataTest.java
+++ b/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/diagnosis/helper/BahmniDiagnosisMetadataTest.java
@@ -32,6 +32,7 @@
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.Arrays;
+import java.util.List;
import java.util.Locale;
import static org.hamcrest.CoreMatchers.is;
@@ -82,7 +83,7 @@ public void shouldMatchCodedDiagnosis() {
Obs diagnosisObs =
new ObsBuilder().withConcept(diagnosisSetConcept)
.withGroupMembers(
- new ObsBuilder().withConcept(codedDiagnosisConcept)
+ new ObsBuilder().withConcept(codedDiagnosisConcept)
.withValue(feverConcept).build(),
new ObsBuilder().withConcept(conceptForName("Diagnosis Order"))
.withValue(conceptForName("Primary")).build(),
@@ -213,7 +214,7 @@ public void shouldNotConsiderRevisedObsWhileFindingMatchingObs() throws Exceptio
when(properties.getDiagnosisMetadata().getCodedDiagnosisConcept()).thenReturn(codedDiagnosisConcept);
when(properties.getDiagnosisMetadata().getNonCodedDiagnosisConcept()).thenReturn(nonCodedDiagnosisConcept);
when(conceptService.getTrueConcept()).thenReturn(conceptTrue);
- when(conceptService.getConceptByName(BAHMNI_DIAGNOSIS_REVISED)).thenReturn(revised);
+ when(conceptService.getConceptsByName(BAHMNI_DIAGNOSIS_REVISED,Locale.ENGLISH,false)).thenReturn(Arrays.asList(revised));
Concept feverConcept = conceptForName("Fever");
Obs aCodedDiagnosisObs =
new ObsBuilder().withConcept(diagnosisSetConcept)
diff --git a/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapperTest.java b/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapperTest.java
index 6ce71e0e0d..350e6abde9 100644
--- a/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapperTest.java
+++ b/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/mapper/ObsRelationshipMapperTest.java
@@ -72,7 +72,7 @@ public void shouldMapObsRelationshipForBahmniObservations() {
BahmniObservation sourceObservation = getBahmniObservation(sourceObsUuid);
BahmniObservation targetObservation = getBahmniObservation(targetObsUuid);
- when(OMRSObsToBahmniObsMapper.map(targetObs)).thenReturn(targetObservation);
+ when(OMRSObsToBahmniObsMapper.map(targetObs, null)).thenReturn(targetObservation);
ArrayList bahmniObservations = new ArrayList<>();
bahmniObservations.add(sourceObservation);
@@ -81,7 +81,7 @@ public void shouldMapObsRelationshipForBahmniObservations() {
List mappedBahmniObservations = obsRelationshipMapper.map(bahmniObservations, "encounter-uuid");
verify(obsrelationService).getRelationsWhereSourceObsInEncounter("encounter-uuid");
- verify(OMRSObsToBahmniObsMapper, times(1)).map(targetObs);
+ verify(OMRSObsToBahmniObsMapper, times(1)).map(targetObs, null);
assertEquals(2, mappedBahmniObservations.size());
assertEquals(sourceObsUuid, mappedBahmniObservations.get(0).getUuid());
assertEquals(targetObsUuid, mappedBahmniObservations.get(0).getTargetObsRelation().getTargetObs().getUuid());
@@ -112,8 +112,8 @@ public void shouldMapMultipleObsRelationshipForBahmniObservations() {
BahmniObservation targetObservation1 = getBahmniObservation(targetObs1Uuid);
BahmniObservation targetObservation2 = getBahmniObservation(targetObs2Uuid);
- when(OMRSObsToBahmniObsMapper.map(targetObs1)).thenReturn(targetObservation1);
- when(OMRSObsToBahmniObsMapper.map(targetObs2)).thenReturn(targetObservation2);
+ when(OMRSObsToBahmniObsMapper.map(targetObs1, null)).thenReturn(targetObservation1);
+ when(OMRSObsToBahmniObsMapper.map(targetObs2, null)).thenReturn(targetObservation2);
ArrayList bahmniObservations = new ArrayList<>();
bahmniObservations.add(sourceObservation1);
@@ -124,7 +124,7 @@ public void shouldMapMultipleObsRelationshipForBahmniObservations() {
List mappedBahmniObservations = obsRelationshipMapper.map(bahmniObservations, "encounter-uuid");
verify(obsrelationService).getRelationsWhereSourceObsInEncounter("encounter-uuid");
- verify(OMRSObsToBahmniObsMapper, times(2)).map(any(Obs.class));
+ verify(OMRSObsToBahmniObsMapper, times(2)).map(any(Obs.class), any());
assertEquals(4, mappedBahmniObservations.size());
assertEquals(sourceObs1Uuid, mappedBahmniObservations.get(0).getUuid());
assertEquals(targetObs1Uuid, mappedBahmniObservations.get(0).getTargetObsRelation().getTargetObs().getUuid());
diff --git a/bahmni-mapping/pom.xml b/bahmni-mapping/pom.xml
index bc8bae82c3..4e8bed62bc 100644
--- a/bahmni-mapping/pom.xml
+++ b/bahmni-mapping/pom.xml
@@ -4,7 +4,7 @@
org.bahmni.module
bahmni
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
bahmni-mapping
jar
diff --git a/bahmni-test-commons/pom.xml b/bahmni-test-commons/pom.xml
index e38d378178..b4286525cf 100644
--- a/bahmni-test-commons/pom.xml
+++ b/bahmni-test-commons/pom.xml
@@ -14,7 +14,7 @@
bahmni
org.bahmni.module
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
diff --git a/bahmnicore-api/pom.xml b/bahmnicore-api/pom.xml
index 66d673e730..3de3617b5b 100644
--- a/bahmnicore-api/pom.xml
+++ b/bahmnicore-api/pom.xml
@@ -4,7 +4,7 @@
org.bahmni.module
bahmni
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
bahmnicore-api
jar
@@ -83,6 +83,10 @@
joda-time
2.0
+
+ org.bahmni.module
+ communication-api
+
org.bahmni.module
bahmni-emr-api
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/NoteRequestResponse.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/NoteRequestResponse.java
index 7b4b8df148..be92dddd13 100644
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/NoteRequestResponse.java
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/NoteRequestResponse.java
@@ -16,6 +16,7 @@ public class NoteRequestResponse {
private String LocationName;
+ private String providerUuid;
public String getUuid() {
return uuid;
@@ -64,6 +65,14 @@ public String getLocationName() {
public void setLocationName(String locationName) {
LocationName = locationName;
}
+
+ public String getProviderUuid() {
+ return providerUuid;
+ }
+
+ public void setProviderUuid(String providerUuid) {
+ this.providerUuid = providerUuid;
+ }
}
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java
index 5ddc3fbdaf..2cfa4627e7 100644
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java
@@ -9,7 +9,11 @@ public class ApplicationDataDirectoryImpl implements ApplicationDataDirectory {
@Override
public File getFile(String relativePath) {
- return new File(OpenmrsUtil.getApplicationDataDirectory() + relativePath);
+ String applicationDataDirectory = OpenmrsUtil.getApplicationDataDirectory();
+ if (!applicationDataDirectory.endsWith(File.separator) && !relativePath.startsWith(File.separator)) {
+ applicationDataDirectory += File.separator;
+ }
+ return new File(applicationDataDirectory + relativePath);
}
@Override
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/BahmniConceptDaoImpl.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/BahmniConceptDaoImpl.java
index b119448b85..77ec81ff4b 100644
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/BahmniConceptDaoImpl.java
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/BahmniConceptDaoImpl.java
@@ -1,8 +1,8 @@
package org.bahmni.module.bahmnicore.dao.impl;
import org.bahmni.module.bahmnicore.dao.BahmniConceptDao;
-import org.hibernate.Query;
import org.hibernate.SessionFactory;
+import org.hibernate.query.Query;
import org.hibernate.type.StandardBasicTypes;
import org.openmrs.Concept;
import org.openmrs.ConceptAnswer;
@@ -42,9 +42,9 @@ public Collection searchByQuestion(Concept questionConcept, Strin
Query query = sessionFactory.getCurrentSession().createQuery(
queryStringBuffer.toString());
- query.setEntity("questionConcept", questionConcept);
+ query.setParameter("questionConcept", questionConcept);
for (int i = 0; i < queryArray.length; i++) {
- query.setString("query"+ i, searchBothSidesOf(queryArray[i]));
+ query.setParameter("query"+ i, searchBothSidesOf(queryArray[i]));
}
return new HashSet<>(query.list());
@@ -57,7 +57,7 @@ public Concept getConceptByFullySpecifiedName(String fullySpecifiedConceptName)
"from ConceptName as conceptName " +
"where conceptName.conceptNameType ='FULLY_SPECIFIED' " +
" and lower(conceptName.name)= lower(:fullySpecifiedName)")
- .setString("fullySpecifiedName", fullySpecifiedConceptName)
+ .setParameter("fullySpecifiedName", fullySpecifiedConceptName)
.list();
return concepts.size() > 0 ? concepts.get(0) : null;
@@ -98,6 +98,7 @@ public List getConceptsByFullySpecifiedName(List conceptNames)
.createQuery("select concept " +
"from ConceptName as conceptName " +
"where conceptName.conceptNameType ='FULLY_SPECIFIED' and conceptName.voided = false" +
+ " and conceptName.concept.retired = false" +
" and lower(conceptName.name) in (:conceptNames)").setParameterList("conceptNames", lowerCaseConceptNames).list();
return concepts;
}
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ObsDaoImpl.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ObsDaoImpl.java
index 474d564a60..15a276bee0 100644
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ObsDaoImpl.java
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ObsDaoImpl.java
@@ -15,6 +15,7 @@
import org.openmrs.Person;
import org.openmrs.api.ConceptNameType;
import org.openmrs.api.context.Context;
+import org.openmrs.util.LocaleUtility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -24,6 +25,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import java.util.Locale;
import static java.util.Objects.nonNull;
@@ -77,7 +79,7 @@ public List getObsByPatientAndVisit(String patientUuid, List concep
" where obs.person.uuid = :patientUuid " +
" and cn.concept = obs.concept.conceptId " +
" and cn.name in (:conceptNames) " +
- " and cn.locale = :locale " +
+ " and cn.locale in (:locale) " +
" and cn.conceptNameType = :conceptNameType " +
" and cn.voided = false and obs.voided = false ");
@@ -106,13 +108,18 @@ public List getObsByPatientAndVisit(String patientUuid, List concep
query.append(" order by obs.obsDatetime desc ");
}
+ List localeList = new ArrayList<>();
+ localeList.add(Context.getLocale());
+ if (!LocaleUtility.getDefaultLocale().equals(Context.getLocale())) {
+ localeList.add(LocaleUtility.getDefaultLocale());
+ }
Query queryToGetObservations = sessionFactory.getCurrentSession().createQuery(query.toString());
queryToGetObservations.setMaxResults(limit);
queryToGetObservations.setString("patientUuid", patientUuid);
queryToGetObservations.setParameterList("conceptNames", conceptNames);
queryToGetObservations.setParameter("conceptNameType", ConceptNameType.FULLY_SPECIFIED);
- queryToGetObservations.setString("locale", Context.getLocale().getLanguage());
+ queryToGetObservations.setParameterList("locale", localeList);
if (null != obsIgnoreList && obsIgnoreList.size() > 0) {
queryToGetObservations.setParameterList("obsIgnoreList", obsIgnoreList);
}
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/BahmniEvent.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/BahmniEvent.java
new file mode 100644
index 0000000000..1681c1e017
--- /dev/null
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/BahmniEvent.java
@@ -0,0 +1,26 @@
+package org.bahmni.module.bahmnicore.events;
+
+import org.openmrs.api.context.Context;
+import org.openmrs.api.context.UserContext;
+
+import java.time.LocalDateTime;
+import java.util.UUID;
+
+public class BahmniEvent {
+
+ private static final long version = 1L;
+ public UserContext userContext;
+ public String eventId;
+ public BahmniEventType eventType;
+ public String payloadId;
+ public LocalDateTime publishedDateTime;
+
+ public BahmniEvent(BahmniEventType bahmniEventType) {
+ this.eventType = bahmniEventType;
+ this.eventId = UUID.randomUUID().toString();
+ this.publishedDateTime = LocalDateTime.now();
+ this.userContext= Context.getUserContext();
+ this.payloadId="";
+ }
+}
+
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/BahmniEventType.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/BahmniEventType.java
new file mode 100644
index 0000000000..0f2dd642ce
--- /dev/null
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/BahmniEventType.java
@@ -0,0 +1,16 @@
+package org.bahmni.module.bahmnicore.events;
+
+public enum BahmniEventType {
+ BAHMNI_PATIENT_CREATED("bahmni-patient"),
+ BAHMNI_PATIENT_UPDATED("bahmni-patient"),
+ BAHMNI_ENCOUNTER_CREATED("bahmni-encounter"),
+ BAHMNI_ENCOUNTER_UPDATED("bahmni-encounter");
+
+ private final String topic;
+ BahmniEventType(String topic) {
+ this.topic = topic;
+ }
+ public String topic() {
+ return topic;
+ }
+}
\ No newline at end of file
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/EncounterEvent.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/EncounterEvent.java
new file mode 100644
index 0000000000..a3b0107902
--- /dev/null
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/EncounterEvent.java
@@ -0,0 +1,19 @@
+package org.bahmni.module.bahmnicore.events;
+
+import org.openmrs.Encounter;
+
+public class EncounterEvent extends BahmniEvent {
+
+ private Encounter encounter;
+
+ public EncounterEvent(BahmniEventType bahmniEventType, Encounter encounter) {
+ super(bahmniEventType);
+ this.encounter = encounter;
+ this.payloadId=encounter.getUuid();
+ }
+
+ public Encounter getEncounter() {
+ return encounter;
+ }
+}
+
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/PatientEvent.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/PatientEvent.java
new file mode 100644
index 0000000000..dba79af640
--- /dev/null
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/PatientEvent.java
@@ -0,0 +1,24 @@
+package org.bahmni.module.bahmnicore.events;
+
+import org.openmrs.Patient;
+import org.openmrs.api.context.Context;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.UUID;
+
+public class PatientEvent extends BahmniEvent {
+
+ private Patient patient;
+
+ public PatientEvent(BahmniEventType bahmniEventType, Patient patient) {
+ super(bahmniEventType);
+ this.patient = patient;
+ this.payloadId=patient.getUuid();
+ }
+
+ public Patient getPatient() {
+ return patient;
+ }
+}
+
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/advice/EncounterAdvice.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/advice/EncounterAdvice.java
new file mode 100644
index 0000000000..649a21f563
--- /dev/null
+++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/events/advice/EncounterAdvice.java
@@ -0,0 +1,61 @@
+package org.bahmni.module.bahmnicore.events.advice;
+
+import com.google.common.collect.Sets;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.bahmni.module.bahmnicore.events.BahmniEventType;
+import org.bahmni.module.bahmnicore.events.EncounterEvent;
+import org.bahmni.module.bahmnicore.events.eventPublisher.BahmniEventPublisher;
+import org.openmrs.Encounter;
+import org.openmrs.api.context.Context;
+import org.springframework.aop.AfterReturningAdvice;
+import org.springframework.aop.MethodBeforeAdvice;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import static org.bahmni.module.bahmnicore.events.BahmniEventType.BAHMNI_ENCOUNTER_CREATED;
+import static org.bahmni.module.bahmnicore.events.BahmniEventType.BAHMNI_ENCOUNTER_UPDATED;
+
+
+public class EncounterAdvice implements AfterReturningAdvice, MethodBeforeAdvice {
+
+ private final Logger log = LogManager.getLogger(this.getClass());
+ private final BahmniEventPublisher eventPublisher;
+ private final ThreadLocal
+
+ com.github.stefanbirkner
+ system-rules
+ 1.19.0
+ test
+
org.openmrs.tools
openmrs-tools
@@ -573,7 +587,7 @@
org.bahmni.module
communication-api
- 1.1.0
+ ${communicationVersion}
jar
provided
@@ -586,7 +600,8 @@
org.projectlombok
lombok
- 1.18.20
+ ${lombokVersion}
+ provided
diff --git a/reference-data/api/pom.xml b/reference-data/api/pom.xml
index dfd5de3d37..c2a6f1e29f 100644
--- a/reference-data/api/pom.xml
+++ b/reference-data/api/pom.xml
@@ -5,7 +5,7 @@
reference-data
org.bahmni.module
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
4.0.0
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/LabTest.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/LabTest.java
index 2649702cf4..c71f37da25 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/LabTest.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/LabTest.java
@@ -3,14 +3,18 @@
import org.openmrs.ConceptAnswer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
public class LabTest extends Resource {
private String description;
private String resultType;
private String testUnitOfMeasure;
private Double sortOrder;
- public static final String LAB_TEST_CONCEPT_CLASS = "LabTest";
+
+ public static final List LAB_TEST_CONCEPT_CLASSES = Arrays.asList("LabTest","Test");
+
private Collection codedTestAnswer;
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java
index bdbb789726..fba0a3c334 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/RadiologyTest.java
@@ -1,6 +1,9 @@
package org.bahmni.module.referencedata.labconcepts.contract;
+import java.util.Arrays;
+import java.util.List;
+
public class RadiologyTest extends Resource {
- public static final String RADIOLOGY_TEST_CONCEPT_CLASS = "Radiology";
+ public static final List RADIOLOGY_TEST_CONCEPT_CLASSES = Arrays.asList("Radiology", "Radiology/Imaging Procedure");
public static final String RADIOLOGY_TEST_PARENT_CONCEPT_NAME = "Radiology";
}
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/Sample.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/Sample.java
index f2b5c8728b..84aeda70ed 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/Sample.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/contract/Sample.java
@@ -1,10 +1,11 @@
package org.bahmni.module.referencedata.labconcepts.contract;
+import java.util.Arrays;
import java.util.List;
public class Sample extends Resource {
private String shortName;
- public static final String SAMPLE_CONCEPT_CLASS = "Sample";
+ public static final List SAMPLE_CONCEPT_CLASSES = Arrays.asList("Sample", "Specimen");
private Double sortOrder;
private List tests;
private List panels;
@@ -40,4 +41,4 @@ public Double getSortOrder() {
public void setSortOrder(Double sortOrder) {
this.sortOrder = sortOrder;
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/AllSamplesMapper.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/AllSamplesMapper.java
index d033492f03..29ff54aec6 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/AllSamplesMapper.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/AllSamplesMapper.java
@@ -3,7 +3,7 @@
import org.bahmni.module.referencedata.labconcepts.contract.AllSamples;
import org.openmrs.Concept;
-import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASS;
+import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASSES;
public class AllSamplesMapper extends ResourceMapper {
@@ -18,7 +18,7 @@ public AllSamples map(Concept allSamplesConcept) {
allSamples.setDescription(ConceptExtension.getDescription(allSamplesConcept));
for (Concept setMember : allSamplesConcept.getSetMembers()) {
- if (ConceptExtension.isOfConceptClass(setMember, SAMPLE_CONCEPT_CLASS)) {
+ if (ConceptExtension.isOfAnyConceptClass(setMember, SAMPLE_CONCEPT_CLASSES)) {
SampleMapper sampleMapper = new SampleMapper();
allSamples.addSample(sampleMapper.map(setMember));
}
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptExtension.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptExtension.java
index 0eada53a55..657d7f4a13 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptExtension.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/ConceptExtension.java
@@ -102,11 +102,23 @@ private static boolean isFullySpecifiedName(ConceptName conceptName) {
return ObjectUtils.equals(conceptName.getConceptNameType(), ConceptNameType.FULLY_SPECIFIED);
}
+ private static boolean containsClassName(String conceptClassName, List classNames){
+ for (String className : classNames) {
+ if (className.equalsIgnoreCase(conceptClassName)) {
+ return true;
+ }
+ }
+ return false;
+ }
public static boolean isOfConceptClass(Concept concept, String conceptClassName) {
return concept.getConceptClass() != null && concept.getConceptClass().getName() != null && concept.getConceptClass().getName().equals(conceptClassName);
}
+ public static boolean isOfAnyConceptClass(Concept concept, List conceptClassNames) {
+ return concept.getConceptClass() != null && concept.getConceptClass().getName() != null && containsClassName(concept.getConceptClass().getName(),conceptClassNames);
+ }
+
public static boolean isOfConceptClassByUUID(Concept concept, String conceptClassUUID) {
return concept.getConceptClass() != null && concept.getConceptClass().getUuid().equals(conceptClassUUID);
}
@@ -122,4 +134,15 @@ public static List getResourceReferencesOfConceptClass(List getResourceReferencesOfConceptClasses(List setMembers, List conceptClasses) {
+ ResourceReferenceMapper resourceReferenceMapper = new ResourceReferenceMapper();
+ List resourceReferences = new ArrayList<>();
+ for (Concept setMember : setMembers) {
+ if (isOfAnyConceptClass(setMember, conceptClasses)) {
+ resourceReferences.add(resourceReferenceMapper.map(setMember));
+ }
+ }
+ return resourceReferences;
+ }
+
}
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/DepartmentMapper.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/DepartmentMapper.java
index 45159ca3ee..22fe234cf6 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/DepartmentMapper.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/DepartmentMapper.java
@@ -4,7 +4,7 @@
import org.bahmni.module.referencedata.labconcepts.contract.LabTest;
import org.openmrs.Concept;
-import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.getResourceReferencesOfConceptClass;
+import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.getResourceReferencesOfConceptClasses;
public class DepartmentMapper extends ResourceMapper {
@@ -17,7 +17,7 @@ public Department map(Concept departmentConcept) {
Department department = new Department();
department = mapResource(department, departmentConcept);
department.setDescription(ConceptExtension.getDescriptionOrName(departmentConcept));
- department.setTests(getResourceReferencesOfConceptClass(departmentConcept.getSetMembers(), LabTest.LAB_TEST_CONCEPT_CLASS));
+ department.setTests(getResourceReferencesOfConceptClasses(departmentConcept.getSetMembers(), LabTest.LAB_TEST_CONCEPT_CLASSES));
return department;
}
}
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/PanelMapper.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/PanelMapper.java
index 538e628e31..9555e65a52 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/PanelMapper.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/PanelMapper.java
@@ -14,7 +14,7 @@ public PanelMapper() {
public Panel map(Concept panelConcept) {
Panel panel = new Panel();
panel = mapResource(panel, panelConcept);
- panel.setTests(ConceptExtension.getResourceReferencesOfConceptClass(panelConcept.getSetMembers(), LabTest.LAB_TEST_CONCEPT_CLASS));
+ panel.setTests(ConceptExtension.getResourceReferencesOfConceptClasses(panelConcept.getSetMembers(), LabTest.LAB_TEST_CONCEPT_CLASSES));
panel.setSortOrder(getSortWeight(panelConcept));
panel.setDescription(ConceptExtension.getDescriptionOrName(panelConcept));
return panel;
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/SampleMapper.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/SampleMapper.java
index 8a95d771c4..4dab4563c0 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/SampleMapper.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/SampleMapper.java
@@ -8,6 +8,7 @@
import org.openmrs.api.context.Context;
import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.getResourceReferencesOfConceptClass;
+import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.getResourceReferencesOfConceptClasses;
public class SampleMapper extends ResourceMapper {
public SampleMapper() {
@@ -20,9 +21,9 @@ public Sample map(Concept sampleConcept) {
sample = mapResource(sample, sampleConcept);
sample.setShortName(sampleConcept.getShortestName(Context.getLocale(), false).getName());
sample.setSortOrder(getSortWeight(sampleConcept));
- sample.setTests(getResourceReferencesOfConceptClass(sampleConcept.getSetMembers(), LabTest.LAB_TEST_CONCEPT_CLASS));
+ sample.setTests(getResourceReferencesOfConceptClasses(sampleConcept.getSetMembers(), LabTest.LAB_TEST_CONCEPT_CLASSES));
sample.setPanels(getResourceReferencesOfConceptClass(sampleConcept.getSetMembers(), Panel.LAB_SET_CONCEPT_CLASS));
return sample;
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/TestAndPanelMapper.java b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/TestAndPanelMapper.java
index b1ea11997b..5789fba58a 100644
--- a/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/TestAndPanelMapper.java
+++ b/reference-data/api/src/main/java/org/bahmni/module/referencedata/labconcepts/mapper/TestAndPanelMapper.java
@@ -6,9 +6,8 @@
import org.openmrs.Concept;
import org.openmrs.ConceptClass;
-import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfConceptClass;
-import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfConceptClassByUUID;
+import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASSES;
+import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.*;
public class TestAndPanelMapper extends ResourceMapper {
@@ -31,7 +30,7 @@ public TestsAndPanels map(Concept sampleConcept) {
}
private void addConcept(TestsAndPanels testsAndPanels, Concept concept) {
- if (isOfConceptClass(concept, LAB_TEST_CONCEPT_CLASS)) {
+ if (isOfAnyConceptClass(concept, LAB_TEST_CONCEPT_CLASSES)) {
LabTest test = labTestMapper.map(concept);
testsAndPanels.addTest(test);
} else if (isOfConceptClassByUUID(concept, ConceptClass.LABSET_UUID)) {
@@ -39,4 +38,4 @@ private void addConcept(TestsAndPanels testsAndPanels, Concept concept) {
testsAndPanels.addPanel(panel);
}
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/pom.xml b/reference-data/omod/pom.xml
index f6a61cbc87..8faf11d4f4 100644
--- a/reference-data/omod/pom.xml
+++ b/reference-data/omod/pom.xml
@@ -5,7 +5,7 @@
reference-data
org.bahmni.module
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
4.0.0
diff --git a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEvent.java b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEvent.java
index 9aa4ea3120..06926f13d2 100644
--- a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEvent.java
+++ b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEvent.java
@@ -10,8 +10,8 @@
import java.util.List;
import java.util.UUID;
-import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfConceptClass;
+import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASSES;
+import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfAnyConceptClass;
public class LabTestEvent extends ConceptOperationEvent {
@@ -20,17 +20,16 @@ public LabTestEvent(String url, String category, String title) {
}
public boolean isResourceConcept(Concept concept) {
- return isOfConceptClass(concept, LAB_TEST_CONCEPT_CLASS) || (getParentOfTypeLabTest(concept) != null);
+ return isOfAnyConceptClass(concept, LAB_TEST_CONCEPT_CLASSES) || (getParentOfTypeLabTest(concept) != null);
}
private Concept getParentOfTypeLabTest(Concept concept) {
ConceptHelper conceptHelper = new ConceptHelper(Context.getConceptService());
List parentConcepts = conceptHelper.getParentConcepts(concept);
for (Concept parentConcept : parentConcepts) {
- if (isOfConceptClass(parentConcept, LAB_TEST_CONCEPT_CLASS)) {
+ if (isOfAnyConceptClass(parentConcept, LAB_TEST_CONCEPT_CLASSES)) {
return parentConcept;
}
- ;
}
return null;
}
@@ -38,7 +37,7 @@ private Concept getParentOfTypeLabTest(Concept concept) {
@Override
public Event asAtomFeedEvent(Object[] arguments) throws URISyntaxException {
Concept concept = (Concept) arguments[0];
- if (!isOfConceptClass(concept, LAB_TEST_CONCEPT_CLASS)) {
+ if (!isOfAnyConceptClass(concept, LAB_TEST_CONCEPT_CLASSES)) {
concept = getParentOfTypeLabTest(concept);
}
String url = String.format(this.url, title, concept.getUuid());
diff --git a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java
index 09230a6984..2f98ab8207 100644
--- a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java
+++ b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEvent.java
@@ -2,8 +2,8 @@
import org.openmrs.Concept;
-import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfConceptClass;
+import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASSES;
+import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfAnyConceptClass;
public class RadiologyTestEvent extends ConceptOperationEvent {
@@ -14,7 +14,7 @@ public RadiologyTestEvent(String url, String category, String title) {
@Override
public boolean isResourceConcept(Concept concept) {
- return isOfConceptClass(concept, RADIOLOGY_TEST_CONCEPT_CLASS);
+ return isOfAnyConceptClass(concept, RADIOLOGY_TEST_CONCEPT_CLASSES);
}
diff --git a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java
index 18bf747ae8..f71ea0a580 100644
--- a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java
+++ b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SaleableTypeEvent.java
@@ -9,18 +9,15 @@
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
import static org.bahmni.module.referencedata.labconcepts.contract.AllSamples.ALL_SAMPLES;
import static org.bahmni.module.referencedata.labconcepts.contract.AllTestsAndPanels.ALL_TESTS_AND_PANELS;
import static org.bahmni.module.referencedata.labconcepts.contract.Department.DEPARTMENT_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASS;
+import static org.bahmni.module.referencedata.labconcepts.contract.LabTest.LAB_TEST_CONCEPT_CLASSES;
import static org.bahmni.module.referencedata.labconcepts.contract.Panel.LAB_SET_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASS;
+import static org.bahmni.module.referencedata.labconcepts.contract.RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASSES;
+import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASSES;
public class SaleableTypeEvent implements ConceptServiceOperationEvent {
@@ -31,7 +28,12 @@ public class SaleableTypeEvent implements ConceptServiceOperationEvent {
private final String category;
private List supportedOperations = Arrays.asList("saveConcept", "updateConcept", "retireConcept", "purgeConcept");
- private List unhandledClasses = Arrays.asList(LAB_TEST_CONCEPT_CLASS, LAB_SET_CONCEPT_CLASS, SAMPLE_CONCEPT_CLASS, DEPARTMENT_CONCEPT_CLASS, RADIOLOGY_TEST_CONCEPT_CLASS);
+ private List unhandledClasses = new ArrayList(){{
+ addAll(Arrays.asList(LAB_SET_CONCEPT_CLASS, DEPARTMENT_CONCEPT_CLASS));
+ addAll(LAB_TEST_CONCEPT_CLASSES);
+ addAll(RADIOLOGY_TEST_CONCEPT_CLASSES);
+ addAll(SAMPLE_CONCEPT_CLASSES);
+ }};
private List unhandledConcepsByName = Arrays.asList(ALL_SAMPLES, ALL_TESTS_AND_PANELS);
public SaleableTypeEvent(String url, String category) {
diff --git a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEvent.java b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEvent.java
index 1191423631..fdc69f74c8 100644
--- a/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEvent.java
+++ b/reference-data/omod/src/main/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEvent.java
@@ -2,8 +2,8 @@
import org.openmrs.Concept;
-import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASS;
-import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfConceptClass;
+import static org.bahmni.module.referencedata.labconcepts.contract.Sample.SAMPLE_CONCEPT_CLASSES;
+import static org.bahmni.module.referencedata.labconcepts.mapper.ConceptExtension.isOfAnyConceptClass;
public class SampleEvent extends ConceptOperationEvent {
@@ -14,7 +14,7 @@ public SampleEvent(String url, String category, String title) {
@Override
public boolean isResourceConcept(Concept concept) {
- return isOfConceptClass(concept, SAMPLE_CONCEPT_CLASS);
+ return isOfAnyConceptClass(concept, SAMPLE_CONCEPT_CLASSES);
}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/advice/ConceptServiceEventInterceptorTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/advice/ConceptServiceEventInterceptorTest.java
index 346d7cb4e7..033defa11e 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/advice/ConceptServiceEventInterceptorTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/advice/ConceptServiceEventInterceptorTest.java
@@ -55,7 +55,7 @@ public class ConceptServiceEventInterceptorTest {
public void setup() {
MockitoAnnotations.initMocks(this);
- concept = new ConceptBuilder().withClass(Sample.SAMPLE_CONCEPT_CLASS).withUUID(SampleEventTest.SAMPLE_CONCEPT_UUID).build();
+ concept = new ConceptBuilder().withClass(Sample.SAMPLE_CONCEPT_CLASSES.get(0)).withUUID(SampleEventTest.SAMPLE_CONCEPT_UUID).build();
Concept parentConcept = new ConceptBuilder().withName(AllSamples.ALL_SAMPLES).withSetMember(concept).build();
@@ -143,4 +143,4 @@ public void shouldSaveEventInTheSameTransactionAsTheTrigger() throws Throwable {
assertEquals(AFTransactionWork.PropagationDefinition.PROPAGATION_REQUIRED, captor.getValue().getTxPropagationDefinition());
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/AllTestsPanelsConceptSetEventTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/AllTestsPanelsConceptSetEventTest.java
index 753f3f7cff..6ab6cfea55 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/AllTestsPanelsConceptSetEventTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/AllTestsPanelsConceptSetEventTest.java
@@ -46,7 +46,7 @@ public void setUp() {
PowerMockito.mockStatic(Context.class);
when(Context.getLocale()).thenReturn(defaultLocale);
when(Context.getConceptService()).thenReturn(conceptService);
- testConcept = new ConceptBuilder().withClass(LabTest.LAB_TEST_CONCEPT_CLASS).build();
+ testConcept = new ConceptBuilder().withClass(LabTest.LAB_TEST_CONCEPT_CLASSES.get(0)).build();
panelConcept = new ConceptBuilder().withClassUUID(ConceptClass.LABSET_UUID).build();
parentConcept = new ConceptBuilder().withName(AllTestsAndPanels.ALL_TESTS_AND_PANELS).withClass("ConvSet").withSetMember(testConcept).withSetMember(panelConcept).build();
}
@@ -60,4 +60,4 @@ public void shouldCreateOneEventForAllTestsAndPanelsAndSetMembers() throws Excep
assertEquals(ConceptServiceEventFactory.TESTS_AND_PANEL, event.getTitle());
assertEquals("lab", event.getCategory());
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEventTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEventTest.java
index dce35e3e2c..bd489ac4be 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEventTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/LabTestEventTest.java
@@ -34,8 +34,10 @@
@RunWith(PowerMockRunner.class)
public class LabTestEventTest {
public static final String TEST_CONCEPT_UUID = "aebc57b7-0683-464e-ac48-48b8838abdfc";
+ public static final String LAB_TEST_CONCEPT_UUID = "9b11d2d1-c7ea-40f7-8616-be9bec4c6bb7";
- private Concept concept;
+ private Concept conceptWithLabTestClass;
+ private Concept conceptWithTestClass;
@Mock
private ConceptService conceptService;
@@ -45,11 +47,13 @@ public class LabTestEventTest {
public void setup() {
MockitoAnnotations.initMocks(this);
- concept = new ConceptBuilder().withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withUUID(TEST_CONCEPT_UUID).build();
+ conceptWithLabTestClass = new ConceptBuilder().withClass("LabTest").withUUID(LAB_TEST_CONCEPT_UUID).build();
+ conceptWithTestClass = new ConceptBuilder().withClass("Test").withUUID(TEST_CONCEPT_UUID).build();
- parentConcept = new ConceptBuilder().withName(AllTestsAndPanels.ALL_TESTS_AND_PANELS).withSetMember(concept).build();
+ parentConcept = new ConceptBuilder().withName(AllTestsAndPanels.ALL_TESTS_AND_PANELS).withSetMember(conceptWithLabTestClass).build();
+ parentConcept.addSetMember(conceptWithTestClass);
- List conceptSets = getConceptSets(parentConcept, concept);
+ List conceptSets = getConceptSets(parentConcept, conceptWithLabTestClass);
when(conceptService.getSetsContainingConcept(any(Concept.class))).thenReturn(conceptSets);
@@ -61,26 +65,43 @@ public void setup() {
@Test
- public void createEventForTestEvent() throws Exception {
- Event event = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept}).get(0);
- Event anotherEvent = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept}).get(0);
- assertNotNull(event);
- assertFalse(event.getUuid().equals(anotherEvent.getUuid()));
- assertEquals(event.getTitle(), ConceptServiceEventFactory.TEST);
- assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB);
+ public void createEventForTestEventIfConceptClassIsLabTestOrTest() throws Exception {
+ Event eventForLabTestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithLabTestClass}).get(0);
+ Event anotherEventForLabTestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithLabTestClass}).get(0);
+ Event eventForTestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithTestClass}).get(0);
+ Event anotherEventForTestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithTestClass}).get(0);
+ assertNotNull(eventForLabTestConceptClass);
+ assertNotNull(eventForTestConceptClass);
+ assertFalse(eventForLabTestConceptClass.getUuid().equals(anotherEventForLabTestConceptClass.getUuid()));
+ assertEquals(eventForLabTestConceptClass.getTitle(), ConceptServiceEventFactory.TEST);
+ assertEquals(eventForLabTestConceptClass.getCategory(), ConceptServiceEventFactory.LAB);
+ assertFalse(eventForTestConceptClass.getUuid().equals(anotherEventForTestConceptClass.getUuid()));
+ assertEquals(eventForTestConceptClass.getTitle(), ConceptServiceEventFactory.TEST);
+ assertEquals(eventForTestConceptClass.getCategory(), ConceptServiceEventFactory.LAB);
+ }
+
+ @Test
+ public void shouldCreateEventForCaseInsensitiveConceptClassMatches() throws Exception {
+ Concept conceptWithClassLabTest = new ConceptBuilder().withClass("LabTest").withUUID(LAB_TEST_CONCEPT_UUID).build();
+ Concept conceptWithClasslabtest = new ConceptBuilder().withClass("labtest").withUUID("9b11d2d1-c7ea-40f7-8616-be9bec4c6b98").build();
+ Event eventForLabTestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithClassLabTest}).get(0);
+ Event eventForlabtestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithClasslabtest}).get(0);
+ assertNotNull(eventForLabTestConceptClass);
+ assertNotNull(eventForlabtestConceptClass);
+
}
@Test
public void shouldNotCreateEventForTestEventIfThereIsDifferentConceptClass() throws Exception {
- concept = new ConceptBuilder().withClassUUID("some").withClass("some").withUUID(TEST_CONCEPT_UUID).build();
- List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept});
+ conceptWithLabTestClass = new ConceptBuilder().withClassUUID("some").withClass("some").withUUID(TEST_CONCEPT_UUID).build();
+ List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithLabTestClass});
assertTrue(events.isEmpty());
}
@Test
public void shouldCreateEventForTestEventIfParentConceptIsMissing() throws Exception {
when(conceptService.getSetsContainingConcept(any(Concept.class))).thenReturn(new ArrayList());
- List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept});
+ List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithLabTestClass});
Event event = events.get(0);
assertNotNull(event);
assertEquals(event.getTitle(), ConceptServiceEventFactory.TEST);
@@ -90,9 +111,9 @@ public void shouldCreateEventForTestEventIfParentConceptIsMissing() throws Excep
@Test
public void shouldCreateEventForTestEventIfParentConceptIsWrong() throws Exception {
- parentConcept = new ConceptBuilder().withName("Some wrong name").withSetMember(concept).build();
- when(conceptService.getSetsContainingConcept(any(Concept.class))).thenReturn(getConceptSets(parentConcept, concept));
- List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept});
+ parentConcept = new ConceptBuilder().withName("Some wrong name").withSetMember(conceptWithLabTestClass).build();
+ when(conceptService.getSetsContainingConcept(any(Concept.class))).thenReturn(getConceptSets(parentConcept, conceptWithLabTestClass));
+ List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithLabTestClass});
Event event = events.get(0);
assertNotNull(event);
assertEquals(event.getTitle(), ConceptServiceEventFactory.TEST);
@@ -102,7 +123,7 @@ public void shouldCreateEventForTestEventIfParentConceptIsWrong() throws Excepti
@Test
public void createEventForTestWithParentConceptMissing() throws Exception {
- Concept testConcept = new ConceptBuilder().withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withUUID("testUUID").withClass("LabTest").build();
+ Concept testConcept = new ConceptBuilder().withUUID("testUUID").withClass("LabTest").build();
List events = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{testConcept});
Event event = events.get(0);
assertNotNull(event);
@@ -110,4 +131,4 @@ public void createEventForTestWithParentConceptMissing() throws Exception {
assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB);
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java
index c72fc7e58c..5292c26af8 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/RadiologyTestEventTest.java
@@ -70,6 +70,17 @@ public void createEventForSampleEvent() throws Exception {
}
+ @Test
+ public void shouldCreateEventWhenClassIsRadiologyImagingProcedure() throws Exception{
+ concept = new ConceptBuilder().withClass("Radiology/Imaging Procedure").withUUID(RADIOLOGY_TEST_CONCEPT_UUID).build();
+ Event event = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept}).get(0);
+ Event anotherEvent = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{concept}).get(0);
+ assertNotNull(event);
+ assertFalse(event.getUuid().equals(anotherEvent.getUuid()));
+ assertEquals(event.getTitle(), ConceptServiceEventFactory.RADIOLOGY);
+ assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB);
+ }
+
@Test
public void shouldNotCreateEventForRadiologyEventIfThereIsDifferentConceptClass() throws Exception {
concept = new ConceptBuilder().withClass("random").withClassUUID("some").withUUID(RADIOLOGY_TEST_CONCEPT_UUID).build();
@@ -109,4 +120,4 @@ public void createEventForRadiologyTestWithParentConceptMissing() throws Excepti
assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB);
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEventTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEventTest.java
index 43e60125ad..ec2b778f71 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEventTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/labconcepts/model/event/SampleEventTest.java
@@ -34,8 +34,12 @@
public class SampleEventTest {
public static final String SAMPLE_CONCEPT_UUID = "aebc57b7-0683-464e-ac48-48b8838abdfc";
+ public static final String SPECIMEN_CONCEPT_UUID = "aebc57b7-0683-464e-ac48-48b8838abdff";
+
private Concept concept;
+ private Concept specimenConcept;
+
@Mock
private ConceptService conceptService;
private Concept parentConcept;
@@ -46,6 +50,8 @@ public void setup() {
concept = new ConceptBuilder().withClass("Sample").withUUID(SAMPLE_CONCEPT_UUID).build();
+ specimenConcept = new ConceptBuilder().withClass("Specimen").withUUID(SPECIMEN_CONCEPT_UUID).build();
+
parentConcept = new ConceptBuilder().withName(AllSamples.ALL_SAMPLES).withSetMember(concept).build();
List conceptSets = getConceptSets(parentConcept, concept);
@@ -69,6 +75,16 @@ public void createEventForSampleEvent() throws Exception {
assertEquals(event.getCategory(), "lab");
}
+ @Test
+ public void createSampleEventForSpecimenConcept() throws Exception {
+ Event event = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{specimenConcept}).get(0);
+ Event anotherEvent = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{specimenConcept}).get(0);
+ assertNotNull(event);
+ assertFalse(event.getUuid().equals(anotherEvent.getUuid()));
+ assertEquals(event.getTitle(), "sample");
+ assertEquals(event.getCategory(), "lab");
+ }
+
@Test
public void shouldNotCreateEventForSampleEventIfThereIsDifferentConceptClass() throws Exception {
concept = new ConceptBuilder().withClass("procedure").withClassUUID("some").withUUID(SAMPLE_CONCEPT_UUID).build();
@@ -106,4 +122,4 @@ public void createEventForSampleWithParentConceptMissing() throws Exception {
assertEquals(event.getCategory(), ConceptServiceEventFactory.LAB);
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllSamplesMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllSamplesMapperTest.java
index 921dd8ca41..053e3e5ff7 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllSamplesMapperTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllSamplesMapperTest.java
@@ -36,6 +36,7 @@ public class AllSamplesMapperTest {
private AllSamplesMapper allSamplesMapper;
private SampleMapper sampleMapper;
private Concept sampleConcept;
+ private Concept specimenConcept;
private Date dateCreated;
private Date dateChanged;
private Concept labSampleConceptSet;
@@ -56,15 +57,20 @@ public void setUp() throws Exception {
Locale defaultLocale = new Locale("en", "GB");
PowerMockito.mockStatic(Context.class);
when(Context.getLocale()).thenReturn(defaultLocale);
- Concept testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withDescription("SomeDescription")
+ Concept testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASSES.get(0)).withDescription("SomeDescription")
.withDateChanged(dateChanged).withShortName("ShortName").withName("Test concept").withDataType(ConceptDatatype.NUMERIC).build();
- sampleConcept = new ConceptBuilder().withUUID("Sample UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASS).
+ sampleConcept = new ConceptBuilder().withUUID("Sample UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASSES.get(0)).
withDateChanged(dateChanged).withSetMember(testConcept).withShortName("ShortName").withName("SampleName").build();
+ specimenConcept = new ConceptBuilder().withUUID("Specimen UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASSES.get(1)).
+ withDateChanged(dateChanged).withSetMember(testConcept).withShortName("SpecimenShortName").withName("SpecimenName").build();
+
labSampleConceptSet = new ConceptBuilder().withUUID("Lab Samples UUID").withDateCreated(dateCreated).withDateChanged(dateChanged)
.withName(AllSamples.ALL_SAMPLES).withClassUUID(ConceptClass.LABSET_UUID).withShortName("Lab samples short name").withDescription("Lab samples Description")
- .withSetMember(sampleConcept).build();
+ .withSetMember(sampleConcept)
+ .withSetMember(specimenConcept)
+ .build();
when(Context.getConceptService()).thenReturn(conceptService);
}
@@ -80,7 +86,7 @@ public void mapAllSampleFieldsFromConcept() throws Exception {
assertEquals(dateChanged, labSamplesData.getLastUpdated());
assertEquals("Lab samples Description", labSamplesData.getDescription());
List samples = labSamplesData.getSamples();
- assertEquals(1, samples.size());
+ assertEquals(2, samples.size());
assertEquals(sampleData.getId(), samples.get(0).getId());
}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllTestsAndPanelsMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllTestsAndPanelsMapperTest.java
index 4d743c0aeb..3335cfa7ce 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllTestsAndPanelsMapperTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/AllTestsAndPanelsMapperTest.java
@@ -58,7 +58,7 @@ public void setUp() throws Exception {
PowerMockito.mockStatic(Context.class);
when(Context.getLocale()).thenReturn(defaultLocale);
- testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withDescription("SomeDescription")
+ testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASSES.get(0)).withDescription("SomeDescription")
.withDateChanged(dateChanged).withShortName("ShortName").withName("Test concept").withDataType(ConceptDatatype.NUMERIC).build();
panelConcept = new ConceptBuilder().withUUID("Panel UUID").withDateCreated(dateCreated).withClassUUID(ConceptClass.LABSET_UUID).withDescription("SomeDescription")
@@ -94,7 +94,7 @@ public void mapAllTestsAndPanelsFieldsFromConcept() throws Exception {
@Test
public void shouldNotMapTheTestOrPanelWhichIsRetired() throws Exception {
- Concept testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withDescription("SomeDescription")
+ Concept testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASSES.get(0)).withDescription("SomeDescription")
.withDateChanged(dateChanged).withShortName("ShortName").withName("Test concept").withDataType(ConceptDatatype.NUMERIC).withRetired(true).build();
Concept panelConcept = new ConceptBuilder().withUUID("Panel UUID").withDateCreated(dateCreated).withClassUUID(ConceptClass.LABSET_UUID).withDescription("SomeDescription")
.withSetMember(testConcept).withDateChanged(dateChanged).withShortName("ShortName").withName("Panel Name").withDataType(ConceptDatatype.NUMERIC).withRetired(true).build();
@@ -115,4 +115,4 @@ public void shouldNotMapTheTestOrPanelWhichIsRetired() throws Exception {
Set panels = testsAndPanels.getPanels();
assertEquals(0, panels.size());
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/LabTestMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/LabTestMapperTest.java
index c559afd8f4..fcf243d440 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/LabTestMapperTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/LabTestMapperTest.java
@@ -65,11 +65,11 @@ public void setUp() throws Exception {
Locale defaultLocale = new Locale("en", "GB");
PowerMockito.mockStatic(Context.class);
when(Context.getLocale()).thenReturn(defaultLocale);
- testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withDescription("SomeDescription")
+ testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASSES.get(0)).withDescription("SomeDescription")
.withDateChanged(dateChanged).withShortName("ShortName").withName("Test Name Here").withDataType(ConceptDatatype.NUMERIC).build();
Concept testAndPanelsConcept = new ConceptBuilder().withUUID("Test and Panels UUID").withDateCreated(dateCreated).withClassUUID(ConceptClass.CONVSET_UUID)
.withDateChanged(dateChanged).withShortName("ShortName").withName(AllTestsAndPanels.ALL_TESTS_AND_PANELS).withSetMember(testConcept).build();
- Concept sampleConcept = new ConceptBuilder().withUUID("Sample UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASS).
+ Concept sampleConcept = new ConceptBuilder().withUUID("Sample UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASSES.get(0)).
withDateChanged(dateChanged).withSetMember(testConcept).withShortName("ShortName").withName("SampleName").build();
Concept laboratoryConcept = new ConceptBuilder().withUUID("Laboratory UUID")
.withName(AllSamples.ALL_SAMPLES).withClassUUID(ConceptClass.LABSET_UUID)
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/PanelMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/PanelMapperTest.java
index d36951de14..843d8ef327 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/PanelMapperTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/PanelMapperTest.java
@@ -63,13 +63,13 @@ public void setUp() throws Exception {
Locale defaultLocale = new Locale("en", "GB");
PowerMockito.mockStatic(Context.class);
when(Context.getLocale()).thenReturn(defaultLocale);
- testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASS).withDescription("SomeDescription")
+ testConcept = new ConceptBuilder().withUUID("Test UUID").withDateCreated(dateCreated).withClass(LabTest.LAB_TEST_CONCEPT_CLASSES.get(0)).withDescription("SomeDescription")
.withDateChanged(dateChanged).withShortName("ShortName").withName("Panel Name Here").withDataType(ConceptDatatype.NUMERIC).build();
panelConcept = new ConceptBuilder().withUUID("Panel UUID").withDateCreated(dateCreated).withClassUUID(ConceptClass.LABSET_UUID).withDescription("SomeDescription")
.withSetMember(testConcept).withDateChanged(dateChanged).withShortName("ShortName").withName("Panel Name Here").withDataType(ConceptDatatype.NUMERIC).build();
Concept testAndPanelsConcept = new ConceptBuilder().withUUID("Test and Panels UUID").withDateCreated(dateCreated).withClassUUID(ConceptClass.CONVSET_UUID)
.withDateChanged(dateChanged).withShortName("ShortName").withName(AllTestsAndPanels.ALL_TESTS_AND_PANELS).withSetMember(panelConcept).build();
- Concept sampleConcept = new ConceptBuilder().withUUID("Sample UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASS).
+ Concept sampleConcept = new ConceptBuilder().withUUID("Sample UUID").withDateCreated(dateCreated).withClass(Sample.SAMPLE_CONCEPT_CLASSES.get(0)).
withDateChanged(dateChanged).withSetMember(panelConcept).withShortName("ShortName").withName("SampleName").build();
Concept departmentConcept = new ConceptBuilder().withUUID("Department UUID").withDateCreated(dateCreated).
withDateChanged(dateChanged).withClass("Department").withClassUUID(ConceptClass.CONVSET_UUID).withSetMember(panelConcept).withDescription("Some Description").withName("Department Name").build();
@@ -129,4 +129,4 @@ public void shouldSetNameIfDescriptionIsNull() throws Exception {
Panel panelData = panelMapper.map(panelConceptWithoutDescription);
assertEquals("Panel Name Here", panelData.getDescription());
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java
index dd3085dc7f..404fe03d0a 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/RadiologyTestMapperTest.java
@@ -46,7 +46,7 @@ public void setUp() throws Exception {
PowerMockito.mockStatic(Context.class);
when(Context.getLocale()).thenReturn(defaultLocale);
- radiologyConcept = new ConceptBuilder().withUUID("RadiologyUUID").withDateCreated(dateCreated).withClass(RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASS).
+ radiologyConcept = new ConceptBuilder().withUUID("RadiologyUUID").withDateCreated(dateCreated).withClass(RadiologyTest.RADIOLOGY_TEST_CONCEPT_CLASSES.get(0)).
withDateChanged(dateChanged).withShortName("clavicle - right, 2 views (x-ray)").withName("Clavicle - Right, 2 views (X-ray)").build();
when(Context.getConceptService()).thenReturn(conceptService);
@@ -62,4 +62,4 @@ public void mapNameOfRadiologyTestFromConcept() throws Exception {
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/SampleMapperTest.java b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/SampleMapperTest.java
index 429c5bbd7e..c26faf015e 100644
--- a/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/SampleMapperTest.java
+++ b/reference-data/omod/src/test/java/org/bahmni/module/referencedata/web/contract/mapper/SampleMapperTest.java
@@ -55,7 +55,7 @@ public void setUp() {
when(Context.getLocale()).thenReturn(defaultLocale);
sampleConcept = new ConceptBuilder().forSample().withShortName("ShortName").build();
allSamplesConcept = new ConceptBuilder().withUUID("Laboratory UUID")
- .withName(AllSamples.ALL_SAMPLES).withClass(Sample.SAMPLE_CONCEPT_CLASS)
+ .withName(AllSamples.ALL_SAMPLES).withClass(Sample.SAMPLE_CONCEPT_CLASSES.get(0))
.withSetMember(sampleConcept).build();
ConceptSet conceptSet = createConceptSet(allSamplesConcept, sampleConcept);
sortOrder = Double.valueOf(22);
@@ -120,4 +120,4 @@ public void mapPanelsFromConceptSetMembers(){
assertEquals(1, sample.getPanels().size());
assertEquals("PanelName", sample.getPanels().get(0).getName());
}
-}
\ No newline at end of file
+}
diff --git a/reference-data/pom.xml b/reference-data/pom.xml
index f88b2d7f5a..7be9238c15 100644
--- a/reference-data/pom.xml
+++ b/reference-data/pom.xml
@@ -10,7 +10,7 @@
org.bahmni.module
bahmni
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
reference-data
pom
diff --git a/vagrant-deploy/pom.xml b/vagrant-deploy/pom.xml
index 8cab186dde..ca6d5624a6 100644
--- a/vagrant-deploy/pom.xml
+++ b/vagrant-deploy/pom.xml
@@ -5,7 +5,7 @@
bahmni
org.bahmni.module
- 1.1.0.ipd-SNAPSHOT
+ 1.3.0.ipd-SNAPSHOT
4.0.0