Correctly index timing events
This commit is contained in:
parent
f6c7ff1dbb
commit
be06c2ee19
|
@ -1,37 +1,11 @@
|
|||
package ca.uhn.fhir.jpa.dao.dstu3;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.util.TestUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.*;
|
||||
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem;
|
||||
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
|
||||
import org.hl7.fhir.dstu3.model.Observation.ObservationStatus;
|
||||
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType;
|
||||
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
import org.junit.*;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import ca.uhn.fhir.jpa.dao.*;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.util.TestUtil;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.parser.StrictErrorHandler;
|
||||
|
@ -41,6 +15,41 @@ import ca.uhn.fhir.rest.api.SortSpec;
|
|||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.param.*;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.BundleType;
|
||||
import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
|
||||
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem;
|
||||
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
|
||||
import org.hl7.fhir.dstu3.model.Observation.ObservationStatus;
|
||||
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType;
|
||||
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
||||
|
@ -72,7 +81,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
|
||||
assertThat(ids, contains(moId.getValue()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEmptyChain() {
|
||||
|
||||
|
@ -91,7 +100,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
sub1.setActive(true);
|
||||
sub1.addIdentifier().setSystem("foo").setValue("bar");
|
||||
String sub1Id = myPatientDao.create(sub1).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
|
||||
Group sub2 = new Group();
|
||||
sub2.setActive(true);
|
||||
sub2.addIdentifier().setSystem("foo").setValue("bar");
|
||||
|
@ -100,7 +109,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
Encounter enc1 = new Encounter();
|
||||
enc1.getSubject().setReference(sub1Id);
|
||||
String enc1Id = myEncounterDao.create(enc1).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
|
||||
Encounter enc2 = new Encounter();
|
||||
enc2.getSubject().setReference(sub2Id);
|
||||
String enc2Id = myEncounterDao.create(enc2).getId().toUnqualifiedVersionless().getValue();
|
||||
|
@ -108,7 +117,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
List<String> ids;
|
||||
SearchParameterMap map;
|
||||
IBundleProvider results;
|
||||
|
||||
|
||||
map = new SearchParameterMap();
|
||||
map.add(Encounter.SP_SUBJECT, new ReferenceParam("subject", "foo|bar").setChain("identifier"));
|
||||
results = myEncounterDao.search(map);
|
||||
|
@ -398,10 +407,10 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
IIdType id = myEncounterDao.create(order, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
List<IIdType> actual = toUnqualifiedVersionlessIds(
|
||||
myEncounterDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Encounter.SP_LOCATION_PERIOD, new DateParam("2011-12-12T11:12:12Z"))));
|
||||
myEncounterDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Encounter.SP_LOCATION_PERIOD, new DateParam("2011-12-12T11:12:12Z"))));
|
||||
assertThat(actual, contains(id));
|
||||
|
||||
runInTransaction(()->{
|
||||
runInTransaction(() -> {
|
||||
Class<ResourceIndexedSearchParamDate> type = ResourceIndexedSearchParamDate.class;
|
||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList();
|
||||
ourLog.info(toStringMultiline(results));
|
||||
|
@ -425,7 +434,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
List<IIdType> actual = toUnqualifiedVersionlessIds(myImmunizationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Immunization.SP_DOSE_SEQUENCE, new NumberParam("1"))));
|
||||
assertThat(actual, contains(id));
|
||||
|
||||
runInTransaction(()-> {
|
||||
runInTransaction(() -> {
|
||||
Class<ResourceIndexedSearchParamNumber> type = ResourceIndexedSearchParamNumber.class;
|
||||
List<?> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
||||
ourLog.info(toStringMultiline(results));
|
||||
|
@ -449,7 +458,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertEquals(2, results.size());
|
||||
|
||||
List<IIdType> actual = toUnqualifiedVersionlessIds(
|
||||
mySubstanceDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Substance.SP_QUANTITY, new QuantityParam((ParamPrefixEnum) null, 123, "http://foo", "UNIT"))));
|
||||
mySubstanceDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Substance.SP_QUANTITY, new QuantityParam((ParamPrefixEnum) null, 123, "http://foo", "UNIT"))));
|
||||
assertThat(actual, contains(id));
|
||||
}
|
||||
|
||||
|
@ -478,7 +487,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertEquals(2, results.size());
|
||||
|
||||
List<IIdType> actual = toUnqualifiedVersionlessIds(
|
||||
myProcedureRequestDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ProcedureRequest.SP_REPLACES, new ReferenceParam("Practitioner/somepract"))));
|
||||
myProcedureRequestDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ProcedureRequest.SP_REPLACES, new ReferenceParam("Practitioner/somepract"))));
|
||||
assertThat(actual, contains(id));
|
||||
}
|
||||
|
||||
|
@ -874,6 +883,27 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchDate_TimingValueUsingPeriod() {
|
||||
ProcedureRequest p1 = new ProcedureRequest();
|
||||
p1.setOccurrence(new Timing());
|
||||
p1.getOccurrenceTiming().getRepeat().setBounds(new Period());
|
||||
p1.getOccurrenceTiming().getRepeat().getBoundsPeriod().getStartElement().setValueAsString("2018-01-01");
|
||||
p1.getOccurrenceTiming().getRepeat().getBoundsPeriod().getEndElement().setValueAsString("2018-02-01");
|
||||
String id1 = myProcedureRequestDao.create(p1).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
{
|
||||
SearchParameterMap map = new SearchParameterMap()
|
||||
.setLoadSynchronous(true)
|
||||
.add(ProcedureRequest.SP_OCCURRENCE, new DateParam("lt2019"));
|
||||
IBundleProvider found = myProcedureRequestDao.search(map);
|
||||
assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1));
|
||||
assertEquals(1, found.size().intValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchDateWrongParam() {
|
||||
Patient p1 = new Patient();
|
||||
|
@ -1171,8 +1201,8 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertThat(patients, (hasItems(id1a, id1b)));
|
||||
assertThat(patients, not(hasItems(id2)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
params.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, beforeR2)));
|
||||
|
@ -1247,7 +1277,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
|
||||
map = new SearchParameterMap();
|
||||
map.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.GREATERTHAN, startDateTime.getValue()),
|
||||
new DateParam(ParamPrefixEnum.LESSTHAN, myPatientDao.read(id1b, mySrd).getMeta().getLastUpdatedElement().getValue())));
|
||||
new DateParam(ParamPrefixEnum.LESSTHAN, myPatientDao.read(id1b, mySrd).getMeta().getLastUpdatedElement().getValue())));
|
||||
ourLog.info("Searching: {}", map.getLastUpdated());
|
||||
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), containsInAnyOrder(id1a));
|
||||
}
|
||||
|
@ -1388,7 +1418,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
|
||||
{
|
||||
IBundleProvider found = myPatientDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_GENDER, new TokenParam().setModifier(TokenParamModifier.IN).setValue("urn:testSearchOnCodesWithNone")));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_GENDER, new TokenParam().setModifier(TokenParamModifier.IN).setValue("urn:testSearchOnCodesWithNone")));
|
||||
assertThat(toUnqualifiedVersionlessIdValues(found), empty());
|
||||
assertEquals(0, found.size().intValue());
|
||||
}
|
||||
|
@ -1526,10 +1556,10 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
dr01.setSubject(new Reference(patientId01));
|
||||
IIdType drId01 = myDiagnosticReportDao.create(dr01, mySrd).getId();
|
||||
|
||||
ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", new Object[] { patientId01, patientId02, obsId01, obsId02, drId01 });
|
||||
ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", new Object[]{patientId01, patientId02, obsId01, obsId02, drId01});
|
||||
|
||||
List<Observation> result = toList(myObservationDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChain01"))));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChain01"))));
|
||||
assertEquals(1, result.size());
|
||||
assertEquals(obsId01.getIdPart(), result.get(0).getIdElement().getIdPart());
|
||||
|
||||
|
@ -1543,15 +1573,15 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertEquals(0, result.size());
|
||||
|
||||
result = toList(myObservationDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChainXX"))));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChainXX"))));
|
||||
assertEquals(2, result.size());
|
||||
|
||||
result = toList(
|
||||
myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "testSearchResourceLinkWithChainXX"))));
|
||||
myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "testSearchResourceLinkWithChainXX"))));
|
||||
assertEquals(2, result.size());
|
||||
|
||||
result = toList(
|
||||
myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "|testSearchResourceLinkWithChainXX"))));
|
||||
myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "|testSearchResourceLinkWithChainXX"))));
|
||||
assertEquals(0, result.size());
|
||||
|
||||
}
|
||||
|
@ -1631,18 +1661,18 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
Date after = new Date();
|
||||
ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick();
|
||||
|
||||
ourLog.info("P1[{}] L1[{}] Obs1[{}] Obs2[{}]", new Object[] { patientId01, locId01, obsId01, obsId02 });
|
||||
ourLog.info("P1[{}] L1[{}] Obs1[{}] Obs2[{}]", new Object[]{patientId01, locId01, obsId01, obsId02});
|
||||
|
||||
List<IIdType> result;
|
||||
SearchParameterMap params;
|
||||
|
||||
result = toUnqualifiedVersionlessIds(myObservationDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypesXX"))));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypesXX"))));
|
||||
assertThat(result, containsInAnyOrder(obsId01));
|
||||
assertEquals(1, result.size());
|
||||
|
||||
result = toUnqualifiedVersionlessIds(myObservationDao.search(
|
||||
new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("Patient", Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypes01"))));
|
||||
new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("Patient", Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypes01"))));
|
||||
assertThat(result, containsInAnyOrder(obsId01));
|
||||
assertEquals(1, result.size());
|
||||
|
||||
|
@ -1660,7 +1690,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertThat(result, containsInAnyOrder(obsId02));
|
||||
|
||||
result = toUnqualifiedVersionlessIds(myObservationDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypesYY"))));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypesYY"))));
|
||||
assertEquals(0, result.size());
|
||||
|
||||
}
|
||||
|
@ -1694,10 +1724,10 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
dr01.setSubject(new Reference(patientId01));
|
||||
IIdType drId01 = myDiagnosticReportDao.create(dr01, mySrd).getId();
|
||||
|
||||
ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", new Object[] { patientId01, patientId02, obsId01, obsId02, drId01 });
|
||||
ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", new Object[]{patientId01, patientId02, obsId01, obsId02, drId01});
|
||||
|
||||
List<Observation> result = toList(
|
||||
myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("testSearchResourceLinkWithTextLogicalId01"))));
|
||||
myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("testSearchResourceLinkWithTextLogicalId01"))));
|
||||
assertEquals(1, result.size());
|
||||
assertEquals(obsId01.getIdPart(), result.get(0).getIdElement().getIdPart());
|
||||
|
||||
|
@ -1828,24 +1858,24 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertThat(patients, containsInAnyOrder(pid1));
|
||||
assertThat(patients, not(containsInAnyOrder(pid2)));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchWithFetchSizeDefaultMaximum() {
|
||||
myDaoConfig.setFetchSizeDefaultMaximum(5);
|
||||
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Patient p = new Patient();
|
||||
p.addName().setFamily("PT" + i);
|
||||
myPatientDao.create(p);
|
||||
}
|
||||
|
||||
|
||||
SearchParameterMap map = new SearchParameterMap();
|
||||
map.setLoadSynchronous(true);
|
||||
IBundleProvider values = myPatientDao.search(map);
|
||||
assertEquals(5, values.size().intValue());
|
||||
assertEquals(5, values.getResources(0, 1000).size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchStringParam() throws Exception {
|
||||
IIdType pid1;
|
||||
|
@ -1982,7 +2012,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001");
|
||||
patient.addName().setFamily("Tester").addGiven("testSearchTokenParam1");
|
||||
patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem")
|
||||
.setDisplay("testSearchTokenParamDisplay");
|
||||
.setDisplay("testSearchTokenParamDisplay");
|
||||
myPatientDao.create(patient, mySrd);
|
||||
|
||||
patient = new Patient();
|
||||
|
@ -2056,7 +2086,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001");
|
||||
patient.addName().setFamily("Tester").addGiven("testSearchTokenParam1");
|
||||
patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem")
|
||||
.setDisplay("testSearchTokenParamDisplay");
|
||||
.setDisplay("testSearchTokenParamDisplay");
|
||||
myPatientDao.create(patient, mySrd);
|
||||
|
||||
patient = new Patient();
|
||||
|
@ -2639,7 +2669,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
mr1.getCategory().addCoding().setSystem("urn:medicationroute").setCode("oral");
|
||||
mr1.addDosageInstruction().getTiming().addEventElement().setValueAsString("2017-01-01");
|
||||
IIdType id1 = myMedicationRequestDao.create(mr1).getId().toUnqualifiedVersionless();
|
||||
|
||||
|
||||
MedicationRequest mr2 = new MedicationRequest();
|
||||
mr2.getCategory().addCoding().setSystem("urn:medicationroute").setCode("oral");
|
||||
IIdType id2 = myMedicationRequestDao.create(mr2).getId().toUnqualifiedVersionless();
|
||||
|
@ -2650,7 +2680,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
List<String> ids = toUnqualifiedVersionlessIdValues(results);
|
||||
|
||||
assertThat(ids, contains(id2.getValue()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -3075,7 +3105,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertThat(toUnqualifiedVersionlessIds(result), contains(id1));
|
||||
|
||||
result = myValueSetDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.BELOW)));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.BELOW)));
|
||||
assertThat(toUnqualifiedVersionlessIds(result), contains(id1));
|
||||
|
||||
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/").setQualifier(UriParamQualifierEnum.BELOW)));
|
||||
|
@ -3111,7 +3141,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id2));
|
||||
|
||||
result = myValueSetDao
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.ABOVE)));
|
||||
.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.ABOVE)));
|
||||
assertThat(toUnqualifiedVersionlessIds(result), empty());
|
||||
|
||||
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org").setQualifier(UriParamQualifierEnum.ABOVE)));
|
||||
|
|
|
@ -1301,6 +1301,28 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchDate_TimingValueUsingPeriod() {
|
||||
ServiceRequest p1 = new ServiceRequest();
|
||||
p1.setOccurrence(new Timing());
|
||||
p1.getOccurrenceTiming().getRepeat().setBounds(new Period());
|
||||
p1.getOccurrenceTiming().getRepeat().getBoundsPeriod().getStartElement().setValueAsString("2018-01-01");
|
||||
p1.getOccurrenceTiming().getRepeat().getBoundsPeriod().getEndElement().setValueAsString("2018-02-01");
|
||||
String id1 = myServiceRequestDao.create(p1).getId().toUnqualifiedVersionless().getValue();
|
||||
|
||||
{
|
||||
SearchParameterMap map = new SearchParameterMap()
|
||||
.setLoadSynchronous(true)
|
||||
.add(ServiceRequest.SP_OCCURRENCE, new DateParam("lt2019"));
|
||||
IBundleProvider found = myServiceRequestDao.search(map);
|
||||
assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1));
|
||||
assertEquals(1, found.size().intValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchDateWrongParam() {
|
||||
Patient p1 = new Patient();
|
||||
|
|
|
@ -192,6 +192,14 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
|
|||
}
|
||||
}
|
||||
}
|
||||
if (nextValue.getRepeat().hasBounds()) {
|
||||
if (nextValue.getRepeat().getBoundsPeriod().getStart() != null) {
|
||||
dates.add(nextValue.getRepeat().getBoundsPeriod().getStart());
|
||||
}
|
||||
if (nextValue.getRepeat().getBoundsPeriod().getEnd() != null) {
|
||||
dates.add(nextValue.getRepeat().getBoundsPeriod().getEnd());
|
||||
}
|
||||
}
|
||||
if (dates.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -201,6 +201,14 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
|
|||
}
|
||||
}
|
||||
}
|
||||
if (nextValue.getRepeat().hasBounds()) {
|
||||
if (nextValue.getRepeat().getBoundsPeriod().getStart() != null) {
|
||||
dates.add(nextValue.getRepeat().getBoundsPeriod().getStart());
|
||||
}
|
||||
if (nextValue.getRepeat().getBoundsPeriod().getEnd() != null) {
|
||||
dates.add(nextValue.getRepeat().getBoundsPeriod().getEnd());
|
||||
}
|
||||
}
|
||||
if (dates.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
in small batches. This change will likely reduce performance, but does allow
|
||||
for the operation to succeed without timing out in larger system.
|
||||
</action>
|
||||
<action type="fix">
|
||||
The JPA server did not correctly index Timing fields where the timing contained
|
||||
a period but no individual events. This has been corrected.
|
||||
</action>
|
||||
</release>
|
||||
<release version="3.8.0" date="2019-05-30" description="Hippo">
|
||||
<action type="fix">
|
||||
|
|
Loading…
Reference in New Issue