From fb23e82ee90a2555a13d24b9570da63d38db8d3d Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Tue, 25 Mar 2014 13:42:38 -0400 Subject: [PATCH] Adding AdverseReaction --- .../BaseRuntimeDeclaredChildDefinition.java | 42 +- .../ca/uhn/fhir/context/ModelScanner.java | 6 +- ...ntimeChildDeclaredExtensionDefinition.java | 2 +- .../RuntimeCompositeDatatypeDefinition.java | 2 +- .../RuntimePrimitiveDatatypeDefinition.java | 2 +- .../context/RuntimeResourceDefinition.java | 3 +- .../fhir/model/api/BaseResourceReference.java | 43 + .../model/dstu/composite/AttachmentDt.java | 2 +- .../fhir/model/dstu/composite/CodingDt.java | 2 +- .../model/dstu/composite/IdentifierDt.java | 15 +- .../fhir/model/dstu/composite/RangeDt.java | 109 +- .../fhir/model/dstu/composite/RatioDt.java | 109 +- .../dstu/composite/ResourceReferenceDt.java | 28 + .../model/dstu/composite/SampledDataDt.java | 57 +- .../fhir/model/dstu/composite/ScheduleDt.java | 4 +- .../model/dstu/resource/AdverseReaction.java | 909 ++++++++++++++ .../fhir/model/dstu/resource/Conformance.java | 12 +- .../uhn/fhir/model/dstu/resource/Device.java | 39 +- .../model/dstu/resource/DiagnosticOrder.java | 39 +- .../model/dstu/resource/DiagnosticReport.java | 29 +- .../fhir/model/dstu/resource/Encounter.java | 69 +- .../uhn/fhir/model/dstu/resource/Group.java | 35 +- .../model/dstu/resource/ImagingStudy.java | 77 +- .../fhir/model/dstu/resource/Location.java | 29 +- .../uhn/fhir/model/dstu/resource/Media.java | 47 +- .../fhir/model/dstu/resource/Medication.java | 2 +- .../fhir/model/dstu/resource/Observation.java | 138 ++- .../model/dstu/resource/Organization.java | 41 +- .../uhn/fhir/model/dstu/resource/Patient.java | 41 +- .../model/dstu/resource/Practitioner.java | 39 +- .../uhn/fhir/model/dstu/resource/Profile.java | 16 +- .../model/dstu/resource/RelatedPerson.java | 39 +- .../fhir/model/dstu/resource/Specimen.java | 268 +++- .../fhir/model/dstu/resource/Substance.java | 84 +- .../fhir/model/dstu/resource/ValueSet.java | 37 +- .../valueset/CausalityExpectationEnum.java | 131 ++ .../model/dstu/valueset/ExposureTypeEnum.java | 124 ++ .../dstu/valueset/ReactionSeverityEnum.java | 131 ++ .../fhir/model/primitive/BaseDateTimeDt.java | 6 +- .../uhn/fhir/model/primitive/BooleanDt.java | 2 +- .../primitive/BoundCodeableConceptDt.java | 2 +- .../fhir/model/primitive/BoundCodingDt__.java | 2 +- .../ca/uhn/fhir/model/primitive/CodeDt.java | 2 +- .../uhn/fhir/model/primitive/DecimalDt.java | 4 +- .../uhn/fhir/model/primitive/IntegerDt.java | 2 +- .../ca/uhn/fhir/model/primitive/UriDt.java | 2 + .../fhir/narrative/INarrativeGenerator.java | 3 +- .../ThymeleafNarrativeGenerator.java | 39 +- .../main/java/ca/uhn/fhir/parser/IParser.java | 4 +- .../java/ca/uhn/fhir/parser/JsonParser.java | 15 +- .../java/ca/uhn/fhir/parser/ParserState.java | 2 +- .../java/ca/uhn/fhir/parser/XmlParser.java | 20 +- .../fhir/rest/method/ReadMethodBinding.java | 1 - .../fhir/rest/method/SearchMethodBinding.java | 1 - .../fhir/rest/{server => method}/Util.java | 4 +- .../uhn/fhir/rest/param/CollectionBinder.java | 2 +- .../ca/uhn/fhir/rest/server/EncodingUtil.java | 2 +- .../uhn/fhir/rest/server/RestfulServer.java | 64 +- .../uhn/fhir/narrative/DiagnosticReport.html | 29 +- .../ca/uhn/fhir/narrative/Patient.html | 63 +- .../ca/uhn/fhir/narrative/narrative.css | 46 + .../site/example/java/example/QuickUsage.java | 14 + .../fhir/model/primitive/DecimalDtTest.java | 16 + .../ThymeleafNarrativeGeneratorTest.java | 23 +- .../ca/uhn/fhir/parser/JsonParserTest.java | 24 + .../ca/uhn/fhir/parser/XmlParserTest.java | 24 + hapi-fhir-structures-dstu/pom.xml | 1 + .../res/adversereaction-spreadsheet.xml | 1087 +++++++++++++++++ .../src/main/resources/vm/dt_composite.vm | 69 +- 69 files changed, 4193 insertions(+), 184 deletions(-) create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/AdverseReaction.java create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/CausalityExpectationEnum.java create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ExposureTypeEnum.java create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ReactionSeverityEnum.java rename hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/{server => method}/Util.java (98%) create mode 100644 hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narrative.css create mode 100644 hapi-fhir-base/src/site/example/java/example/QuickUsage.java create mode 100644 hapi-fhir-base/src/test/java/ca/uhn/fhir/model/primitive/DecimalDtTest.java create mode 100644 hapi-tinder-plugin/src/main/resources/res/adversereaction-spreadsheet.xml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeDeclaredChildDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeDeclaredChildDefinition.java index 65e5a910957..c87e661e82c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeDeclaredChildDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeDeclaredChildDefinition.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.context; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -9,6 +9,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.commons.lang3.text.WordUtils; + import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Description; @@ -19,11 +21,11 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil private final IAccessor myAccessor; private final String myElementName; private final Field myField; + private final String myFormalDefinition; private final int myMax; private final int myMin; private final IMutator myMutator; private final String myShortDefinition; - private final String myFormalDefinition; BaseRuntimeDeclaredChildDefinition(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException { super(); @@ -62,8 +64,15 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil elementName = "classElement"; // because getClass() is reserved } final Method accessor = BeanUtils.findAccessor(declaringClass, targetReturnType, elementName); - final Method mutator = BeanUtils.findMutator(declaringClass, targetReturnType, elementName); + if (accessor==null) { + throw new ConfigurationException("Could not find bean accessor/getter for property " + elementName + " on class " + declaringClass.getCanonicalName()); + } + final Method mutator = findMutator(declaringClass, targetReturnType, elementName); + if (mutator==null) { + throw new ConfigurationException("Could not find bean mutator/setter for property " + elementName + " on class " + declaringClass.getCanonicalName() + " (expected return type " + targetReturnType.getCanonicalName() + ")"); + } + if (List.class.isAssignableFrom(targetReturnType)) { myAccessor = new ListAccessor(accessor); myMutator = new ListMutator(mutator); @@ -77,14 +86,6 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil } - public String getShortDefinition() { - return myShortDefinition; - } - - public String getFormalDefinition() { - return myFormalDefinition; - } - @Override public IAccessor getAccessor() { return myAccessor; @@ -98,6 +99,10 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil return myField; } + public String getFormalDefinition() { + return myFormalDefinition; + } + @Override public int getMax() { return myMax; @@ -113,6 +118,10 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil return myMutator; } + public String getShortDefinition() { + return myShortDefinition; + } + public BaseRuntimeElementDefinition getSingleChildOrThrow() { if (getValidChildNames().size() != 1) { throw new IllegalStateException("This child has " + getValidChildNames().size() + " children, expected 1. This is a HAPI bug. Found: " + getValidChildNames()); @@ -120,6 +129,17 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil return getChildByName(getValidChildNames().iterator().next()); } + private static Method findMutator(Class theDeclaringClass, Class theTargetReturnType, String theElementName) { + String methodName = "set" + WordUtils.capitalize(theElementName); + try { + return theDeclaringClass.getMethod(methodName, theTargetReturnType); + } catch (NoSuchMethodException e) { + return null; + } catch (SecurityException e) { + throw new ConfigurationException("Failed to scan class '" + theDeclaringClass + "' because of a security exception", e); + } + } + private final class ListAccessor implements IAccessor { private final Method myAccessorMethod; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java index a3aa0a5b0a5..d0e6e18d995 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.context; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; @@ -255,7 +255,7 @@ class ModelScanner { } while (current != null); for (Class next : classes) { - scanCompositeElementForChildren(next, theDefinition, elementNames, orderToElementDef, orderToExtensionDef); + scanCompositeElementForChildren(next, elementNames, orderToElementDef, orderToExtensionDef); } // while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < @@ -288,7 +288,7 @@ class ModelScanner { } @SuppressWarnings("unchecked") - private void scanCompositeElementForChildren(Class theClass, BaseRuntimeElementCompositeDefinition theDefinition, Set elementNames, TreeMap theOrderToElementDef, + private void scanCompositeElementForChildren(Class theClass, Set elementNames, TreeMap theOrderToElementDef, TreeMap theOrderToExtensionDef) { int baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java index 5bc3faa89cd..6cbae6807b5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.context; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.lang.reflect.Field; import java.util.Collections; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java index ec16dbca1df..c34415d3ae3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.context; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; import ca.uhn.fhir.model.api.ICompositeDatatype; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.ResourceDef; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java index 721a0c2b86f..d73ca9bff2a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.context; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; import java.util.Map; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java index b715898edd6..5ee1863414d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.context; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.apache.commons.lang3.StringUtils.join; import java.util.Collections; import java.util.Comparator; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResourceReference.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResourceReference.java index 9ae6f410bbd..b8d2731cd07 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResourceReference.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResourceReference.java @@ -3,6 +3,7 @@ package ca.uhn.fhir.model.api; import java.io.IOException; import java.io.Reader; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.CloseableHttpResponse; @@ -18,6 +19,32 @@ public abstract class BaseResourceReference extends BaseElement { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseResourceReference.class); private IResource myResource; + private String myResourceId; + private Class myResourceType; + + /** + * Constructor + */ + public BaseResourceReference() { + // nothing + } + + /** + * Constructor + */ + public BaseResourceReference(Class theResourceType, String theResourceId) { + myResourceType = theResourceType; + myResourceId = theResourceId; + } + + @Override + protected boolean isBaseEmpty() { + return super.isBaseEmpty() && myResource == null && myResourceType == null && StringUtils.isBlank(myResourceId); + } + + public BaseResourceReference(IResource theResource) { + myResource=theResource; + } /** * Gets the value(s) for reference (Relative, internal or absolute URL reference). creating it if it does not exist. Will not return null. @@ -43,6 +70,14 @@ public abstract class BaseResourceReference extends BaseElement { return myResource; } + public String getResourceId() { + return myResourceId; + } + + public Class getResourceType() { + return myResourceType; + } + public String getResourceUrl() { return getReference().getValue(); } @@ -88,4 +123,12 @@ public abstract class BaseResourceReference extends BaseElement { myResource = theResource; } + public void setResourceId(String theResourceId) { + myResourceId = theResourceId; + } + + public void setResourceType(Class theResourceType) { + myResourceType = theResourceType; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java index a814342e441..1ea52d45438 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java @@ -335,7 +335,7 @@ public class AttachmentDt * The number of bytes of data that make up this attachment. *

*/ - public AttachmentDt setSize( Integer theInteger) { + public AttachmentDt setSize( int theInteger) { mySize = new IntegerDt(theInteger); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java index bc7bd60bcfb..8561f0be7fd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java @@ -337,7 +337,7 @@ public class CodingDt * Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays) *

*/ - public CodingDt setPrimary( Boolean theBoolean) { + public CodingDt setPrimary( boolean theBoolean) { myPrimary = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java index 3985ac67ae2..5289f0f57dd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java @@ -25,6 +25,7 @@ import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; @@ -59,11 +60,23 @@ public class IdentifierDt /** * Creates a new identifier with the given system and value */ - public IdentifierDt(String theSystem, String theValue) { + @SimpleSetter + public IdentifierDt(@SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theValue") String theValue) { setSystem(theSystem); setValue(theValue); } + /** + * Creates a new identifier with the given system and value + */ + @SimpleSetter + public IdentifierDt(@SimpleSetter.Parameter(name="theUse") IdentifierUseEnum theUse, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theValue") String theValue, @SimpleSetter.Parameter(name="theLabel") String theLabel) { + setUse(theUse); + setSystem(theSystem); + setValue(theValue); + setLabel(theLabel); + } + @Child(name="use", type=CodeDt.class, order=0, min=0, max=1) @Description( shortDefinition="usual | official | temp | secondary (If known)", diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java index 060ccf82179..2fb3d4b1dfb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; /** * HAPI/FHIR Range Datatype @@ -111,7 +112,59 @@ public class RangeDt return this; } - + /** + * Sets the value for low (Low limit) + * + *

+ * Definition: + * The low limit. The boundary is inclusive. + *

+ */ + public RangeDt setLow( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for low (Low limit) + * + *

+ * Definition: + * The low limit. The boundary is inclusive. + *

+ */ + public RangeDt setLow( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for low (Low limit) + * + *

+ * Definition: + * The low limit. The boundary is inclusive. + *

+ */ + public RangeDt setLow( long theValue) { + myLow = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for low (Low limit) + * + *

+ * Definition: + * The low limit. The boundary is inclusive. + *

+ */ + public RangeDt setLow( double theValue) { + myLow = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for high (High limit). * creating it if it does @@ -142,7 +195,59 @@ public class RangeDt return this; } - + /** + * Sets the value for high (High limit) + * + *

+ * Definition: + * The high limit. The boundary is inclusive. + *

+ */ + public RangeDt setHigh( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for high (High limit) + * + *

+ * Definition: + * The high limit. The boundary is inclusive. + *

+ */ + public RangeDt setHigh( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for high (High limit) + * + *

+ * Definition: + * The high limit. The boundary is inclusive. + *

+ */ + public RangeDt setHigh( long theValue) { + myHigh = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for high (High limit) + * + *

+ * Definition: + * The high limit. The boundary is inclusive. + *

+ */ + public RangeDt setHigh( double theValue) { + myHigh = new QuantityDt(theValue); + return this; + } + + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java index 566053fbf69..50053213a2f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; /** * HAPI/FHIR Ratio Datatype @@ -111,7 +112,59 @@ public class RatioDt return this; } - + /** + * Sets the value for numerator (Numerator value) + * + *

+ * Definition: + * The value of the numerator + *

+ */ + public RatioDt setNumerator( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myNumerator = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for numerator (Numerator value) + * + *

+ * Definition: + * The value of the numerator + *

+ */ + public RatioDt setNumerator( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myNumerator = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for numerator (Numerator value) + * + *

+ * Definition: + * The value of the numerator + *

+ */ + public RatioDt setNumerator( long theValue) { + myNumerator = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for numerator (Numerator value) + * + *

+ * Definition: + * The value of the numerator + *

+ */ + public RatioDt setNumerator( double theValue) { + myNumerator = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for denominator (Denominator value). * creating it if it does @@ -142,7 +195,59 @@ public class RatioDt return this; } - + /** + * Sets the value for denominator (Denominator value) + * + *

+ * Definition: + * The value of the denominator + *

+ */ + public RatioDt setDenominator( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myDenominator = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for denominator (Denominator value) + * + *

+ * Definition: + * The value of the denominator + *

+ */ + public RatioDt setDenominator( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myDenominator = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for denominator (Denominator value) + * + *

+ * Definition: + * The value of the denominator + *

+ */ + public RatioDt setDenominator( long theValue) { + myDenominator = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for denominator (Denominator value) + * + *

+ * Definition: + * The value of the denominator + *

+ */ + public RatioDt setDenominator( double theValue) { + myDenominator = new QuantityDt(theValue); + return this; + } + + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java index 3488edeecc8..3b9c7b83e2c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java @@ -21,6 +21,7 @@ import java.util.List; import ca.uhn.fhir.model.api.BaseResourceReference; import ca.uhn.fhir.model.api.ICompositeDatatype; import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; @@ -51,6 +52,33 @@ public class ResourceReferenceDt // nothing } + /** + * Constructor which creates a normal resource reference + * + * @param theResourceType The resource type + * @param theResourceId The resource ID + */ + public ResourceReferenceDt(Class theResourceType, String theResourceId) { + super(theResourceType, theResourceId); + } + + /** + * Constructor which creates a resource reference containing the actual + * resource in question. + *

+ * + * When using this in a server: Generally if this is serialized, it will be serialized + * as a contained resource, so this should not be used if the intent is not to actually + * supply the referenced resource. This is not a hard-and-fast rule however, as the + * server can be configured to not serialized this resource, or to load an ID and contain + * even if this constructor is not used. + *

+ * + * @param theResource The resource instance + */ + public ResourceReferenceDt(IResource theResource) { + super(theResource); + } @Child(name="reference", type=StringDt.class, order=0, min=0, max=1) @Description( diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java index 50ba59c85ed..bb795254940 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; import ca.uhn.fhir.model.primitive.DecimalDt; import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.StringDt; @@ -149,7 +150,59 @@ public class SampledDataDt return this; } - + /** + * Sets the value for origin (Zero value and units) + * + *

+ * Definition: + * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series + *

+ */ + public SampledDataDt setOrigin( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myOrigin = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for origin (Zero value and units) + * + *

+ * Definition: + * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series + *

+ */ + public SampledDataDt setOrigin( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myOrigin = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for origin (Zero value and units) + * + *

+ * Definition: + * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series + *

+ */ + public SampledDataDt setOrigin( long theValue) { + myOrigin = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for origin (Zero value and units) + * + *

+ * Definition: + * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series + *

+ */ + public SampledDataDt setOrigin( double theValue) { + myOrigin = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for period (Number of milliseconds between samples). * creating it if it does @@ -468,7 +521,7 @@ public class SampledDataDt * The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once *

*/ - public SampledDataDt setDimensions( Integer theInteger) { + public SampledDataDt setDimensions( int theInteger) { myDimensions = new IntegerDt(theInteger); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java index 0c52d21ca64..c520cea1003 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java @@ -290,7 +290,7 @@ public class ScheduleDt * Indicates how often the event should occur. *

*/ - public Repeat setFrequency( Integer theInteger) { + public Repeat setFrequency( int theInteger) { myFrequency = new IntegerDt(theInteger); return this; } @@ -492,7 +492,7 @@ public class ScheduleDt * A total count of the desired number of repetitions *

*/ - public Repeat setCount( Integer theInteger) { + public Repeat setCount( int theInteger) { myCount = new IntegerDt(theInteger); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/AdverseReaction.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/AdverseReaction.java new file mode 100644 index 00000000000..c49e6cf4f20 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/AdverseReaction.java @@ -0,0 +1,909 @@ + + + + + + + + + + + + + + + + +package ca.uhn.fhir.model.dstu.resource; + + +import java.util.Date; +import java.util.List; + +import ca.uhn.fhir.model.api.BaseElement; +import ca.uhn.fhir.model.api.BaseResource; +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.IResourceBlock; +import ca.uhn.fhir.model.api.TemporalPrecisionEnum; +import ca.uhn.fhir.model.api.annotation.Block; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt; +import ca.uhn.fhir.model.dstu.composite.IdentifierDt; +import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.valueset.CausalityExpectationEnum; +import ca.uhn.fhir.model.dstu.valueset.ExposureTypeEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; +import ca.uhn.fhir.model.dstu.valueset.ReactionSeverityEnum; +import ca.uhn.fhir.model.primitive.BooleanDt; +import ca.uhn.fhir.model.primitive.BoundCodeDt; +import ca.uhn.fhir.model.primitive.CodeDt; +import ca.uhn.fhir.model.primitive.DateTimeDt; + + +/** + * HAPI/FHIR AdverseReaction Resource + * (Specific reactions to a substance) + * + *

+ * Definition: + * Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance + *

+ * + *

+ * Requirements: + * Used to track reactions when it is unknown the exact cause but there's a desire to flag/track potential causes. Also used to capture reactions that are significant for inclusion in the health record or as evidence for an allergy or intolerance. + *

+ */ +@ResourceDef(name="AdverseReaction", profile="http://hl7.org/fhir/profiles/AdverseReaction", id="adversereaction") +public class AdverseReaction extends BaseResource implements IResource { + + /** + * Search parameter constant for symptom + *

+ * Description: One of the symptoms of the reaction
+ * Type: token
+ * Path: AdverseReaction.symptom.code
+ *

+ */ + public static final String SP_SYMPTOM = "symptom"; + + /** + * Search parameter constant for substance + *

+ * Description: The name or code of the substance that produces the sensitivity
+ * Type: reference
+ * Path: AdverseReaction.exposure.substance
+ *

+ */ + public static final String SP_SUBSTANCE = "substance"; + + /** + * Search parameter constant for date + *

+ * Description: The date of the reaction
+ * Type: date
+ * Path: AdverseReaction.date
+ *

+ */ + public static final String SP_DATE = "date"; + + /** + * Search parameter constant for subject + *

+ * Description: The subject that the sensitivity is about
+ * Type: reference
+ * Path: AdverseReaction.subject
+ *

+ */ + public static final String SP_SUBJECT = "subject"; + + + @Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED) + @Description( + shortDefinition="External Ids for this adverse reaction", + formalDefinition="This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)" + ) + private java.util.List myIdentifier; + + @Child(name="date", type=DateTimeDt.class, order=1, min=0, max=1) + @Description( + shortDefinition="When the reaction occurred", + formalDefinition="The date (and possibly time) when the reaction began" + ) + private DateTimeDt myDate; + + @Child(name="subject", order=2, min=1, max=1, type={ + ca.uhn.fhir.model.dstu.resource.Patient.class, + }) + @Description( + shortDefinition="Who had the reaction", + formalDefinition="The subject of the adverse reaction" + ) + private ResourceReferenceDt mySubject; + + @Child(name="didNotOccurFlag", type=BooleanDt.class, order=3, min=1, max=1) + @Description( + shortDefinition="Indicates lack of reaction", + formalDefinition="If true, indicates that no reaction occurred." + ) + private BooleanDt myDidNotOccurFlag; + + @Child(name="recorder", order=4, min=0, max=1, type={ + ca.uhn.fhir.model.dstu.resource.Practitioner.class, + ca.uhn.fhir.model.dstu.resource.Patient.class, + }) + @Description( + shortDefinition="Who recorded the reaction", + formalDefinition="Identifies the individual responsible for the information in the reaction record." + ) + private ResourceReferenceDt myRecorder; + + @Child(name="symptom", order=5, min=0, max=Child.MAX_UNLIMITED) + @Description( + shortDefinition="What was reaction?", + formalDefinition="The signs and symptoms that were observed as part of the reaction" + ) + private java.util.List mySymptom; + + @Child(name="exposure", order=6, min=0, max=Child.MAX_UNLIMITED) + @Description( + shortDefinition="Suspected substance", + formalDefinition="An exposure to a substance that preceded a reaction occurrence" + ) + private java.util.List myExposure; + + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myDate, mySubject, myDidNotOccurFlag, myRecorder, mySymptom, myExposure); + } + + @Override + public java.util.List getAllPopulatedChildElements() { + return getAllPopulatedChildElementsOfType(null); + } + + @Override + public List getAllPopulatedChildElementsOfType(Class theType) { + return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myDate, mySubject, myDidNotOccurFlag, myRecorder, mySymptom, myExposure); + } + + /** + * Gets the value(s) for identifier (External Ids for this adverse reaction). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + *

+ */ + public java.util.List getIdentifier() { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + return myIdentifier; + } + + /** + * Sets the value(s) for identifier (External Ids for this adverse reaction) + * + *

+ * Definition: + * This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + *

+ */ + public AdverseReaction setIdentifier(java.util.List theValue) { + myIdentifier = theValue; + return this; + } + + /** + * Adds and returns a new value for identifier (External Ids for this adverse reaction) + * + *

+ * Definition: + * This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + + /** + * Gets the first repetition for identifier (External Ids for this adverse reaction), + * creating it if it does not already exist. + * + *

+ * Definition: + * This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + *

+ */ + public IdentifierDt getIdentifierFirstRep() { + if (getIdentifier().isEmpty()) { + return addIdentifier(); + } + return getIdentifier().get(0); + } + /** + * Adds a new value for identifier (External Ids for this adverse reaction) + * + *

+ * Definition: + * This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public AdverseReaction addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (External Ids for this adverse reaction) + * + *

+ * Definition: + * This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public AdverseReaction addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + + /** + * Gets the value(s) for date (When the reaction occurred). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The date (and possibly time) when the reaction began + *

+ */ + public DateTimeDt getDate() { + if (myDate == null) { + myDate = new DateTimeDt(); + } + return myDate; + } + + /** + * Sets the value(s) for date (When the reaction occurred) + * + *

+ * Definition: + * The date (and possibly time) when the reaction began + *

+ */ + public AdverseReaction setDate(DateTimeDt theValue) { + myDate = theValue; + return this; + } + + /** + * Sets the value for date (When the reaction occurred) + * + *

+ * Definition: + * The date (and possibly time) when the reaction began + *

+ */ + public AdverseReaction setDate( Date theDate, TemporalPrecisionEnum thePrecision) { + myDate = new DateTimeDt(theDate, thePrecision); + return this; + } + + /** + * Sets the value for date (When the reaction occurred) + * + *

+ * Definition: + * The date (and possibly time) when the reaction began + *

+ */ + public AdverseReaction setDateWithSecondsPrecision( Date theDate) { + myDate = new DateTimeDt(theDate); + return this; + } + + + /** + * Gets the value(s) for subject (Who had the reaction). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The subject of the adverse reaction + *

+ */ + public ResourceReferenceDt getSubject() { + if (mySubject == null) { + mySubject = new ResourceReferenceDt(); + } + return mySubject; + } + + /** + * Sets the value(s) for subject (Who had the reaction) + * + *

+ * Definition: + * The subject of the adverse reaction + *

+ */ + public AdverseReaction setSubject(ResourceReferenceDt theValue) { + mySubject = theValue; + return this; + } + + + /** + * Gets the value(s) for didNotOccurFlag (Indicates lack of reaction). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * If true, indicates that no reaction occurred. + *

+ */ + public BooleanDt getDidNotOccurFlag() { + if (myDidNotOccurFlag == null) { + myDidNotOccurFlag = new BooleanDt(); + } + return myDidNotOccurFlag; + } + + /** + * Sets the value(s) for didNotOccurFlag (Indicates lack of reaction) + * + *

+ * Definition: + * If true, indicates that no reaction occurred. + *

+ */ + public AdverseReaction setDidNotOccurFlag(BooleanDt theValue) { + myDidNotOccurFlag = theValue; + return this; + } + + /** + * Sets the value for didNotOccurFlag (Indicates lack of reaction) + * + *

+ * Definition: + * If true, indicates that no reaction occurred. + *

+ */ + public AdverseReaction setDidNotOccurFlag( boolean theBoolean) { + myDidNotOccurFlag = new BooleanDt(theBoolean); + return this; + } + + + /** + * Gets the value(s) for recorder (Who recorded the reaction). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * Identifies the individual responsible for the information in the reaction record. + *

+ */ + public ResourceReferenceDt getRecorder() { + return myRecorder; + } + + /** + * Sets the value(s) for recorder (Who recorded the reaction) + * + *

+ * Definition: + * Identifies the individual responsible for the information in the reaction record. + *

+ */ + public AdverseReaction setRecorder(ResourceReferenceDt theValue) { + myRecorder = theValue; + return this; + } + + + /** + * Gets the value(s) for symptom (What was reaction?). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The signs and symptoms that were observed as part of the reaction + *

+ */ + public java.util.List getSymptom() { + if (mySymptom == null) { + mySymptom = new java.util.ArrayList(); + } + return mySymptom; + } + + /** + * Sets the value(s) for symptom (What was reaction?) + * + *

+ * Definition: + * The signs and symptoms that were observed as part of the reaction + *

+ */ + public AdverseReaction setSymptom(java.util.List theValue) { + mySymptom = theValue; + return this; + } + + /** + * Adds and returns a new value for symptom (What was reaction?) + * + *

+ * Definition: + * The signs and symptoms that were observed as part of the reaction + *

+ */ + public Symptom addSymptom() { + Symptom newType = new Symptom(); + getSymptom().add(newType); + return newType; + } + + /** + * Gets the first repetition for symptom (What was reaction?), + * creating it if it does not already exist. + * + *

+ * Definition: + * The signs and symptoms that were observed as part of the reaction + *

+ */ + public Symptom getSymptomFirstRep() { + if (getSymptom().isEmpty()) { + return addSymptom(); + } + return getSymptom().get(0); + } + + /** + * Gets the value(s) for exposure (Suspected substance). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * An exposure to a substance that preceded a reaction occurrence + *

+ */ + public java.util.List getExposure() { + if (myExposure == null) { + myExposure = new java.util.ArrayList(); + } + return myExposure; + } + + /** + * Sets the value(s) for exposure (Suspected substance) + * + *

+ * Definition: + * An exposure to a substance that preceded a reaction occurrence + *

+ */ + public AdverseReaction setExposure(java.util.List theValue) { + myExposure = theValue; + return this; + } + + /** + * Adds and returns a new value for exposure (Suspected substance) + * + *

+ * Definition: + * An exposure to a substance that preceded a reaction occurrence + *

+ */ + public Exposure addExposure() { + Exposure newType = new Exposure(); + getExposure().add(newType); + return newType; + } + + /** + * Gets the first repetition for exposure (Suspected substance), + * creating it if it does not already exist. + * + *

+ * Definition: + * An exposure to a substance that preceded a reaction occurrence + *

+ */ + public Exposure getExposureFirstRep() { + if (getExposure().isEmpty()) { + return addExposure(); + } + return getExposure().get(0); + } + + /** + * Block class for child element: AdverseReaction.symptom (What was reaction?) + * + *

+ * Definition: + * The signs and symptoms that were observed as part of the reaction + *

+ */ + @Block(name="AdverseReaction.symptom") + public static class Symptom extends BaseElement implements IResourceBlock { + + @Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1) + @Description( + shortDefinition="E.g. Rash, vomiting", + formalDefinition="Indicates the specific sign or symptom that was observed" + ) + private CodeableConceptDt myCode; + + @Child(name="severity", type=CodeDt.class, order=1, min=0, max=1) + @Description( + shortDefinition="severe | serious | moderate | minor", + formalDefinition="The severity of the sign or symptom" + ) + private BoundCodeDt mySeverity; + + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, mySeverity); + } + + @Override + public java.util.List getAllPopulatedChildElements() { + return getAllPopulatedChildElementsOfType(null); + } + + @Override + public List getAllPopulatedChildElementsOfType(Class theType) { + return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myCode, mySeverity); + } + + /** + * Gets the value(s) for code (E.g. Rash, vomiting). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * Indicates the specific sign or symptom that was observed + *

+ */ + public CodeableConceptDt getCode() { + if (myCode == null) { + myCode = new CodeableConceptDt(); + } + return myCode; + } + + /** + * Sets the value(s) for code (E.g. Rash, vomiting) + * + *

+ * Definition: + * Indicates the specific sign or symptom that was observed + *

+ */ + public Symptom setCode(CodeableConceptDt theValue) { + myCode = theValue; + return this; + } + + + /** + * Gets the value(s) for severity (severe | serious | moderate | minor). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The severity of the sign or symptom + *

+ */ + public BoundCodeDt getSeverity() { + if (mySeverity == null) { + mySeverity = new BoundCodeDt(ReactionSeverityEnum.VALUESET_BINDER); + } + return mySeverity; + } + + /** + * Sets the value(s) for severity (severe | serious | moderate | minor) + * + *

+ * Definition: + * The severity of the sign or symptom + *

+ */ + public Symptom setSeverity(BoundCodeDt theValue) { + mySeverity = theValue; + return this; + } + + /** + * Sets the value(s) for severity (severe | serious | moderate | minor) + * + *

+ * Definition: + * The severity of the sign or symptom + *

+ */ + public Symptom setSeverity(ReactionSeverityEnum theValue) { + getSeverity().setValueAsEnum(theValue); + return this; + } + + + + } + + + /** + * Block class for child element: AdverseReaction.exposure (Suspected substance) + * + *

+ * Definition: + * An exposure to a substance that preceded a reaction occurrence + *

+ */ + @Block(name="AdverseReaction.exposure") + public static class Exposure extends BaseElement implements IResourceBlock { + + @Child(name="date", type=DateTimeDt.class, order=0, min=0, max=1) + @Description( + shortDefinition="When the exposure occurred", + formalDefinition="Identifies the initial date of the exposure that is suspected to be related to the reaction" + ) + private DateTimeDt myDate; + + @Child(name="type", type=CodeDt.class, order=1, min=0, max=1) + @Description( + shortDefinition="drugadmin | immuniz | coincidental", + formalDefinition="The type of exposure: Drug Administration, Immunization, Coincidental" + ) + private BoundCodeDt myType; + + @Child(name="causalityExpectation", type=CodeDt.class, order=2, min=0, max=1) + @Description( + shortDefinition="likely | unlikely | confirmed | unknown", + formalDefinition="A statement of how confident that the recorder was that this exposure caused the reaction" + ) + private BoundCodeDt myCausalityExpectation; + + @Child(name="substance", order=3, min=0, max=1, type={ + ca.uhn.fhir.model.dstu.resource.Substance.class, + }) + @Description( + shortDefinition="Presumed causative substance", + formalDefinition="Substance that is presumed to have caused the adverse reaction" + ) + private ResourceReferenceDt mySubstance; + + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myDate, myType, myCausalityExpectation, mySubstance); + } + + @Override + public java.util.List getAllPopulatedChildElements() { + return getAllPopulatedChildElementsOfType(null); + } + + @Override + public List getAllPopulatedChildElementsOfType(Class theType) { + return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myDate, myType, myCausalityExpectation, mySubstance); + } + + /** + * Gets the value(s) for date (When the exposure occurred). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * Identifies the initial date of the exposure that is suspected to be related to the reaction + *

+ */ + public DateTimeDt getDate() { + if (myDate == null) { + myDate = new DateTimeDt(); + } + return myDate; + } + + /** + * Sets the value(s) for date (When the exposure occurred) + * + *

+ * Definition: + * Identifies the initial date of the exposure that is suspected to be related to the reaction + *

+ */ + public Exposure setDate(DateTimeDt theValue) { + myDate = theValue; + return this; + } + + /** + * Sets the value for date (When the exposure occurred) + * + *

+ * Definition: + * Identifies the initial date of the exposure that is suspected to be related to the reaction + *

+ */ + public Exposure setDate( Date theDate, TemporalPrecisionEnum thePrecision) { + myDate = new DateTimeDt(theDate, thePrecision); + return this; + } + + /** + * Sets the value for date (When the exposure occurred) + * + *

+ * Definition: + * Identifies the initial date of the exposure that is suspected to be related to the reaction + *

+ */ + public Exposure setDateWithSecondsPrecision( Date theDate) { + myDate = new DateTimeDt(theDate); + return this; + } + + + /** + * Gets the value(s) for type (drugadmin | immuniz | coincidental). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The type of exposure: Drug Administration, Immunization, Coincidental + *

+ */ + public BoundCodeDt getType() { + if (myType == null) { + myType = new BoundCodeDt(ExposureTypeEnum.VALUESET_BINDER); + } + return myType; + } + + /** + * Sets the value(s) for type (drugadmin | immuniz | coincidental) + * + *

+ * Definition: + * The type of exposure: Drug Administration, Immunization, Coincidental + *

+ */ + public Exposure setType(BoundCodeDt theValue) { + myType = theValue; + return this; + } + + /** + * Sets the value(s) for type (drugadmin | immuniz | coincidental) + * + *

+ * Definition: + * The type of exposure: Drug Administration, Immunization, Coincidental + *

+ */ + public Exposure setType(ExposureTypeEnum theValue) { + getType().setValueAsEnum(theValue); + return this; + } + + + /** + * Gets the value(s) for causalityExpectation (likely | unlikely | confirmed | unknown). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * A statement of how confident that the recorder was that this exposure caused the reaction + *

+ */ + public BoundCodeDt getCausalityExpectation() { + if (myCausalityExpectation == null) { + myCausalityExpectation = new BoundCodeDt(CausalityExpectationEnum.VALUESET_BINDER); + } + return myCausalityExpectation; + } + + /** + * Sets the value(s) for causalityExpectation (likely | unlikely | confirmed | unknown) + * + *

+ * Definition: + * A statement of how confident that the recorder was that this exposure caused the reaction + *

+ */ + public Exposure setCausalityExpectation(BoundCodeDt theValue) { + myCausalityExpectation = theValue; + return this; + } + + /** + * Sets the value(s) for causalityExpectation (likely | unlikely | confirmed | unknown) + * + *

+ * Definition: + * A statement of how confident that the recorder was that this exposure caused the reaction + *

+ */ + public Exposure setCausalityExpectation(CausalityExpectationEnum theValue) { + getCausalityExpectation().setValueAsEnum(theValue); + return this; + } + + + /** + * Gets the value(s) for substance (Presumed causative substance). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * Substance that is presumed to have caused the adverse reaction + *

+ */ + public ResourceReferenceDt getSubstance() { + if (mySubstance == null) { + mySubstance = new ResourceReferenceDt(); + } + return mySubstance; + } + + /** + * Sets the value(s) for substance (Presumed causative substance) + * + *

+ * Definition: + * Substance that is presumed to have caused the adverse reaction + *

+ */ + public Exposure setSubstance(ResourceReferenceDt theValue) { + mySubstance = theValue; + return this; + } + + + + } + + + + +} \ No newline at end of file diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Conformance.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Conformance.java index 15647099462..c6929b3d8bd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Conformance.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Conformance.java @@ -740,7 +740,7 @@ public class Conformance extends BaseResource implements IResource { * A flag to indicate that this conformance statement is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage *

*/ - public Conformance setExperimental( Boolean theBoolean) { + public Conformance setExperimental( boolean theBoolean) { myExperimental = new BooleanDt(theBoolean); return this; } @@ -947,7 +947,7 @@ public class Conformance extends BaseResource implements IResource { * A flag that indicates whether the application accepts unknown elements as part of a resource. *

*/ - public Conformance setAcceptUnknown( Boolean theBoolean) { + public Conformance setAcceptUnknown( boolean theBoolean) { myAcceptUnknown = new BooleanDt(theBoolean); return this; } @@ -2134,7 +2134,7 @@ public class Conformance extends BaseResource implements IResource { * Server adds CORS headers when responding to requests - this enables javascript applications to yuse the server *

*/ - public RestSecurity setCors( Boolean theBoolean) { + public RestSecurity setCors( boolean theBoolean) { myCors = new BooleanDt(theBoolean); return this; } @@ -2689,7 +2689,7 @@ public class Conformance extends BaseResource implements IResource { * A flag for whether the server is able to return past versions as part of the vRead operation *

*/ - public RestResource setReadHistory( Boolean theBoolean) { + public RestResource setReadHistory( boolean theBoolean) { myReadHistory = new BooleanDt(theBoolean); return this; } @@ -2733,7 +2733,7 @@ public class Conformance extends BaseResource implements IResource { * A flag to indicate that the server allows the client to create new identities on the server. If the update operation is used (client) or allowed (server) to a new location where a resource doesn't already exist. This means that the server allows the client to create new identities on the server *

*/ - public RestResource setUpdateCreate( Boolean theBoolean) { + public RestResource setUpdateCreate( boolean theBoolean) { myUpdateCreate = new BooleanDt(theBoolean); return this; } @@ -3920,7 +3920,7 @@ public class Conformance extends BaseResource implements IResource { * Length if the receiver's reliable messaging cache (if a receiver) or how long the cache length on the receiver should be (if a sender) *

*/ - public Messaging setReliableCache( Integer theInteger) { + public Messaging setReliableCache( int theInteger) { myReliableCache = new IntegerDt(theInteger); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java index 433517b1d29..6a228a410f0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java @@ -31,6 +31,7 @@ import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu.composite.ContactDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.primitive.DateDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.UriDt; @@ -306,7 +307,43 @@ public class Device extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Instance id from manufacturer, owner and others) + * + *

+ * Definition: + * Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Device addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Instance id from manufacturer, owner and others) + * + *

+ * Definition: + * Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Device addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for type (What kind of device this is). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticOrder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticOrder.java index ae166d621ec..c1ebe512972 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticOrder.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticOrder.java @@ -35,6 +35,7 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.DiagnosticOrderPriorityEnum; import ca.uhn.fhir.model.dstu.valueset.DiagnosticOrderStatusEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.DateTimeDt; @@ -434,7 +435,43 @@ public class DiagnosticOrder extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Identifiers assigned to this order) + * + *

+ * Definition: + * Identifiers assigned to this order by the order or by the receiver + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public DiagnosticOrder addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Identifiers assigned to this order) + * + *

+ * Definition: + * Identifiers assigned to this order by the order or by the receiver + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public DiagnosticOrder addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for encounter (The encounter that this diagnostic order is associated with). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticReport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticReport.java index 489c747328d..f153b988c7f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticReport.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/DiagnosticReport.java @@ -37,6 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.PeriodDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.DiagnosticReportStatusEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.DateTimeDt; @@ -556,7 +557,33 @@ public class DiagnosticReport extends BaseResource implements IResource { return this; } - + /** + * Sets the value for identifier (Id for external references to this report) + * + *

+ * Definition: + * The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider + *

+ */ + public DiagnosticReport setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for identifier (Id for external references to this report) + * + *

+ * Definition: + * The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider + *

+ */ + public DiagnosticReport setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for requestDetail (What was requested). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Encounter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Encounter.java index 51d1c25f8ff..2bff69d41bc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Encounter.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Encounter.java @@ -38,6 +38,7 @@ import ca.uhn.fhir.model.dstu.valueset.EncounterClassEnum; import ca.uhn.fhir.model.dstu.valueset.EncounterReasonCodesEnum; import ca.uhn.fhir.model.dstu.valueset.EncounterStateEnum; import ca.uhn.fhir.model.dstu.valueset.EncounterTypeEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.ParticipantTypeEnum; import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.BoundCodeDt; @@ -341,7 +342,43 @@ public class Encounter extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Identifier(s) by which this encounter is known) + * + *

+ * Definition: + * + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Encounter addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Identifier(s) by which this encounter is known) + * + *

+ * Definition: + * + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Encounter addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for status (planned | in progress | onleave | finished | cancelled). * creating it if it does @@ -1179,7 +1216,33 @@ public class Encounter extends BaseResource implements IResource { return this; } - + /** + * Sets the value for preAdmissionIdentifier (Pre-admission identifier) + * + *

+ * Definition: + * + *

+ */ + public Hospitalization setPreAdmissionIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myPreAdmissionIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for preAdmissionIdentifier (Pre-admission identifier) + * + *

+ * Definition: + * + *

+ */ + public Hospitalization setPreAdmissionIdentifier( String theSystem, String theValue) { + myPreAdmissionIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for origin (The location from which the patient came before admission). * creating it if it does @@ -1628,7 +1691,7 @@ public class Encounter extends BaseResource implements IResource { * Whether this hospitalization is a readmission *

*/ - public Hospitalization setReAdmission( Boolean theBoolean) { + public Hospitalization setReAdmission( boolean theBoolean) { myReAdmission = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java index ce9b0bb4220..47aba66bba1 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java @@ -35,6 +35,7 @@ import ca.uhn.fhir.model.dstu.composite.QuantityDt; import ca.uhn.fhir.model.dstu.composite.RangeDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.GroupTypeEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; @@ -258,7 +259,33 @@ public class Group extends BaseResource implements IResource { return this; } - + /** + * Sets the value for identifier (Unique id) + * + *

+ * Definition: + * A unique business identifier for this group + *

+ */ + public Group setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for identifier (Unique id) + * + *

+ * Definition: + * A unique business identifier for this group + *

+ */ + public Group setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for type (person | animal | practitioner | device | medication | substance). * creating it if it does @@ -341,7 +368,7 @@ public class Group extends BaseResource implements IResource { * If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals *

*/ - public Group setActual( Boolean theBoolean) { + public Group setActual( boolean theBoolean) { myActual = new BooleanDt(theBoolean); return this; } @@ -460,7 +487,7 @@ public class Group extends BaseResource implements IResource { * A count of the number of resource instances that are part of the group *

*/ - public Group setQuantity( Integer theInteger) { + public Group setQuantity( int theInteger) { myQuantity = new IntegerDt(theInteger); return this; } @@ -717,7 +744,7 @@ public class Group extends BaseResource implements IResource { * If true, indicates the characteristic is one that is NOT held by members of the group *

*/ - public Characteristic setExclude( Boolean theBoolean) { + public Characteristic setExclude( boolean theBoolean) { myExclude = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ImagingStudy.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ImagingStudy.java index 90a59c086c4..32fb139d8d7 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ImagingStudy.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ImagingStudy.java @@ -33,6 +33,7 @@ import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.dstu.composite.CodingDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.ImagingModalityEnum; import ca.uhn.fhir.model.dstu.valueset.InstanceAvailabilityEnum; import ca.uhn.fhir.model.dstu.valueset.ModalityEnum; @@ -455,7 +456,33 @@ public class ImagingStudy extends BaseResource implements IResource { return this; } - + /** + * Sets the value for accessionNo (Accession Number (0008,0050)) + * + *

+ * Definition: + * Accession Number + *

+ */ + public ImagingStudy setAccessionNo( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myAccessionNo = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for accessionNo (Accession Number (0008,0050)) + * + *

+ * Definition: + * Accession Number + *

+ */ + public ImagingStudy setAccessionNo( String theSystem, String theValue) { + myAccessionNo = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for identifier (Other identifiers for the study (0020,0010)). * creating it if it does @@ -515,7 +542,43 @@ public class ImagingStudy extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Other identifiers for the study (0020,0010)) + * + *

+ * Definition: + * Other identifiers for the study + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public ImagingStudy addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Other identifiers for the study (0020,0010)) + * + *

+ * Definition: + * Other identifiers for the study + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public ImagingStudy addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for order (Order(s) that caused this study to be performed). * creating it if it does @@ -774,7 +837,7 @@ public class ImagingStudy extends BaseResource implements IResource { * Number of Series in Study *

*/ - public ImagingStudy setNumberOfSeries( Integer theInteger) { + public ImagingStudy setNumberOfSeries( int theInteger) { myNumberOfSeries = new IntegerDt(theInteger); return this; } @@ -818,7 +881,7 @@ public class ImagingStudy extends BaseResource implements IResource { * Number of SOP Instances in Study *

*/ - public ImagingStudy setNumberOfInstances( Integer theInteger) { + public ImagingStudy setNumberOfInstances( int theInteger) { myNumberOfInstances = new IntegerDt(theInteger); return this; } @@ -1198,7 +1261,7 @@ public class ImagingStudy extends BaseResource implements IResource { * The number of this series in the overall sequence *

*/ - public Series setNumber( Integer theInteger) { + public Series setNumber( int theInteger) { myNumber = new IntegerDt(theInteger); return this; } @@ -1361,7 +1424,7 @@ public class ImagingStudy extends BaseResource implements IResource { * Sequence that contains attributes from the *

*/ - public Series setNumberOfInstances( Integer theInteger) { + public Series setNumberOfInstances( int theInteger) { myNumberOfInstances = new IntegerDt(theInteger); return this; } @@ -1722,7 +1785,7 @@ public class ImagingStudy extends BaseResource implements IResource { * The number of this image in the series *

*/ - public SeriesInstance setNumber( Integer theInteger) { + public SeriesInstance setNumber( int theInteger) { myNumber = new IntegerDt(theInteger); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java index 50e107b0111..35e5cf888a8 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java @@ -33,6 +33,7 @@ import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu.composite.ContactDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.LocationModeEnum; import ca.uhn.fhir.model.dstu.valueset.LocationStatusEnum; import ca.uhn.fhir.model.dstu.valueset.LocationTypeEnum; @@ -275,7 +276,33 @@ public class Location extends BaseResource implements IResource { return this; } - + /** + * Sets the value for identifier (Unique code or number identifying the location to its users) + * + *

+ * Definition: + * Unique code or number identifying the location to its users + *

+ */ + public Location setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for identifier (Unique code or number identifying the location to its users) + * + *

+ * Definition: + * Unique code or number identifying the location to its users + *

+ */ + public Location setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for name (Name of the location as used by humans). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Media.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Media.java index 69640695534..e643e588c0b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Media.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Media.java @@ -31,6 +31,7 @@ import ca.uhn.fhir.model.dstu.composite.AttachmentDt; import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.MediaTypeEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; @@ -376,7 +377,43 @@ public class Media extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Identifier(s) for the image) + * + *

+ * Definition: + * Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Media addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Identifier(s) for the image) + * + *

+ * Definition: + * Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Media addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for dateTime (When the media was taken/recorded (end)). * creating it if it does @@ -606,7 +643,7 @@ public class Media extends BaseResource implements IResource { * Height of the image in pixels(photo/video) *

*/ - public Media setHeight( Integer theInteger) { + public Media setHeight( int theInteger) { myHeight = new IntegerDt(theInteger); return this; } @@ -650,7 +687,7 @@ public class Media extends BaseResource implements IResource { * Width of the image in pixels (photo/video) *

*/ - public Media setWidth( Integer theInteger) { + public Media setWidth( int theInteger) { myWidth = new IntegerDt(theInteger); return this; } @@ -694,7 +731,7 @@ public class Media extends BaseResource implements IResource { * The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required *

*/ - public Media setFrames( Integer theInteger) { + public Media setFrames( int theInteger) { myFrames = new IntegerDt(theInteger); return this; } @@ -738,7 +775,7 @@ public class Media extends BaseResource implements IResource { * The length of the recording in seconds - for audio and video *

*/ - public Media setLength( Integer theInteger) { + public Media setLength( int theInteger) { myLength = new IntegerDt(theInteger); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java index b50ca0b2d82..f31a05d0edc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java @@ -306,7 +306,7 @@ public class Medication extends BaseResource implements IResource { * Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is) *

*/ - public Medication setIsBrand( Boolean theBoolean) { + public Medication setIsBrand( boolean theBoolean) { myIsBrand = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java index c6abfbc08ce..1ec5d2581e1 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java @@ -40,10 +40,12 @@ import ca.uhn.fhir.model.dstu.composite.RangeDt; import ca.uhn.fhir.model.dstu.composite.RatioDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.SampledDataDt; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.ObservationInterpretationCodesEnum; import ca.uhn.fhir.model.dstu.valueset.ObservationRelationshipTypeEnum; import ca.uhn.fhir.model.dstu.valueset.ObservationReliabilityEnum; import ca.uhn.fhir.model.dstu.valueset.ObservationStatusEnum; +import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt; import ca.uhn.fhir.model.primitive.CodeDt; @@ -782,7 +784,33 @@ public class Observation extends BaseResource implements IResource { return this; } - + /** + * Sets the value for identifier (Unique Id for this particular observation) + * + *

+ * Definition: + * A unique identifier for the simple observation + *

+ */ + public Observation setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for identifier (Unique Id for this particular observation) + * + *

+ * Definition: + * A unique identifier for the simple observation + *

+ */ + public Observation setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for subject (Who and/or what this is about). * creating it if it does @@ -1088,7 +1116,59 @@ public class Observation extends BaseResource implements IResource { return this; } - + /** + * Sets the value for low (Low Range, if relevant) + * + *

+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *

+ */ + public ReferenceRange setLow( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for low (Low Range, if relevant) + * + *

+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *

+ */ + public ReferenceRange setLow( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for low (Low Range, if relevant) + * + *

+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *

+ */ + public ReferenceRange setLow( long theValue) { + myLow = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for low (Low Range, if relevant) + * + *

+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *

+ */ + public ReferenceRange setLow( double theValue) { + myLow = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for high (High Range, if relevant). * creating it if it does @@ -1119,7 +1199,59 @@ public class Observation extends BaseResource implements IResource { return this; } - + /** + * Sets the value for high (High Range, if relevant) + * + *

+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *

+ */ + public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for high (High Range, if relevant) + * + *

+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *

+ */ + public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for high (High Range, if relevant) + * + *

+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *

+ */ + public ReferenceRange setHigh( long theValue) { + myHigh = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for high (High Range, if relevant) + * + *

+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *

+ */ + public ReferenceRange setHigh( double theValue) { + myHigh = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for meaning (Indicates the meaning/use of this range of this range). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java index 4116f5f1289..8fc8f7dfd71 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java @@ -35,6 +35,7 @@ import ca.uhn.fhir.model.dstu.composite.HumanNameDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.OrganizationTypeEnum; import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt; @@ -271,7 +272,43 @@ public class Organization extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Identifies this organization across multiple systems) + * + *

+ * Definition: + * Identifier for the organization that is used to identify the organization across multiple disparate systems + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Organization addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Identifies this organization across multiple systems) + * + *

+ * Definition: + * Identifier for the organization that is used to identify the organization across multiple disparate systems + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Organization addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for name (Name used for the organization). * creating it if it does @@ -653,7 +690,7 @@ public class Organization extends BaseResource implements IResource { * Whether the organization's record is still in active use *

*/ - public Organization setActive( Boolean theBoolean) { + public Organization setActive( boolean theBoolean) { myActive = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java index 53e15910b69..057f9fd05da 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java @@ -40,6 +40,7 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum; import ca.uhn.fhir.model.dstu.valueset.AnimalSpeciesEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.LinkTypeEnum; import ca.uhn.fhir.model.dstu.valueset.MaritalStatusCodesEnum; import ca.uhn.fhir.model.primitive.BooleanDt; @@ -423,7 +424,43 @@ public class Patient extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (An identifier for the person as this patient) + * + *

+ * Definition: + * An identifier that applies to this person as a patient + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Patient addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (An identifier for the person as this patient) + * + *

+ * Definition: + * An identifier that applies to this person as a patient + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Patient addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for name (A name associated with the patient). * creating it if it does @@ -1186,7 +1223,7 @@ public class Patient extends BaseResource implements IResource { * Whether this patient record is in active use *

*/ - public Patient setActive( Boolean theBoolean) { + public Patient setActive( boolean theBoolean) { myActive = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java index d1190da60f2..dbf3c9d5a1f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java @@ -39,6 +39,7 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.PeriodDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.PractitionerRoleEnum; import ca.uhn.fhir.model.dstu.valueset.PractitionerSpecialtyEnum; import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt; @@ -330,7 +331,43 @@ public class Practitioner extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (A identifier for the person as this agent) + * + *

+ * Definition: + * An identifier that applies to this person in this role + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Practitioner addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (A identifier for the person as this agent) + * + *

+ * Definition: + * An identifier that applies to this person in this role + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Practitioner addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for name (A name associated with the person). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java index aefb56cb3cd..b4fdd0fb33b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java @@ -732,7 +732,7 @@ public class Profile extends BaseResource implements IResource { * This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage *

*/ - public Profile setExperimental( Boolean theBoolean) { + public Profile setExperimental( boolean theBoolean) { myExperimental = new BooleanDt(theBoolean); return this; } @@ -1553,7 +1553,7 @@ public class Profile extends BaseResource implements IResource { * This definition of a profile on a structure is published as a formal statement. Some structural definitions might be defined purely for internal use within the profile, and not intended to be used outside that context *

*/ - public Structure setPublish( Boolean theBoolean) { + public Structure setPublish( boolean theBoolean) { myPublish = new BooleanDt(theBoolean); return this; } @@ -2128,7 +2128,7 @@ public class Profile extends BaseResource implements IResource { * If the matching elements have to occur in the same order as defined in the profile *

*/ - public StructureElementSlicing setOrdered( Boolean theBoolean) { + public StructureElementSlicing setOrdered( boolean theBoolean) { myOrdered = new BooleanDt(theBoolean); return this; } @@ -2627,7 +2627,7 @@ public class Profile extends BaseResource implements IResource { * The minimum number of times this element SHALL appear in the instance *

*/ - public StructureElementDefinition setMin( Integer theInteger) { + public StructureElementDefinition setMin( int theInteger) { myMin = new IntegerDt(theInteger); return this; } @@ -2875,7 +2875,7 @@ public class Profile extends BaseResource implements IResource { * Indicates the shortest length that SHALL be supported by conformant instances without truncation *

*/ - public StructureElementDefinition setMaxLength( Integer theInteger) { + public StructureElementDefinition setMaxLength( int theInteger) { myMaxLength = new IntegerDt(theInteger); return this; } @@ -3057,7 +3057,7 @@ public class Profile extends BaseResource implements IResource { * If true, conformant resource authors SHALL be capable of providing a value for the element and resource consumers SHALL be capable of extracting and doing something useful with the data element. If false, the element may be ignored and not supported *

*/ - public StructureElementDefinition setMustSupport( Boolean theBoolean) { + public StructureElementDefinition setMustSupport( boolean theBoolean) { myMustSupport = new BooleanDt(theBoolean); return this; } @@ -3101,7 +3101,7 @@ public class Profile extends BaseResource implements IResource { * If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system. *

*/ - public StructureElementDefinition setIsModifier( Boolean theBoolean) { + public StructureElementDefinition setIsModifier( boolean theBoolean) { myIsModifier = new BooleanDt(theBoolean); return this; } @@ -3831,7 +3831,7 @@ public class Profile extends BaseResource implements IResource { * If true, then conformant systems may use additional codes or (where the data type permits) text alone to convey concepts not covered by the set of codes identified in the binding. If false, then conformant systems are constrained to the provided codes alone *

*/ - public StructureElementDefinitionBinding setIsExtensible( Boolean theBoolean) { + public StructureElementDefinitionBinding setIsExtensible( boolean theBoolean) { myIsExtensible = new BooleanDt(theBoolean); return this; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/RelatedPerson.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/RelatedPerson.java index 043297b27d3..4a7dba81c3a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/RelatedPerson.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/RelatedPerson.java @@ -33,6 +33,7 @@ import ca.uhn.fhir.model.dstu.composite.HumanNameDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.PatientRelationshipTypeEnum; import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt; @@ -258,7 +259,43 @@ public class RelatedPerson extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (A Human identifier for this person) + * + *

+ * Definition: + * Identifier for a person within a particular scope. + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public RelatedPerson addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (A Human identifier for this person) + * + *

+ * Definition: + * Identifier for a person within a particular scope. + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public RelatedPerson addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for patient (The patient this person is related to). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java index e7b13141477..1857ff88abf 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java @@ -37,6 +37,8 @@ import ca.uhn.fhir.model.dstu.composite.PeriodDt; import ca.uhn.fhir.model.dstu.composite.QuantityDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.HierarchicalRelationshipTypeEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; +import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; import ca.uhn.fhir.model.dstu.valueset.SpecimenCollectionMethodEnum; import ca.uhn.fhir.model.dstu.valueset.SpecimenTreatmentProcedureEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; @@ -217,7 +219,43 @@ public class Specimen extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (External Identifier) + * + *

+ * Definition: + * Id for specimen + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Specimen addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (External Identifier) + * + *

+ * Definition: + * Id for specimen + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Specimen addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for type (Kind of material that forms the specimen). * creating it if it does @@ -367,7 +405,33 @@ public class Specimen extends BaseResource implements IResource { return this; } - + /** + * Sets the value for accessionIdentifier (Identifier assigned by the lab) + * + *

+ * Definition: + * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures. + *

+ */ + public Specimen setAccessionIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myAccessionIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for accessionIdentifier (Identifier assigned by the lab) + * + *

+ * Definition: + * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures. + *

+ */ + public Specimen setAccessionIdentifier( String theSystem, String theValue) { + myAccessionIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for receivedTime (The time when specimen was received for processing). * creating it if it does @@ -952,7 +1016,59 @@ public class Specimen extends BaseResource implements IResource { return this; } - + /** + * Sets the value for quantity (The quantity of specimen collected) + * + *

+ * Definition: + * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample + *

+ */ + public Collection setQuantity( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myQuantity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for quantity (The quantity of specimen collected) + * + *

+ * Definition: + * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample + *

+ */ + public Collection setQuantity( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myQuantity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for quantity (The quantity of specimen collected) + * + *

+ * Definition: + * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample + *

+ */ + public Collection setQuantity( long theValue) { + myQuantity = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for quantity (The quantity of specimen collected) + * + *

+ * Definition: + * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample + *

+ */ + public Collection setQuantity( double theValue) { + myQuantity = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for method (Technique used to perform collection). * creating it if it does @@ -1348,7 +1464,43 @@ public class Specimen extends BaseResource implements IResource { } return getIdentifier().get(0); } - + /** + * Adds a new value for identifier (Id for the container) + * + *

+ * Definition: + * Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Container addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel)); + return this; + } + + /** + * Adds a new value for identifier (Id for the container) + * + *

+ * Definition: + * Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances + *

+ * + * @return Returns a reference to this object, to allow for simple chaining. + */ + public Container addIdentifier( String theSystem, String theValue) { + if (myIdentifier == null) { + myIdentifier = new java.util.ArrayList(); + } + myIdentifier.add(new IdentifierDt(theSystem, theValue)); + return this; + } + + /** * Gets the value(s) for description (Textual description of the container). * creating it if it does @@ -1454,7 +1606,59 @@ public class Specimen extends BaseResource implements IResource { return this; } - + /** + * Sets the value for capacity (Container volume or size) + * + *

+ * Definition: + * The capacity (volume or other measure) the container may contain. + *

+ */ + public Container setCapacity( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myCapacity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for capacity (Container volume or size) + * + *

+ * Definition: + * The capacity (volume or other measure) the container may contain. + *

+ */ + public Container setCapacity( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myCapacity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for capacity (Container volume or size) + * + *

+ * Definition: + * The capacity (volume or other measure) the container may contain. + *

+ */ + public Container setCapacity( long theValue) { + myCapacity = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for capacity (Container volume or size) + * + *

+ * Definition: + * The capacity (volume or other measure) the container may contain. + *

+ */ + public Container setCapacity( double theValue) { + myCapacity = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for specimenQuantity (Quantity of specimen within container). * creating it if it does @@ -1485,7 +1689,59 @@ public class Specimen extends BaseResource implements IResource { return this; } - + /** + * Sets the value for specimenQuantity (Quantity of specimen within container) + * + *

+ * Definition: + * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type + *

+ */ + public Container setSpecimenQuantity( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + mySpecimenQuantity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for specimenQuantity (Quantity of specimen within container) + * + *

+ * Definition: + * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type + *

+ */ + public Container setSpecimenQuantity( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + mySpecimenQuantity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for specimenQuantity (Quantity of specimen within container) + * + *

+ * Definition: + * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type + *

+ */ + public Container setSpecimenQuantity( long theValue) { + mySpecimenQuantity = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for specimenQuantity (Quantity of specimen within container) + * + *

+ * Definition: + * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type + *

+ */ + public Container setSpecimenQuantity( double theValue) { + mySpecimenQuantity = new QuantityDt(theValue); + return this; + } + + /** * Gets the value(s) for additive (Additive associated with container). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java index ae3ec477cff..44a43479f56 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java @@ -35,6 +35,8 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.QuantityDt; import ca.uhn.fhir.model.dstu.composite.RatioDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; +import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; import ca.uhn.fhir.model.dstu.valueset.SubstanceTypeEnum; import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt; import ca.uhn.fhir.model.primitive.DateTimeDt; @@ -410,7 +412,33 @@ public class Substance extends BaseResource implements IResource { return this; } - + /** + * Sets the value for identifier (Identifier of the package/container) + * + *

+ * Definition: + * Identifier associated with the package/container (usually a label affixed directly) + *

+ */ + public Instance setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for identifier (Identifier of the package/container) + * + *

+ * Definition: + * Identifier associated with the package/container (usually a label affixed directly) + *

+ */ + public Instance setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for expiry (When no longer valid to use). * creating it if it does @@ -498,7 +526,59 @@ public class Substance extends BaseResource implements IResource { return this; } - + /** + * Sets the value for quantity (Amount of substance in the package) + * + *

+ * Definition: + * The amount of the substance + *

+ */ + public Instance setQuantity( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myQuantity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for quantity (Amount of substance in the package) + * + *

+ * Definition: + * The amount of the substance + *

+ */ + public Instance setQuantity( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { + myQuantity = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for quantity (Amount of substance in the package) + * + *

+ * Definition: + * The amount of the substance + *

+ */ + public Instance setQuantity( long theValue) { + myQuantity = new QuantityDt(theValue); + return this; + } + + /** + * Sets the value for quantity (Amount of substance in the package) + * + *

+ * Definition: + * The amount of the substance + *

+ */ + public Instance setQuantity( double theValue) { + myQuantity = new QuantityDt(theValue); + return this; + } + + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java index 2001b84a87f..c1194bde529 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java @@ -33,6 +33,7 @@ import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.dstu.composite.ContactDt; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.valueset.FilterOperatorEnum; +import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu.valueset.ValueSetStatusEnum; import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.BoundCodeDt; @@ -691,7 +692,7 @@ public class ValueSet extends BaseResource implements IResource { * This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage *

*/ - public ValueSet setExperimental( Boolean theBoolean) { + public ValueSet setExperimental( boolean theBoolean) { myExperimental = new BooleanDt(theBoolean); return this; } @@ -735,7 +736,7 @@ public class ValueSet extends BaseResource implements IResource { * Whether this is intended to be used with an extensible binding or not *

*/ - public ValueSet setExtensible( Boolean theBoolean) { + public ValueSet setExtensible( boolean theBoolean) { myExtensible = new BooleanDt(theBoolean); return this; } @@ -1072,7 +1073,7 @@ public class ValueSet extends BaseResource implements IResource { * If code comparison is case sensitive when codes within this system are compared to each other *

*/ - public Define setCaseSensitive( Boolean theBoolean) { + public Define setCaseSensitive( boolean theBoolean) { myCaseSensitive = new BooleanDt(theBoolean); return this; } @@ -1285,7 +1286,7 @@ public class ValueSet extends BaseResource implements IResource { * If this code is not for use as a real concept *

*/ - public DefineConcept setAbstract( Boolean theBoolean) { + public DefineConcept setAbstract( boolean theBoolean) { myAbstract = new BooleanDt(theBoolean); return this; } @@ -2241,7 +2242,33 @@ public class ValueSet extends BaseResource implements IResource { return this; } - + /** + * Sets the value for identifier (Uniquely identifies this expansion) + * + *

+ * Definition: + * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so + *

+ */ + public Expansion setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + return this; + } + + /** + * Sets the value for identifier (Uniquely identifies this expansion) + * + *

+ * Definition: + * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so + *

+ */ + public Expansion setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); + return this; + } + + /** * Gets the value(s) for timestamp (Time valueset expansion happened). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/CausalityExpectationEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/CausalityExpectationEnum.java new file mode 100644 index 00000000000..fa4dfc9ebac --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/CausalityExpectationEnum.java @@ -0,0 +1,131 @@ + +package ca.uhn.fhir.model.dstu.valueset; + +import java.util.HashMap; +import java.util.Map; + +import ca.uhn.fhir.model.api.IValueSetEnumBinder; + +public enum CausalityExpectationEnum { + + /** + * Code Value: likely + * + * Likely that this specific exposure caused the reaction. + */ + LIKELY("likely", "http://hl7.org/fhir/causalityExpectation"), + + /** + * Code Value: unlikely + * + * Unlikely that this specific exposure caused the reaction - the exposure is being linked to for information purposes. + */ + UNLIKELY("unlikely", "http://hl7.org/fhir/causalityExpectation"), + + /** + * Code Value: confirmed + * + * It has been confirmed that this exposure was one of the causes of the reaction. + */ + CONFIRMED("confirmed", "http://hl7.org/fhir/causalityExpectation"), + + /** + * Code Value: unknown + * + * It is unknown whether this exposure had anything to do with the reaction. + */ + UNKNOWN("unknown", "http://hl7.org/fhir/causalityExpectation"), + + ; + + /** + * Identifier for this Value Set: + * http://hl7.org/fhir/vs/causalityExpectation + */ + public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/causalityExpectation"; + + /** + * Name for this Value Set: + * CausalityExpectation + */ + public static final String VALUESET_NAME = "CausalityExpectation"; + + private static Map CODE_TO_ENUM = new HashMap(); + private static Map> SYSTEM_TO_CODE_TO_ENUM = new HashMap>(); + + private final String myCode; + private final String mySystem; + + static { + for (CausalityExpectationEnum next : CausalityExpectationEnum.values()) { + CODE_TO_ENUM.put(next.getCode(), next); + + if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { + SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap()); + } + SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); + } + } + + /** + * Returns the code associated with this enumerated value + */ + public String getCode() { + return myCode; + } + + /** + * Returns the code system associated with this enumerated value + */ + public String getSystem() { + return mySystem; + } + + /** + * Returns the enumerated value associated with this code + */ + public CausalityExpectationEnum forCode(String theCode) { + CausalityExpectationEnum retVal = CODE_TO_ENUM.get(theCode); + return retVal; + } + + /** + * Converts codes to their respective enumerated values + */ + public static final IValueSetEnumBinder VALUESET_BINDER = new IValueSetEnumBinder() { + @Override + public String toCodeString(CausalityExpectationEnum theEnum) { + return theEnum.getCode(); + } + + @Override + public String toSystemString(CausalityExpectationEnum theEnum) { + return theEnum.getSystem(); + } + + @Override + public CausalityExpectationEnum fromCodeString(String theCodeString) { + return CODE_TO_ENUM.get(theCodeString); + } + + @Override + public CausalityExpectationEnum fromCodeString(String theCodeString, String theSystemString) { + Map map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); + if (map == null) { + return null; + } + return map.get(theCodeString); + } + + }; + + /** + * Constructor + */ + CausalityExpectationEnum(String theCode, String theSystem) { + myCode = theCode; + mySystem = theSystem; + } + + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ExposureTypeEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ExposureTypeEnum.java new file mode 100644 index 00000000000..6d927d418d8 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ExposureTypeEnum.java @@ -0,0 +1,124 @@ + +package ca.uhn.fhir.model.dstu.valueset; + +import java.util.HashMap; +import java.util.Map; + +import ca.uhn.fhir.model.api.IValueSetEnumBinder; + +public enum ExposureTypeEnum { + + /** + * Code Value: drugadmin + * + * Drug Administration. + */ + DRUGADMIN("drugadmin", "http://hl7.org/fhir/exposureType"), + + /** + * Code Value: immuniz + * + * Immunization. + */ + IMMUNIZ("immuniz", "http://hl7.org/fhir/exposureType"), + + /** + * Code Value: coincidental + * + * In the same area as the substance. + */ + COINCIDENTAL("coincidental", "http://hl7.org/fhir/exposureType"), + + ; + + /** + * Identifier for this Value Set: + * http://hl7.org/fhir/vs/exposureType + */ + public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/exposureType"; + + /** + * Name for this Value Set: + * ExposureType + */ + public static final String VALUESET_NAME = "ExposureType"; + + private static Map CODE_TO_ENUM = new HashMap(); + private static Map> SYSTEM_TO_CODE_TO_ENUM = new HashMap>(); + + private final String myCode; + private final String mySystem; + + static { + for (ExposureTypeEnum next : ExposureTypeEnum.values()) { + CODE_TO_ENUM.put(next.getCode(), next); + + if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { + SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap()); + } + SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); + } + } + + /** + * Returns the code associated with this enumerated value + */ + public String getCode() { + return myCode; + } + + /** + * Returns the code system associated with this enumerated value + */ + public String getSystem() { + return mySystem; + } + + /** + * Returns the enumerated value associated with this code + */ + public ExposureTypeEnum forCode(String theCode) { + ExposureTypeEnum retVal = CODE_TO_ENUM.get(theCode); + return retVal; + } + + /** + * Converts codes to their respective enumerated values + */ + public static final IValueSetEnumBinder VALUESET_BINDER = new IValueSetEnumBinder() { + @Override + public String toCodeString(ExposureTypeEnum theEnum) { + return theEnum.getCode(); + } + + @Override + public String toSystemString(ExposureTypeEnum theEnum) { + return theEnum.getSystem(); + } + + @Override + public ExposureTypeEnum fromCodeString(String theCodeString) { + return CODE_TO_ENUM.get(theCodeString); + } + + @Override + public ExposureTypeEnum fromCodeString(String theCodeString, String theSystemString) { + Map map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); + if (map == null) { + return null; + } + return map.get(theCodeString); + } + + }; + + /** + * Constructor + */ + ExposureTypeEnum(String theCode, String theSystem) { + myCode = theCode; + mySystem = theSystem; + } + + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ReactionSeverityEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ReactionSeverityEnum.java new file mode 100644 index 00000000000..3868cddd9c9 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/ReactionSeverityEnum.java @@ -0,0 +1,131 @@ + +package ca.uhn.fhir.model.dstu.valueset; + +import java.util.HashMap; +import java.util.Map; + +import ca.uhn.fhir.model.api.IValueSetEnumBinder; + +public enum ReactionSeverityEnum { + + /** + * Code Value: severe + * + * Severe complications arose due to the reaction. + */ + SEVERE("severe", "http://hl7.org/fhir/reactionSeverity"), + + /** + * Code Value: serious + * + * Serious inconvenience to the subject. + */ + SERIOUS("serious", "http://hl7.org/fhir/reactionSeverity"), + + /** + * Code Value: moderate + * + * Moderate inconvenience to the subject. + */ + MODERATE("moderate", "http://hl7.org/fhir/reactionSeverity"), + + /** + * Code Value: minor + * + * Minor inconvenience to the subject. + */ + MINOR("minor", "http://hl7.org/fhir/reactionSeverity"), + + ; + + /** + * Identifier for this Value Set: + * http://hl7.org/fhir/vs/reactionSeverity + */ + public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/reactionSeverity"; + + /** + * Name for this Value Set: + * ReactionSeverity + */ + public static final String VALUESET_NAME = "ReactionSeverity"; + + private static Map CODE_TO_ENUM = new HashMap(); + private static Map> SYSTEM_TO_CODE_TO_ENUM = new HashMap>(); + + private final String myCode; + private final String mySystem; + + static { + for (ReactionSeverityEnum next : ReactionSeverityEnum.values()) { + CODE_TO_ENUM.put(next.getCode(), next); + + if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { + SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap()); + } + SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); + } + } + + /** + * Returns the code associated with this enumerated value + */ + public String getCode() { + return myCode; + } + + /** + * Returns the code system associated with this enumerated value + */ + public String getSystem() { + return mySystem; + } + + /** + * Returns the enumerated value associated with this code + */ + public ReactionSeverityEnum forCode(String theCode) { + ReactionSeverityEnum retVal = CODE_TO_ENUM.get(theCode); + return retVal; + } + + /** + * Converts codes to their respective enumerated values + */ + public static final IValueSetEnumBinder VALUESET_BINDER = new IValueSetEnumBinder() { + @Override + public String toCodeString(ReactionSeverityEnum theEnum) { + return theEnum.getCode(); + } + + @Override + public String toSystemString(ReactionSeverityEnum theEnum) { + return theEnum.getSystem(); + } + + @Override + public ReactionSeverityEnum fromCodeString(String theCodeString) { + return CODE_TO_ENUM.get(theCodeString); + } + + @Override + public ReactionSeverityEnum fromCodeString(String theCodeString, String theSystemString) { + Map map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); + if (map == null) { + return null; + } + return map.get(theCodeString); + } + + }; + + /** + * Constructor + */ + ReactionSeverityEnum(String theCode, String theSystem) { + myCode = theCode; + mySystem = theSystem; + } + + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java index f0b0ffb863b..62baf6a0052 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java @@ -1,6 +1,10 @@ package ca.uhn.fhir.model.primitive; -import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.*; +import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.DAY; +import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.MILLI; +import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.MONTH; +import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.SECOND; +import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.YEAR; import java.text.ParseException; import java.util.Calendar; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java index 5df611e2bc3..8336a6f097b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java @@ -21,7 +21,7 @@ public class BooleanDt extends BasePrimitive { * Constructor */ @SimpleSetter - public BooleanDt(@SimpleSetter.Parameter(name="theBoolean") Boolean theBoolean) { + public BooleanDt(@SimpleSetter.Parameter(name="theBoolean") boolean theBoolean) { setValue(theBoolean); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodeableConceptDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodeableConceptDt.java index c3c51aa7f01..3b66614175a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodeableConceptDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodeableConceptDt.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.model.primitive; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.defaultString; import java.util.HashSet; import java.util.Set; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodingDt__.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodingDt__.java index 17d111f2844..15495309a09 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodingDt__.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BoundCodingDt__.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.model.primitive; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.defaultString; import ca.uhn.fhir.model.api.IValueSetEnumBinder; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.dstu.composite.CodingDt; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java index f4afcf5779b..61c4ca700ff 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.model.primitive; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.defaultString; import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.SimpleSetter; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java index 68ad259db5a..3345668488f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java @@ -38,7 +38,9 @@ public class DecimalDt extends BasePrimitive { */ @SimpleSetter public DecimalDt(@SimpleSetter.Parameter(name = "theValue") double theValue) { - setValue(new BigDecimal(theValue)); + // Use the valueOf here because the constructor gives crazy precision + // changes due to the floating point conversion + setValue(BigDecimal.valueOf(theValue)); } /** diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java index 6b29ed4ca5b..409e0f4e336 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java @@ -21,7 +21,7 @@ public class IntegerDt extends BasePrimitive { * Constructor */ @SimpleSetter - public IntegerDt(@SimpleSetter.Parameter(name = "theInteger") Integer theInteger) { + public IntegerDt(@SimpleSetter.Parameter(name = "theInteger") int theInteger) { setValue(theInteger); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java index 93f2173d7a4..bdbb3d520a0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java @@ -30,10 +30,12 @@ public class UriDt extends BasePrimitive { setValueAsString(theValue); } + @Override public URI getValue() { return myValue; } + @Override public void setValue(URI theValue) { myValue = theValue; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/INarrativeGenerator.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/INarrativeGenerator.java index 0dcde9c19be..b207ec295aa 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/INarrativeGenerator.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/INarrativeGenerator.java @@ -2,9 +2,10 @@ package ca.uhn.fhir.narrative; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.composite.NarrativeDt; +import ca.uhn.fhir.parser.DataFormatException; public interface INarrativeGenerator { - public NarrativeDt generateNarrative(String theProfile, IResource theResource); + public NarrativeDt generateNarrative(String theProfile, IResource theResource) throws DataFormatException; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGenerator.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGenerator.java index 06308aadf33..7bfe1c7309c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGenerator.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGenerator.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.narrative; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; import java.io.IOException; import java.io.InputStream; @@ -31,12 +31,12 @@ import org.thymeleaf.templateresolver.TemplateResolver; import org.thymeleaf.util.DOMUtils; import ca.uhn.fhir.context.ConfigurationException; -import ca.uhn.fhir.model.api.IDatatype; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.dstu.composite.QuantityDt; import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; import ca.uhn.fhir.model.primitive.XhtmlDt; +import ca.uhn.fhir.parser.DataFormatException; public class ThymeleafNarrativeGenerator implements INarrativeGenerator { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ThymeleafNarrativeGenerator.class); @@ -48,6 +48,24 @@ public class ThymeleafNarrativeGenerator implements INarrativeGenerator { private TemplateEngine myDatatypeTemplateEngine; + private boolean myIgnoreFailures = true; + + /** + * If set to true, which is the default, if any failure occurs during narrative generation the generator will suppress any generated exceptions, and simply return a default narrative + * indicating that no narrative is available. + */ + public boolean isIgnoreFailures() { + return myIgnoreFailures; + } + + /** + * If set to true, which is the default, if any failure occurs during narrative generation the generator will suppress any generated exceptions, and simply return a default narrative + * indicating that no narrative is available. + */ + public void setIgnoreFailures(boolean theIgnoreFailures) { + myIgnoreFailures = theIgnoreFailures; + } + public ThymeleafNarrativeGenerator() throws IOException { myProfileToNarrativeTemplate = new HashMap(); myDatatypeClassNameToNarrativeTemplate = new HashMap(); @@ -131,15 +149,18 @@ public class ThymeleafNarrativeGenerator implements INarrativeGenerator { try { Context context = new Context(); context.setVariable("resource", theResource); - context.setVariable("render", new SubElementRenderer()); String result = myProfileTemplateEngine.process(theProfile, context); result = result.replaceAll("\\s+", " ").replace("> ", ">").replace(" <", "<"); return new NarrativeDt(new XhtmlDt(result), NarrativeStatusEnum.GENERATED); } catch (Exception e) { - ourLog.error("Failed to generate narrative", e); - return null; + if (myIgnoreFailures) { + ourLog.error("Failed to generate narrative", e); + return new NarrativeDt(new XhtmlDt("
Error: no narrative available
"), NarrativeStatusEnum.EMPTY); + } else { + throw new DataFormatException(e); + } } } @@ -237,12 +258,4 @@ public class ThymeleafNarrativeGenerator implements INarrativeGenerator { } - public class SubElementRenderer { - - public String formatDt(IDatatype theDatatype) { - return "AAA
"; - } - - } - } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java index df0f387102a..57c8e632e74 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java @@ -12,11 +12,11 @@ public interface IParser { String encodeBundleToString(Bundle theBundle) throws DataFormatException, IOException; - void encodeBundleToWriter(Bundle theBundle, Writer theWriter) throws IOException; + void encodeBundleToWriter(Bundle theBundle, Writer theWriter) throws IOException, DataFormatException; String encodeResourceToString(IResource theResource) throws DataFormatException, IOException; - void encodeResourceToWriter(IResource theResource, Writer stringWriter) throws IOException; + void encodeResourceToWriter(IResource theResource, Writer stringWriter) throws IOException, DataFormatException; Bundle parseBundle(Reader theReader); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java index de5e10448f6..0a9c59ec7af 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.parser; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.io.IOException; import java.io.Reader; @@ -483,8 +484,16 @@ public class JsonParser extends BaseParser implements IParser { } else { theWriter.writeStartObject(); } - if (value.getReference().isEmpty() == false) { - theWriter.write("resource", value.getReference().getValueAsString()); + + String reference = value.getReference().getValue(); + if (StringUtils.isBlank(reference)) { + if (value.getResourceType() != null && StringUtils.isNotBlank(value.getResourceId())) { + reference = myContext.getResourceDefinition(value.getResourceType()).getName() + '/' + value.getResourceId(); + } + } + + if (StringUtils.isNotBlank(reference)) { + theWriter.write("resource", reference); } if (value.getDisplay().isEmpty() == false) { theWriter.write("display", value.getDisplay().getValueAsString()); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index 08d34b5a79e..c85257537cd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.parser; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.util.ArrayList; import java.util.HashMap; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java index 9619b1c45ab..e276b3da9a0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.parser; -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.io.Reader; import java.io.StringWriter; @@ -81,7 +82,7 @@ public class XmlParser extends BaseParser implements IParser { } @Override - public void encodeBundleToWriter(Bundle theBundle, Writer theWriter) { + public void encodeBundleToWriter(Bundle theBundle, Writer theWriter) throws DataFormatException { try { XMLStreamWriter eventWriter; eventWriter = myXmlOutputFactory.createXMLStreamWriter(theWriter); @@ -156,7 +157,7 @@ public class XmlParser extends BaseParser implements IParser { } @Override - public void encodeResourceToWriter(IResource theResource, Writer stringWriter) { + public void encodeResourceToWriter(IResource theResource, Writer stringWriter) throws DataFormatException { XMLStreamWriter eventWriter; try { eventWriter = myXmlOutputFactory.createXMLStreamWriter(stringWriter); @@ -409,14 +410,21 @@ public class XmlParser extends BaseParser implements IParser { } private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, ResourceReferenceDt theRef) throws XMLStreamException { + String reference = theRef.getReference().getValue(); + if (StringUtils.isBlank(reference)) { + if (theRef.getResourceType() != null && StringUtils.isNotBlank(theRef.getResourceId())) { + reference = myContext.getResourceDefinition(theRef.getResourceType()).getName() + '/' + theRef.getResourceId(); + } + } + if (!(theRef.getDisplay().isEmpty())) { theEventWriter.writeStartElement("display"); theEventWriter.writeAttribute("value", theRef.getDisplay().getValue()); theEventWriter.writeEndElement(); } - if (!(theRef.getReference().isEmpty())) { + if (StringUtils.isNotBlank(reference)) { theEventWriter.writeStartElement("reference"); - theEventWriter.writeAttribute("value", theRef.getReference().getValue()); + theEventWriter.writeAttribute("value", reference); theEventWriter.writeEndElement(); } } @@ -441,7 +449,7 @@ public class XmlParser extends BaseParser implements IParser { theEventWriter.writeEndElement(); } - private void encodeUndeclaredExtensions(RuntimeResourceDefinition theResDef, IResource theResource, XMLStreamWriter theWriter, List extensions, String tagName) throws XMLStreamException { + private void encodeUndeclaredExtensions(RuntimeResourceDefinition theResDef, IResource theResource, XMLStreamWriter theWriter, List extensions, String tagName) throws XMLStreamException, DataFormatException { for (UndeclaredExtension next : extensions) { theWriter.writeStartElement(tagName); theWriter.writeAttribute("url", next.getUrl()); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java index 9efb75dcff2..bf8aaaf5e95 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ReadMethodBinding.java @@ -15,7 +15,6 @@ import ca.uhn.fhir.rest.client.GetClientInvocation; import ca.uhn.fhir.rest.method.SearchMethodBinding.RequestType; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.IResourceProvider; -import ca.uhn.fhir.rest.server.Util; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java index c096b4c86c7..b08c7f025d0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchMethodBinding.java @@ -17,7 +17,6 @@ import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.client.GetClientInvocation; import ca.uhn.fhir.rest.param.IParameter; import ca.uhn.fhir.rest.server.IResourceProvider; -import ca.uhn.fhir.rest.server.Util; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.util.QueryUtil; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Util.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/Util.java similarity index 98% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Util.java rename to hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/Util.java index 7cca3cd7044..64517e67b32 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Util.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/Util.java @@ -1,4 +1,4 @@ -package ca.uhn.fhir.rest.server; +package ca.uhn.fhir.rest.method; import java.io.UnsupportedEncodingException; import java.lang.annotation.Annotation; @@ -25,7 +25,7 @@ import ca.uhn.fhir.util.ReflectionUtil; /** * Created by dsotnikov on 2/25/2014. */ -public class Util { +class Util { public static Map getQueryParams(String query) { try { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CollectionBinder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CollectionBinder.java index ba3e68f620c..eeb9aea8dd5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CollectionBinder.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/CollectionBinder.java @@ -15,7 +15,7 @@ public class CollectionBinder /** * @param thePositionDescription Just used in exceptions if theCollectionType is invalid */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "rawtypes", "cast" }) public static Class getInstantiableCollectionType(Class> theCollectionType, String thePositionDescription) { if (theCollectionType.equals(List.class) || theCollectionType .equals(ArrayList.class)) { return (Class) ArrayList.class; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/EncodingUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/EncodingUtil.java index 65cbb3f6977..ce2430b3bad 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/EncodingUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/EncodingUtil.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.server; -public enum EncodingUtil { +enum EncodingUtil { XML(Constants.CT_FHIR_XML, Constants.CT_ATOM_XML, Constants.CT_XML), diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java index 3c8c1df43b6..ae8a37ca7ec 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java @@ -25,6 +25,7 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.narrative.INarrativeGenerator; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.method.BaseMethodBinding; import ca.uhn.fhir.rest.method.Request; @@ -49,11 +50,28 @@ public abstract class RestfulServer extends HttpServlet { private FhirContext myFhirContext; private boolean myUseBrowserFriendlyContentTypes; + private INarrativeGenerator myNarrativeGenerator; + + public INarrativeGenerator getNarrativeGenerator() { + return myNarrativeGenerator; + } /** - * If set to true (default is false), the server will use browser friendly - * content-types (instead of standard FHIR ones) when it detects that the request - * is coming from a browser instead of a FHIR + * Sets the {@link INarrativeGenerator Narrative Generator} to use when serializing responses from this server, or null (which is the default) to disable narrative generation. + * + * @throws IllegalStateException + * Note that this method can only be called prior to {@link #init() initialization} and will throw an {@link IllegalStateException} if called after that. + */ + public void setNarrativeGenerator(INarrativeGenerator theNarrativeGenerator) { + if (myFhirContext != null) { + throw new IllegalStateException("Server has already been initialized, can not change this property"); + } + myNarrativeGenerator = theNarrativeGenerator; + } + + /** + * If set to true (default is false), the server will use browser friendly content-types (instead of standard FHIR ones) when it detects that the request is coming from a browser + * instead of a FHIR */ public void setUseBrowserFriendlyContentTypes(boolean theUseBrowserFriendlyContentTypes) { myUseBrowserFriendlyContentTypes = theUseBrowserFriendlyContentTypes; @@ -190,13 +208,12 @@ public abstract class RestfulServer extends HttpServlet { if (null != securityManager) { securityManager.authenticate(request); } - + String uaHeader = request.getHeader("user-agent"); boolean requestIsBrowser = false; if (uaHeader != null && uaHeader.contains("Mozilla")) { requestIsBrowser = true; } - String resourceName = null; String requestFullPath = StringUtils.defaultString(request.getRequestURI()); @@ -227,17 +244,17 @@ public abstract class RestfulServer extends HttpServlet { } int contextIndex; - if (servletPath.length()==0) { + if (servletPath.length() == 0) { contextIndex = requestUrl.indexOf(requestPath); - }else { + } else { contextIndex = requestUrl.indexOf(servletPath); } - + String fhirServerBase = requestUrl.substring(0, contextIndex + servletPath.length()); if (fhirServerBase.endsWith("/")) { fhirServerBase = fhirServerBase.substring(0, fhirServerBase.length() - 1); } - + String completeUrl = StringUtils.isNotBlank(request.getQueryString()) ? requestUrl + "?" + request.getQueryString() : requestUrl.toString(); Map params = new HashMap(request.getParameterMap()); @@ -346,7 +363,8 @@ public abstract class RestfulServer extends HttpServlet { } @Override - public void init() throws ServletException { + public final void init() throws ServletException { + initialize(); try { ourLog.info("Initializing HAPI FHIR restful server"); @@ -366,6 +384,7 @@ public abstract class RestfulServer extends HttpServlet { ourLog.info("Got {} resource providers", myTypeToProvider.size()); myFhirContext = new FhirContext(myTypeToProvider.keySet()); + myFhirContext.setNarrativeGenerator(myNarrativeGenerator); for (IResourceProvider provider : myTypeToProvider.values()) { findResourceMethods(provider); @@ -378,20 +397,29 @@ public abstract class RestfulServer extends HttpServlet { ourLog.error("An error occurred while loading request handlers!", ex); throw new ServletException("Failed to initialize FHIR Restful server", ex); } + + ourLog.info("A FHIR has been lit on this server"); + } + + /** + * This method may be overridden by subclasses to do perform initialization that needs to be performed prior to the server being used. + */ + protected void initialize() { + // nothing by default } private void streamResponseAsBundle(HttpServletResponse theHttpResponse, List theResult, EncodingUtil theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, boolean theRequestIsBrowser) throws IOException { assert !theServerBase.endsWith("/"); - + theHttpResponse.setStatus(200); - + if (theRequestIsBrowser && myUseBrowserFriendlyContentTypes) { theHttpResponse.setContentType(theResponseEncoding.getBrowserFriendlyBundleContentType()); } else { theHttpResponse.setContentType(theResponseEncoding.getBundleContentType()); } - + theHttpResponse.setCharacterEncoding("UTF-8"); Bundle bundle = new Bundle(); @@ -440,11 +468,15 @@ public abstract class RestfulServer extends HttpServlet { bundle.getTotalResults().setValue(theResult.size()); PrintWriter writer = theHttpResponse.getWriter(); - getNewParser(theResponseEncoding, thePrettyPrint).encodeBundleToWriter(bundle, writer); - writer.close(); + try { + getNewParser(theResponseEncoding, thePrettyPrint).encodeBundleToWriter(bundle, writer); + } finally { + writer.close(); + } } - private void streamResponseAsResource(HttpServletResponse theHttpResponse, IResource theResource, EncodingUtil theResponseEncoding, boolean thePrettyPrint, boolean theRequestIsBrowser) throws IOException { + private void streamResponseAsResource(HttpServletResponse theHttpResponse, IResource theResource, EncodingUtil theResponseEncoding, boolean thePrettyPrint, boolean theRequestIsBrowser) + throws IOException { theHttpResponse.setStatus(200); if (theRequestIsBrowser && myUseBrowserFriendlyContentTypes) { diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/DiagnosticReport.html b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/DiagnosticReport.html index 861faac08e7..bd36cbf605b 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/DiagnosticReport.html +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/DiagnosticReport.html @@ -1,13 +1,20 @@ + + + + + + + +
-
+
Complete Blood Count
-
- +
@@ -18,8 +25,8 @@ - - + + - + + + + +
Name
@@ -41,11 +48,21 @@ final
This is a comment
Lkc198 g/LH78 g/L - 99 g/Lfinal
Yet another comment
+ + + + + + diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/Patient.html b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/Patient.html index 3b6f1e0ee74..4bca7c22c10 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/Patient.html +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/Patient.html @@ -1,31 +1,46 @@ + + + + + + + +
-
+
Dr John SMITH - Esq + Jr
- - - - - - - - - - - - - +
Identifier8708660
Address - - 123 Fake Street
-
- Toronto - ON - Canada -
Date of birth - 22 March 2012 -
+ + + + + + + + + + + + + +
Identifier8708660
Address + + 123 Fake Street
+
+ Toronto + ON + Canada +
Date of birth + 22 March 2012 +
+ + + + + diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narrative.css b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narrative.css new file mode 100644 index 00000000000..8175c763521 --- /dev/null +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narrative.css @@ -0,0 +1,46 @@ + +BODY { + font-family: sans-serif; +} + +DIV.hapiHeaderText { + font-size: 1.3em; +} + +/******************************************************** +* The following section is used for tables of values +* with multiple columns (e.g. the table of Observations +* in a Diagnostic Report for a lab test) +********************************************************/ +TABLE.hapiTableOfValues THEAD TR TD { + background: #A0A0F0; + color: #000080; + font-size: 1.em; + font-weight: bold; + padding: 5px; +} + +TABLE.hapiTableOfValues TBODY TR TD { + padding-left: 5px; + padding-right: 5px; +} + +/* Even and odd row formatting */ +TR.hapiTableOfValuesRowOdd TD { + background: #C0C0C0; +} +TR.hapiTableOfValuesRowEven TD { + background: #F0F0F0; +} + +/******************************************************** +* The following section is used for property tables. These +* tables have two columns, one for the property name, and +* one for the property value +********************************************************/ + +TABLE.hapiPropertyTable TBODY TR TD:FIRST-CHILD { + background: #C0C0C0; + text-align: right; +} + diff --git a/hapi-fhir-base/src/site/example/java/example/QuickUsage.java b/hapi-fhir-base/src/site/example/java/example/QuickUsage.java new file mode 100644 index 00000000000..78f22115151 --- /dev/null +++ b/hapi-fhir-base/src/site/example/java/example/QuickUsage.java @@ -0,0 +1,14 @@ +package example; + +import ca.uhn.fhir.model.dstu.resource.Patient; + +public class QuickUsage { + +public void format() { + +Patient obs = new Patient(); + + +} + +} diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/model/primitive/DecimalDtTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/model/primitive/DecimalDtTest.java new file mode 100644 index 00000000000..73d63c9b98b --- /dev/null +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/model/primitive/DecimalDtTest.java @@ -0,0 +1,16 @@ +package ca.uhn.fhir.model.primitive; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class DecimalDtTest { + + @Test + public void testPrecision() { + DecimalDt dt = new DecimalDt(2.03); + assertEquals("2.03", dt.getValueAsString()); + + } + +} diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGeneratorTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGeneratorTest.java index 451d9d17af7..07e7449fa6e 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGeneratorTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/ThymeleafNarrativeGeneratorTest.java @@ -3,21 +3,32 @@ package ca.uhn.fhir.narrative; import java.io.IOException; import java.util.Date; +import org.junit.Before; import org.junit.Test; import ca.uhn.fhir.model.api.TemporalPrecisionEnum; +import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.dstu.composite.QuantityDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.DiagnosticReport; import ca.uhn.fhir.model.dstu.resource.Observation; import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.valueset.ObservationStatusEnum; +import ca.uhn.fhir.parser.DataFormatException; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; public class ThymeleafNarrativeGeneratorTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ThymeleafNarrativeGeneratorTest.class); + private ThymeleafNarrativeGenerator gen; + @Before + public void before() throws IOException { + gen = new ThymeleafNarrativeGenerator(); + gen.setIgnoreFailures(false); + } + @Test - public void testGeneratePatient() throws IOException { + public void testGeneratePatient() throws DataFormatException, InternalErrorException { Patient value = new Patient(); value.addIdentifier().setSystem("urn:names").setValue("123456"); @@ -27,14 +38,13 @@ public class ThymeleafNarrativeGeneratorTest { value.setBirthDate(new Date(), TemporalPrecisionEnum.DAY); - ThymeleafNarrativeGenerator gen = new ThymeleafNarrativeGenerator(); String output = gen.generateNarrative("http://hl7.org/fhir/profiles/Patient", value).getDiv().getValueAsString(); ourLog.info(output); } @Test - public void testGenerateDiagnosticReport() throws IOException { + public void testGenerateDiagnosticReport() throws DataFormatException, InternalErrorException { DiagnosticReport value = new DiagnosticReport(); value.getName().setText("Some Diagnostic Report"); @@ -42,14 +52,13 @@ public class ThymeleafNarrativeGeneratorTest { value.addResult().setReference("Observation/2"); value.addResult().setReference("Observation/3"); - ThymeleafNarrativeGenerator gen = new ThymeleafNarrativeGenerator(); String output = gen.generateNarrative("http://hl7.org/fhir/profiles/DiagnosticReport", value).getDiv().getValueAsString(); ourLog.info(output); } @Test - public void testGenerateDiagnosticReportWithObservations() throws IOException { + public void testGenerateDiagnosticReportWithObservations() throws DataFormatException, InternalErrorException { DiagnosticReport value = new DiagnosticReport(); value.getName().setText("Some Diagnostic Report"); @@ -63,8 +72,8 @@ public class ThymeleafNarrativeGeneratorTest { ResourceReferenceDt result = value.addResult(); result.setResource(obs); - ThymeleafNarrativeGenerator gen = new ThymeleafNarrativeGenerator(); - String output = gen.generateNarrative("http://hl7.org/fhir/profiles/DiagnosticReport", value).getDiv().getValueAsString(); + NarrativeDt generateNarrative = gen.generateNarrative("http://hl7.org/fhir/profiles/DiagnosticReport", value); + String output = generateNarrative.getDiv().getValueAsString(); ourLog.info(output); } diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java index 88ad792953c..9146d117597 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java @@ -22,6 +22,7 @@ import ca.uhn.fhir.model.api.UndeclaredExtension; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.DiagnosticReport; import ca.uhn.fhir.model.dstu.resource.Observation; +import ca.uhn.fhir.model.dstu.resource.Organization; import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.resource.Specimen; import ca.uhn.fhir.model.primitive.DecimalDt; @@ -29,6 +30,29 @@ import ca.uhn.fhir.model.primitive.DecimalDt; public class JsonParserTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserTest.class); + @Test + public void testEncodeResourceRef() throws DataFormatException, IOException { + + Patient patient = new Patient(); + patient.setManagingOrganization(new ResourceReferenceDt()); + + IParser p = new FhirContext().newJsonParser(); + String str = p.encodeResourceToString(patient); + assertThat(str, IsNot.not(StringContains.containsString("managingOrganization"))); + + patient.setManagingOrganization(new ResourceReferenceDt(Organization.class, "123")); + str = p.encodeResourceToString(patient); + assertThat(str, StringContains.containsString("\"managingOrganization\":{\"resource\":\"Organization/123\"}")); + + Organization org = new Organization(); + org.addIdentifier().setSystem("foo").setValue("bar"); + patient.setManagingOrganization(new ResourceReferenceDt(org)); + str = p.encodeResourceToString(patient); + assertThat(str, StringContains.containsString("\"contained\":[{\"resourceType\":\"Organization\"")); + + } + + @Test public void testSimpleResourceEncode() throws IOException { diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index 67c507042da..488260cee60 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -26,6 +26,7 @@ import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.DiagnosticReport; import ca.uhn.fhir.model.dstu.resource.Observation; +import ca.uhn.fhir.model.dstu.resource.Organization; import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.resource.Specimen; import ca.uhn.fhir.model.dstu.resource.ValueSet; @@ -61,6 +62,29 @@ public class XmlParserTest { assertThat(str, StringContains.containsString("")); assertThat(str, StringContains.containsString("")); } + + @Test + public void testEncodeResourceRef() throws DataFormatException, IOException { + + Patient patient = new Patient(); + patient.setManagingOrganization(new ResourceReferenceDt()); + + IParser p = new FhirContext().newXmlParser(); + String str = p.encodeResourceToString(patient); + assertThat(str, IsNot.not(StringContains.containsString("managingOrganization"))); + + patient.setManagingOrganization(new ResourceReferenceDt(Organization.class, "123")); + str = p.encodeResourceToString(patient); + assertThat(str, StringContains.containsString("")); + + Organization org = new Organization(); + org.addIdentifier().setSystem("foo").setValue("bar"); + patient.setManagingOrganization(new ResourceReferenceDt(org)); + str = p.encodeResourceToString(patient); + assertThat(str, StringContains.containsString(" ca.uhn.fhir.model.dstu + adversereaction conformance device diagnosticorder diff --git a/hapi-tinder-plugin/src/main/resources/res/adversereaction-spreadsheet.xml b/hapi-tinder-plugin/src/main/resources/res/adversereaction-spreadsheet.xml new file mode 100644 index 00000000000..aebc34f7333 --- /dev/null +++ b/hapi-tinder-plugin/src/main/resources/res/adversereaction-spreadsheet.xml @@ -0,0 +1,1087 @@ + + + + + Grahame + Lloyd McKenzie + 2012-03-19T11:12:07Z + 2013-12-28T16:48:43Z + 14.00 + + + + + + 2415 + 10005 + 0 + 0 + False + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Element + Card. + Inv. + Is Modifier + UML + Type + Binding + Short Name + Definition + Narrative + Aliases + Requirements + Comments + RIM Mapping + v2 Mapping + To Do + Committee Notes + Prov Mapping + + + AdverseReaction + + + + + Resource + + Specific reactions to a substance + Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance + Used to track reactions when it is unknown the exact cause but there's a desire to flag/track potential causes. Also used to capture reactions that are significant for inclusion in the health record or as evidence for an allergy or intolerance. + Observation[classCode=OBS, moodCode=EVN] + IAM-11-Onset Date (Does not allow for IAM-12-Onset Date Text) + + + + + AdverseReaction.identifier + 0..* + + + + Identifier + + External Ids for this adverse reaction + This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation) + Need to allow connection to a wider workflow + .id + + + + + + AdverseReaction.date + 0..1 + + + + dateTime + + When the reaction occurred + The date (and possibly time) when the reaction began + intro + + effectiveTime + + + + + + AdverseReaction.subject + 1..1 + + + + Resource(Patient) + + Who had the reaction + The subject of the adverse reaction + intro + + participation[typeCode=SBJ] + PID-3-Patient ID List + + + + + AdverseReaction.didNotOccurFlag + 1..1 + + y + + boolean + + Indicates lack of reaction + If true, indicates that no reaction occurred. + default=false + Generally only useful in conjunction with other positive reaction records. I.e. "Patient reacted to A and B, but did not react when exposed to C, therefore . . ." + Note that the normal case is false, which is a double negative - it's not true that this reaction did not occur. The normal case is to assert that a reaction did happen + actionNegationInd + + + Is recording a non-reaction really in the 80%? + + + + AdverseReaction.recorder + 0..1 + + + + Resource(Practitioner|Patient) + + Who recorded the reaction + Identifies the individual responsible for the information in the reaction record. + intro + + participation[typeCode=AUT] + IAM-14-Reported By (if patient) / IAM-18-Statused By Person (if practitioner) + + + + + AdverseReaction.symptom + 0..* + + + 300;0 + + What was reaction? + The signs and symptoms that were observed as part of the reaction + Signs, Symptoms, Manifestations + + inboundRelationship[typeCode=SUBJ].source[classCode=OBS, moodCode=EVN, code=<<symptom>>] + + + + + + AdverseReaction.symptom.code + 1..1 + + + + CodeableConcept + SymptomType + E.g. Rash, vomiting + Indicates the specific sign or symptom that was observed + + value + IAR-1 + + + + + AdverseReaction.symptom.severity + 0..1 + + + + code + ReactionSeverity + severe | serious | moderate | minor + The severity of the sign or symptom + inboundRelationship[typeCode=SUBJ].source[classCode=OBS, moodCode=EVN, code=<<severity>>].value + AL1-4-Allergy Severity Code / IAM-4-Allergy Severity Code + + + + + AdverseReaction.exposure + 0..* + + + 300;90 + + Suspected substance + An exposure to a substance that preceded a reaction occurrence + + Multiple repetitions are used to indicate multiple potential causes for the reaction + outboundRelationship[typeCode=SAS].target[classCode=EXPOS, moodCode=EVN] + + + + + + AdverseReaction.exposure.date + 0..1 + + + + dateTime + When the exposure occurred + Identifies the initial date of the exposure that is suspected to be related to the reaction + effectiveTime + (V2 does not define distinct concepts of exposure date and reaction date) + + + + + AdverseReaction.exposure.type + 0..1 + + + + code + ExposureType + drugadmin | immuniz | coincidental + The type of exposure: Drug Administration, Immunization, Coincidental + code + + + + + + AdverseReaction.exposure.causalityExpectation + 0..1 + + + + code + CausalityExpectation + likely | unlikely | confirmed | unknown + A statement of how confident that the recorder was that this exposure caused the reaction + inboundRelationship[typeCode=SUBJ].source[classCode=OBS, moodCode=EVN, code=<<ReactionRelatedness>, ].value Note: Observation also needs to have a subject of the Adverse Reaction itself (i.e. it's expressing relatedness of exposure & reaction) + IAM-17-Allergy Clinical Status Code + + + + + AdverseReaction.exposure.substance + 0..1 + + + + Resource(Substance) + + Presumed causative substance + Substance that is presumed to have caused the adverse reaction + + participation[typeCode=EXPAGNT] + AL1-3 / IAM-3 Allergen Code/Mnemonic/Description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+