Add unit test
This commit is contained in:
parent
714adcd4be
commit
c784d5647b
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
|
|
|
@ -49,6 +49,8 @@ import org.springframework.transaction.support.TransactionCallback;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
||||||
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
|
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
|
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
||||||
import ca.uhn.fhir.jpa.entity.TagTypeEnum;
|
import ca.uhn.fhir.jpa.entity.TagTypeEnum;
|
||||||
|
@ -69,6 +71,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
||||||
@After
|
@After
|
||||||
public void after() {
|
public void after() {
|
||||||
myDaoConfig.setAllowInlineMatchUrlReferences(false);
|
myDaoConfig.setAllowInlineMatchUrlReferences(false);
|
||||||
|
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -104,6 +107,26 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransactionOruBundle() throws IOException {
|
||||||
|
myDaoConfig.setAllowMultipleDelete(true);
|
||||||
|
|
||||||
|
String input = IOUtils.toString(getClass().getResourceAsStream("/oruBundle.json"), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
Bundle inputBundle;
|
||||||
|
Bundle outputBundle;
|
||||||
|
inputBundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
||||||
|
outputBundle = mySystemDao.transaction(mySrd, inputBundle);
|
||||||
|
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outputBundle));
|
||||||
|
|
||||||
|
inputBundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
||||||
|
outputBundle = mySystemDao.transaction(mySrd, inputBundle);
|
||||||
|
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outputBundle));
|
||||||
|
|
||||||
|
IBundleProvider allPatients = myPatientDao.search(new SearchParameterMap());
|
||||||
|
assertEquals(1, allPatients.size());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteWithHas() {
|
public void testDeleteWithHas() {
|
||||||
Observation obs1 = new Observation();
|
Observation obs1 = new Observation();
|
||||||
|
|
|
@ -0,0 +1,369 @@
|
||||||
|
{
|
||||||
|
"resourceType": "Bundle",
|
||||||
|
"entry": [
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Patient",
|
||||||
|
"identifier": [
|
||||||
|
{
|
||||||
|
"use": "official",
|
||||||
|
"type": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://hl7.org/fhir/v2/0203",
|
||||||
|
"code": "MR"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system": "UHN",
|
||||||
|
"value": "7007474"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"use": "secondary",
|
||||||
|
"type": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://hl7.org/fhir/v2/0203",
|
||||||
|
"code": "JHN"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system": "CANON",
|
||||||
|
"value": "5623417853"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"use": "official",
|
||||||
|
"family": [
|
||||||
|
"Test"
|
||||||
|
],
|
||||||
|
"given": [
|
||||||
|
"Physician-IP-TG",
|
||||||
|
"A"
|
||||||
|
],
|
||||||
|
"prefix": [
|
||||||
|
"MS."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"telecom": [
|
||||||
|
{
|
||||||
|
"system": "phone",
|
||||||
|
"value": "(905)235-6897",
|
||||||
|
"use": "home"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"gender": "female",
|
||||||
|
"birthDate": "1975-01-10",
|
||||||
|
"deceasedBoolean": false,
|
||||||
|
"address": [
|
||||||
|
{
|
||||||
|
"use": "home",
|
||||||
|
"line": [
|
||||||
|
"25 Rathburn Rd"
|
||||||
|
],
|
||||||
|
"city": "MISSISSAUGA",
|
||||||
|
"state": "ON",
|
||||||
|
"postalCode": "L5G 2G8",
|
||||||
|
"country": "Can"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"url": "/Patient?identifier=UHN%7C7007474"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Encounter",
|
||||||
|
"contained": [
|
||||||
|
{
|
||||||
|
"resourceType": "Location",
|
||||||
|
"id": "1",
|
||||||
|
"name": "2",
|
||||||
|
"description": "7C 102"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"identifier": [
|
||||||
|
{
|
||||||
|
"use": "official",
|
||||||
|
"type": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://hl7.org/fhir/v2/0203",
|
||||||
|
"code": "VN"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system": "UHN",
|
||||||
|
"value": "281000561"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"class": {
|
||||||
|
"system": "http://hl7.org/fhir/v3/ActCode",
|
||||||
|
"code": "IMP",
|
||||||
|
"display": "Inpatient"
|
||||||
|
},
|
||||||
|
"patient": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"period": {
|
||||||
|
"start": "2008-09-30T09:53:00-04:00"
|
||||||
|
},
|
||||||
|
"location": [
|
||||||
|
{
|
||||||
|
"location": {
|
||||||
|
"reference": "#1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"url": "/Encounter?identifier=UHN%7C281000561"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:3b3f2d52-2153-44ac-b6b9-d1153db04561",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "DiagnosticRequest",
|
||||||
|
"contained": [
|
||||||
|
{
|
||||||
|
"resourceType": "Practitioner",
|
||||||
|
"id": "1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"identifier": [
|
||||||
|
{
|
||||||
|
"use": "official",
|
||||||
|
"type": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://hl7.org/fhir/v2/0203",
|
||||||
|
"code": "PLAC"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system": "EPR",
|
||||||
|
"value": "SM.14.145"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "9073",
|
||||||
|
"display": "Miscellaneous Infection Control Screen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"reference": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022"
|
||||||
|
},
|
||||||
|
"occurrenceDateTime": "2011-12-01T09:49:12-05:00",
|
||||||
|
"requester": {
|
||||||
|
"reference": "#1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"url": "/DiagnosticRequest?identifier=EPR%7CSM.14.145"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:d855f498-2431-410c-ae4f-0b668d7adde1",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "DiagnosticReport",
|
||||||
|
"identifier": [
|
||||||
|
{
|
||||||
|
"use": "official",
|
||||||
|
"type": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "http://hl7.org/fhir/v2/0203",
|
||||||
|
"code": "PLAC"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system": "EPR",
|
||||||
|
"value": "SM.14.145"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "9073",
|
||||||
|
"display": "Miscellaneous Infection Control Screen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"encounter": {
|
||||||
|
"reference": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "2011-11-23T00:00:00-05:00",
|
||||||
|
"request": [
|
||||||
|
{
|
||||||
|
"reference": "urn:uuid:3b3f2d52-2153-44ac-b6b9-d1153db04561"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": [
|
||||||
|
{
|
||||||
|
"reference": "urn:uuid:3f2de61a-8eb0-465b-a5e2-ca7a8f44a102"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "urn:uuid:790b4667-9a99-476c-bd52-14bd494dbcd6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "urn:uuid:dc519662-295c-472c-a9ea-7ad8f09b176e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reference": "urn:uuid:b84b5fc9-127a-4d07-9ddb-404cfed86ecf"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"url": "/DiagnosticReport?identifier=EPR%7CSM.14.145"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"request": {
|
||||||
|
"method": "DELETE",
|
||||||
|
"url": "Observation?_has:DiagnosticReport:result:identifier=EPR%7CSM.14.145"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:3f2de61a-8eb0-465b-a5e2-ca7a8f44a102",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "Q",
|
||||||
|
"display": "Test Comment"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"encounter": {
|
||||||
|
"reference": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "2011-12-01T09:49:00-05:00",
|
||||||
|
"valueString": "This specimen was documented as collected but not received by the Microbiology Laboratory after 7 days. If this test is still required, please place a new order."
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"url": "/Observation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:790b4667-9a99-476c-bd52-14bd494dbcd6",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "SFTACC",
|
||||||
|
"display": "LIS Order #"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"encounter": {
|
||||||
|
"reference": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "2011-12-01T09:49:00-05:00",
|
||||||
|
"valueString": "N9230010"
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"url": "/Observation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:dc519662-295c-472c-a9ea-7ad8f09b176e",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "SFTWP",
|
||||||
|
"display": "Micro Rpt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"encounter": {
|
||||||
|
"reference": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "2011-12-01T09:49:00-05:00",
|
||||||
|
"valueString": "Report test"
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"url": "/Observation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fullUrl": "urn:uuid:b84b5fc9-127a-4d07-9ddb-404cfed86ecf",
|
||||||
|
"resource": {
|
||||||
|
"resourceType": "Observation",
|
||||||
|
"status": "final",
|
||||||
|
"code": {
|
||||||
|
"coding": [
|
||||||
|
{
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "NA",
|
||||||
|
"display": "Sodium"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subject": {
|
||||||
|
"reference": "urn:uuid:09a8d22c-1e23-4e5f-b3bf-505772f123d1"
|
||||||
|
},
|
||||||
|
"encounter": {
|
||||||
|
"reference": "urn:uuid:29e3a213-0df4-41e0-88f8-e3be83277022"
|
||||||
|
},
|
||||||
|
"effectiveDateTime": "2011-12-01T10:57:00-05:00",
|
||||||
|
"valueQuantity": {
|
||||||
|
"value": 180,
|
||||||
|
"system": "HL70396",
|
||||||
|
"code": "mmol/L"
|
||||||
|
},
|
||||||
|
"referenceRange": [
|
||||||
|
{
|
||||||
|
"text": "135 - 147"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"url": "/Observation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue