Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanko committed Apr 16, 2021
1 parent 4e8ac11 commit 842c3bd
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api-2.1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>fhir2</artifactId>
<groupId>org.openmrs.module</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion api-2.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>fhir2</artifactId>
<groupId>org.openmrs.module</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>

<artifactId>fhir2-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.openmrs.PatientIdentifier;
import org.openmrs.PatientIdentifierType;
import org.openmrs.module.fhir2.FhirConstants;
import org.openmrs.module.fhir2.api.FhirGlobalPropertyService;
import org.openmrs.module.fhir2.api.FhirPatientService;
import org.openmrs.module.fhir2.api.dao.FhirLocationDao;
import org.openmrs.module.fhir2.api.translators.PatientIdentifierTranslator;
Expand All @@ -28,7 +29,6 @@

@Component
@Setter(AccessLevel.PACKAGE)
// TODO Create proper "System" value
public class PatientIdentifierTranslatorImpl extends BaseReferenceHandlingTranslator implements PatientIdentifierTranslator {

@Autowired
Expand All @@ -37,6 +37,9 @@ public class PatientIdentifierTranslatorImpl extends BaseReferenceHandlingTransl
@Autowired
private FhirLocationDao locationDao;

@Autowired
private FhirGlobalPropertyService globalPropertyService;

@Override
public Identifier toFhirResource(@Nonnull PatientIdentifier identifier) {
if (identifier == null || identifier.getVoided()) {
Expand Down Expand Up @@ -64,6 +67,13 @@ public Identifier toFhirResource(@Nonnull PatientIdentifier identifier) {
.setValue(createLocationReference(identifier.getLocation()));
}

if (globalPropertyService.getGlobalProperty(FhirConstants.GLOBAL_PROPERTY_URI_PREFIX) != null
&& !globalPropertyService.getGlobalProperty(FhirConstants.GLOBAL_PROPERTY_URI_PREFIX).isEmpty()
&& identifier.getIdentifierType() != null) {

patientIdentifier.setSystem(globalPropertyService.getGlobalProperty(FhirConstants.GLOBAL_PROPERTY_URI_PREFIX)
+ '/' + identifier.getIdentifierType().getId() + '-' + identifier.getIdentifierType().getName());
}
return patientIdentifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ public Patient toFhirResource(@Nonnull org.openmrs.Patient openmrsPatient) {
patient.addIdentifier(identifierTranslator.toFhirResource(identifier));
}

patient.addIdentifier().setSystem("urn:ietf:rfc:3986").setValue(
globalPropertyService.getGlobalProperty(FhirConstants.GLOBAL_PROPERTY_URI_PREFIX, "http://openmrs.org") + '/'
+ openmrsPatient.getUuid());

for (PersonName name : openmrsPatient.getNames()) {
patient.addName(nameTranslator.toFhirResource(name));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.mockito.junit.MockitoJUnitRunner;
import org.openmrs.PatientIdentifier;
import org.openmrs.PatientIdentifierType;
import org.openmrs.module.fhir2.api.FhirGlobalPropertyService;
import org.openmrs.module.fhir2.api.FhirPatientService;

@RunWith(MockitoJUnitRunner.class)
Expand All @@ -43,10 +44,14 @@ public class PatientIdentifierTranslatorImplTest {
@Mock
private FhirPatientService patientService;

@Mock
private FhirGlobalPropertyService globalPropertyService;

@Before
public void setup() {
identifierTranslator = new PatientIdentifierTranslatorImpl();
identifierTranslator.setPatientService(patientService);
identifierTranslator.setGlobalPropertyService(globalPropertyService);
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion integration-tests-2.1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>fhir2</artifactId>
<groupId>org.openmrs.module</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion integration-tests-2.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>fhir2</artifactId>
<groupId>org.openmrs.module</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>fhir2</artifactId>
<groupId>org.openmrs.module</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>

<artifactId>fhir2-omod</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.openmrs.module</groupId>
<artifactId>fhir2</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>FHIR2</name>
<description>Implementation of FHIR R4 for OpenMRS</description>
Expand Down
2 changes: 1 addition & 1 deletion test-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>fhir2</artifactId>
<groupId>org.openmrs.module</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 842c3bd

Please sign in to comment.