diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarIT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarIT.java index 51d4e19625c..f91a9578910 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarIT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarIT.java @@ -3,10 +3,12 @@ package ca.uhn.fhir.android; import static org.junit.Assert.*; import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; +import java.util.TreeSet; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -56,7 +58,7 @@ public class BuiltJarIT { * Android does not like duplicate entries in the JAR */ @Test - public void testJarForDuplicates() throws Exception { + public void testJarContents() throws Exception { String wildcard = "hapi-fhir-android-*.jar"; Collection files = FileUtils.listFiles(new File("target"), new WildcardFileFilter(wildcard), null); if (files.isEmpty()) { @@ -67,6 +69,11 @@ public class BuiltJarIT { ourLog.info("Testing file: {}", file); ZipFile zip = new ZipFile(file); + + int totalClasses = 0; + int totalMethods = 0; + TreeSet topMethods = new TreeSet(); + try { Set names = new HashSet(); for (Enumeration iter = zip.entries(); iter.hasMoreElements();) { @@ -75,9 +82,28 @@ public class BuiltJarIT { if (!names.add(nextName)) { throw new Exception("File " + file + " contains duplicate contents: " + nextName); } + + if (nextName.contains("$") == false) { + if (nextName.endsWith(".class")) { + String className = nextName.replace("/", ".").replace(".class", ""); + try { + Class clazz = Class.forName(className); + int methodCount = clazz.getMethods().length; + topMethods.add(new ClassMethodCount(className, methodCount)); + totalClasses++; + totalMethods += methodCount; + } catch (NoClassDefFoundError e) { + // ignore + } catch (ClassNotFoundException e) { + // ignore + } + } + } } ourLog.info("File {} contains {} entries", file, names.size()); + ourLog.info("Total classes {} - Total methods {}", totalClasses, totalMethods); + ourLog.info("Top classes {}", new ArrayList(topMethods).subList(topMethods.size() - 10, topMethods.size())); } finally { zip.close(); @@ -85,4 +111,42 @@ public class BuiltJarIT { } } + private static class ClassMethodCount implements Comparable { + + private String myClassName; + private int myMethodCount; + + public ClassMethodCount(String theClassName, int theMethodCount) { + myClassName = theClassName; + myMethodCount = theMethodCount; + } + + @Override + public String toString() { + return myClassName + "[" + myMethodCount + "]"; + } + + @Override + public int compareTo(ClassMethodCount theO) { + return myMethodCount - theO.myMethodCount; + } + + public String getClassName() { + return myClassName; + } + + public void setClassName(String theClassName) { + myClassName = theClassName; + } + + public int getMethodCount() { + return myMethodCount; + } + + public void setMethodCount(int theMethodCount) { + myMethodCount = theMethodCount; + } + + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java index 3be24b9f47a..15f53424224 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java @@ -105,8 +105,10 @@ public abstract class BaseRuntimeElementDefinition { return getImplementingClass().newInstance(); } else if (theArgument instanceof IValueSetEnumBinder) { return getImplementingClass().getConstructor(IValueSetEnumBinder.class).newInstance(theArgument); - } else { + } else if (theArgument instanceof IBaseEnumFactory) { return getImplementingClass().getConstructor(IBaseEnumFactory.class).newInstance(theArgument); + } else { + return getImplementingClass().getConstructor(theArgument.getClass()).newInstance(theArgument); } } catch (InstantiationException e) { throw new ConfigurationException("Failed to instantiate type:" + getImplementingClass().getName(), e); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java index 1615e41ea10..391be6b0157 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java @@ -27,12 +27,14 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.text.WordUtils; import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBaseResource; +import ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum; import ca.uhn.fhir.i18n.HapiLocalizer; import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IFhirVersion; @@ -77,8 +79,9 @@ public class FhirContext { private volatile Map, BaseRuntimeElementDefinition> myClassToElementDefinition = Collections.emptyMap(); private volatile Map myIdToResourceDefinition = Collections.emptyMap(); private HapiLocalizer myLocalizer = new HapiLocalizer(); - private volatile Map myNameToElementDefinition = Collections.emptyMap(); - private Map> myNameToResourceType; + private volatile Map> myNameToElementDefinition = Collections.emptyMap(); + private volatile Map myNameToResourceDefinition = Collections.emptyMap(); + private volatile Map> myNameToResourceType; private volatile INarrativeGenerator myNarrativeGenerator; private volatile IRestfulClientFactory myRestfulClientFactory; private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition; @@ -136,6 +139,14 @@ public class FhirContext { return getLocalizer().getMessage(FhirContext.class, "unknownResourceName", theResourceName, theVersion); } + /** + * Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed + * for extending the core library. + */ + public BaseRuntimeElementDefinition getElementDefinition(String theElementName) { + return myNameToElementDefinition.get(theElementName); + } + /** * Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed * for extending the core library. @@ -241,7 +252,7 @@ public class FhirContext { Validate.notBlank(resourceName, "Resource name must not be blank"); - RuntimeResourceDefinition retVal = myNameToElementDefinition.get(resourceName); + RuntimeResourceDefinition retVal = myNameToResourceDefinition.get(resourceName); if (retVal == null) { Class clazz = myNameToResourceType.get(resourceName.toLowerCase()); @@ -401,10 +412,14 @@ public class FhirContext { myRuntimeChildUndeclaredExtensionDefinition = scanner.getRuntimeChildUndeclaredExtensionDefinition(); } - Map nameToElementDefinition = new HashMap(); + Map> nameToElementDefinition = new HashMap>(); nameToElementDefinition.putAll(myNameToElementDefinition); - nameToElementDefinition.putAll(scanner.getNameToResourceDefinitions()); + nameToElementDefinition.putAll(scanner.getNameToElementDefinitions()); + Map nameToResourceDefinition = new HashMap(); + nameToResourceDefinition.putAll(myNameToResourceDefinition); + nameToResourceDefinition.putAll(scanner.getNameToResourceDefinition()); + Map, BaseRuntimeElementDefinition> classToElementDefinition = new HashMap, BaseRuntimeElementDefinition>(); classToElementDefinition.putAll(myClassToElementDefinition); classToElementDefinition.putAll(scanner.getClassToElementDefinitions()); @@ -416,6 +431,7 @@ public class FhirContext { myNameToElementDefinition = nameToElementDefinition; myClassToElementDefinition = classToElementDefinition; myIdToResourceDefinition = idToElementDefinition; + myNameToResourceDefinition = nameToResourceDefinition; myNameToResourceType = scanner.getNameToResourceType(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java index 2036ef8a647..84489b4bf76 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java @@ -40,7 +40,7 @@ public enum FhirVersionEnum { DEV("ca.uhn.fhir.model.dev.FhirDev", null), - DSTU2_HL7ORG("org.hl7.fhir.instance.FhirDstu2Hl7Org", null); + DSTU2_HL7ORG("org.hl7.fhir.instance.FhirDstu2Hl7Org", DSTU2); private final String myVersionClass; 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 4334f344a24..7f3de5a1d60 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 @@ -101,6 +101,7 @@ class ModelScanner { private Set> myScanAlso = new HashSet>(); private Set> myScanAlsoCodeTable = new HashSet>(); private FhirVersionEnum myVersion; + private Map> myNameToElementDefinitions = new HashMap>(); ModelScanner(FhirContext theContext, FhirVersionEnum theVersion, Map, BaseRuntimeElementDefinition> theExistingDefinitions, Collection> theResourceTypes) throws ConfigurationException { myContext = theContext; @@ -338,6 +339,7 @@ class ModelScanner { resourceDef = new RuntimeCompositeDatatypeDefinition(theDatatypeDefinition, theClass); } myClassToElementDefinitions.put(theClass, resourceDef); + myNameToElementDefinitions.put(resourceDef.getName(), resourceDef); scanCompositeElementForChildren(theClass, resourceDef); } @@ -654,6 +656,7 @@ class ModelScanner { resourceDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass); } myClassToElementDefinitions.put(theClass, resourceDef); + myNameToElementDefinitions.put(resourceName, resourceDef); return resourceName; } @@ -810,4 +813,12 @@ class ModelScanner { } } + public Map> getNameToElementDefinitions() { + return myNameToElementDefinitions; + } + + public Map getNameToResourceDefinition() { + return myNameToResourceDefinitions; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java index 95a8f7599da..d9c574f2675 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java @@ -89,7 +89,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini BaseRuntimeElementDefinition nextDef; if (IBaseResource.class.isAssignableFrom(next)) { elementName = getElementName() + StringUtils.capitalize(next.getSimpleName()); - alternateElementName = getElementName() + "Resource"; + alternateElementName = getElementName() + "Reference"; List> types = new ArrayList>(); types.add((Class) next); nextDef = new RuntimeResourceReferenceDefinition(elementName, types); @@ -107,7 +107,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini if (IBaseResource.class.isAssignableFrom(next)) { Class refType = theContext.getVersion().getResourceReferenceType(); myDatatypeToElementDefinition.put(refType, nextDef); - alternateElementName = getElementName() + "Resource"; + alternateElementName = getElementName() + "Reference"; myDatatypeToElementName.put(refType, alternateElementName); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java index d72bf5aa746..3e5fdf2d3d9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java @@ -49,13 +49,11 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi @Override public BaseRuntimeElementDefinition getChildElementDefinitionByDatatype(Class theType) { - assert BaseContainedDt.class.isAssignableFrom(theType) || List.class.isAssignableFrom(theType); return myElem; } @Override public String getChildNameByDatatype(Class theType) { - assert BaseContainedDt.class.isAssignableFrom(theType) || List.class.isAssignableFrom(theType); return getElementName(); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java index 887861adfb2..0beae3a5f75 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java @@ -141,13 +141,21 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD myDatatypeToDefinition.put(type, next.getValue()); } - // Resource Reference - myDatatypeToAttributeName.put(theContext.getVersion().getResourceReferenceType(), "valueResource"); + /* + * Resource reference - The correct name is 'valueReference', but + * we allow for valueResource because some incorrect parsers may use this + */ + addReferenceBinding(theContext, theClassToElementDefinitions, "valueResource"); + addReferenceBinding(theContext, theClassToElementDefinitions, "valueReference"); + } + + private void addReferenceBinding(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions, String value) { + myDatatypeToAttributeName.put(theContext.getVersion().getResourceReferenceType(), value); List> types = new ArrayList>(); types.add(IBaseResource.class); - RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition("valueResource", types); + RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition(value, types); def.sealAndInitialize(theContext, theClassToElementDefinitions); - myAttributeNameToDefinition.put("valueResource", def); + myAttributeNameToDefinition.put(value, def); myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def); myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseConformance.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseConformance.java index 463892cd519..1ed09698ca0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseConformance.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseConformance.java @@ -20,12 +20,14 @@ package ca.uhn.fhir.model.base.resource; * #L% */ +import org.hl7.fhir.instance.model.api.IBaseConformance; + import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.StringDt; //@ResourceDef(name="Conformance") -public interface BaseConformance extends IResource { +public interface BaseConformance extends IResource, IBaseConformance { public abstract StringDt getDescriptionElement(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java index e9c34f47ddd..51fe9747e5f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java @@ -149,14 +149,14 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { * The version ID ("e.g. "456") */ public IdDt(String theResourceType, String theId, String theVersionId) { - this(null,theResourceType,theId,theVersionId); + this(null, theResourceType, theId, theVersionId); } /** * Constructor * * @param theBaseUrl - * The server base URL (e.g. "http://example.com/fhir") + * The server base URL (e.g. "http://example.com/fhir") * @param theResourceType * The resource type (e.g. "Patient") * @param theId @@ -201,14 +201,12 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { return ObjectUtils.equals(getResourceType(), theId.getResourceType()) && ObjectUtils.equals(getIdPart(), theId.getIdPart()) && ObjectUtils.equals(getVersionIdPart(), theId.getVersionIdPart()); } - - @Override public boolean equals(Object theArg0) { if (!(theArg0 instanceof IdDt)) { return false; } - IdDt id = (IdDt)theArg0; + IdDt id = (IdDt) theArg0; return StringUtils.equals(getValueAsString(), id.getValueAsString()); } @@ -231,9 +229,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { } /** - * Returns only the logical ID part of this ID. For example, given the ID - * "http://example,.com/fhir/Patient/123/_history/456", this method would - * return "123". + * Returns only the logical ID part of this ID. For example, given the ID "http://example,.com/fhir/Patient/123/_history/456", this method would return "123". */ public String getIdPart() { return myUnqualifiedId; @@ -282,19 +278,19 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { StringBuilder b = new StringBuilder(); if (isNotBlank(myBaseUrl)) { b.append(myBaseUrl); - if (myBaseUrl.charAt(myBaseUrl.length()-1)!='/') { + if (myBaseUrl.charAt(myBaseUrl.length() - 1) != '/') { b.append('/'); } } - + if (isNotBlank(myResourceType)) { b.append(myResourceType); } - + if (b.length() > 0) { b.append('/'); } - + b.append(myUnqualifiedId); if (isNotBlank(myUnqualifiedVersionId)) { b.append('/'); @@ -408,10 +404,10 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { myUnqualifiedId = null; myUnqualifiedVersionId = null; myResourceType = null; - } else if (theValue.charAt(0)== '#') { + } else if (theValue.charAt(0) == '#') { myValue = theValue; myUnqualifiedId = theValue; - myUnqualifiedVersionId=null; + myUnqualifiedVersionId = null; myResourceType = null; myHaveComponentParts = true; } else { @@ -470,9 +466,8 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { } /** - * Returns a new IdDt containing this IdDt's values but with no server base URL if one - * is present in this IdDt. For example, if this IdDt contains the ID "http://foo/Patient/1", - * this method will return a new IdDt containing ID "Patient/1". + * Returns a new IdDt containing this IdDt's values but with no server base URL if one is present in this IdDt. For example, if this IdDt contains the ID "http://foo/Patient/1", this method will + * return a new IdDt containing ID "Patient/1". */ public IdDt toUnqualified() { return new IdDt(getResourceType(), getIdPart(), getVersionIdPart()); @@ -552,7 +547,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { } else if (theResouce instanceof IResource) { ((IResource) theResouce).setId(new IdDt(getValue())); } else if (theResouce instanceof IAnyResource) { - ((IAnyResource) theResouce).setId(getIdPart()); + ((IAnyResource) theResouce).setId(getValue()); } else { throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource"); } @@ -564,11 +559,15 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType { public static IdDt of(IBaseResource theResouce) { if (theResouce == null) { throw new NullPointerException("theResource can not be null"); - } else if (theResouce instanceof IResource) { - return ((IResource) theResouce).getId(); - } else if (theResouce instanceof IAnyResource) { - // TODO: implement - throw new UnsupportedOperationException(); + } else if (theResouce instanceof IBaseResource) { + IIdType retVal = ((IBaseResource) theResouce).getId(); + if (retVal == null) { + return null; + } else if (retVal instanceof IdDt) { + return (IdDt) retVal; + } else { + return new IdDt(retVal.getValue()); + } } else { throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource"); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java index c330534a289..17680781f76 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java @@ -66,6 +66,7 @@ public abstract class BaseParser implements IParser { private ContainedResources myContainedResources; private FhirContext myContext; private String myServerBaseUrl; + private boolean myStripVersionsFromReferences = true; private boolean mySuppressNarratives; public BaseParser(FhirContext theContext) { @@ -137,7 +138,6 @@ public abstract class BaseParser implements IParser { } - protected void containResourcesForEncoding(IBaseResource theResource) { ContainedResources contained = new ContainedResources(); containResourcesForEncoding(contained, theResource, theResource); @@ -157,17 +157,27 @@ public abstract class BaseParser implements IParser { reference = "#" + containedId.getValue(); } } else if (theRef.getResource().getId() != null && theRef.getResource().getId().hasIdPart()) { - reference = theRef.getResource().getId().getValue(); + if (isStripVersionsFromReferences()) { + reference = theRef.getResource().getId().toVersionless().getValue(); + } else { + reference = theRef.getResource().getId().getValue(); + } } } return reference; } else { if (isNotBlank(myServerBaseUrl) && StringUtils.equals(myServerBaseUrl, ref.getBaseUrl())) { - String reference = ref.toUnqualifiedVersionless().getValue(); - return reference; + if (isStripVersionsFromReferences()) { + return ref.toUnqualifiedVersionless().getValue(); + } else { + return ref.toUnqualified().getValue(); + } } else { - String reference = ref.toVersionless().getValue(); - return reference; + if (isStripVersionsFromReferences()) { + return ref.toVersionless().getValue(); + } else { + return ref.getValue(); + } } } } @@ -245,7 +255,13 @@ public abstract class BaseParser implements IParser { } protected boolean isChildContained(BaseRuntimeElementDefinition childDef, boolean theIncludedResource) { - return (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES || childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCE_LIST) && getContainedResources().isEmpty() == false && theIncludedResource == false; + return (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES || childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCE_LIST) && getContainedResources().isEmpty() == false + && theIncludedResource == false; + } + + @Override + public boolean isStripVersionsFromReferences() { + return myStripVersionsFromReferences; } @Override @@ -267,7 +283,7 @@ public abstract class BaseParser implements IParser { List base = def.getChildByName("base").getAccessor().getValues(retVal); if (base != null && base.size() > 0) { IPrimitiveType baseType = (IPrimitiveType) base.get(0); - IResource res = ((IResource) retVal); + IBaseResource res = ((IBaseResource) retVal); res.setId(new IdDt(baseType.getValueAsString(), def.getName(), res.getId().getIdPart(), res.getId().getVersionIdPart())); } @@ -287,11 +303,11 @@ public abstract class BaseParser implements IParser { List entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry); if (entryResources != null && entryResources.size() > 0) { - IResource res = (IResource) entryResources.get(0); + IBaseResource res = (IBaseResource) entryResources.get(0); RuntimeResourceDefinition resDef = myContext.getResourceDefinition(res); String versionIdPart = res.getId().getVersionIdPart(); - if (isBlank(versionIdPart)) { - versionIdPart = ResourceMetadataKeyEnum.VERSION.get(res); + if (isBlank(versionIdPart) && res instanceof IResource) { + versionIdPart = ResourceMetadataKeyEnum.VERSION.get((IResource) res); } res.setId(new IdDt(baseType.getValueAsString(), resDef.getName(), res.getId().getIdPart(), versionIdPart)); @@ -335,6 +351,12 @@ public abstract class BaseParser implements IParser { return this; } + @Override + public IParser setStripVersionsFromReferences(boolean theStripVersionsFromReferences) { + myStripVersionsFromReferences = theStripVersionsFromReferences; + return this; + } + @Override public IParser setSuppressNarratives(boolean theSuppressNarratives) { mySuppressNarratives = theSuppressNarratives; 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 9b597e1f59f..ffac96f44a5 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 @@ -28,7 +28,6 @@ import org.hl7.fhir.instance.model.IBaseResource; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.model.api.Bundle; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.TagList; /** @@ -178,4 +177,28 @@ public interface IParser { */ IParser setServerBaseUrl(String theUrl); + /** + * If set to true (which is the default), resource references containing a version + * will have the version removed when the resource is encoded. This is generally good behaviour because + * in most situations, references from one resource to another should be to the resource by ID, not + * by ID and version. In some cases though, it may be desirable to preserve the version in resource + * links. In that case, this value should be set to false. + * + * @param theStripVersionsFromReferences Set this to false to prevent the parser from removing + * resource versions from references. + * @return Returns an instance of this parser so that method calls can be chained together + */ + IParser setStripVersionsFromReferences(boolean theStripVersionsFromReferences); + + /** + * If set to true (which is the default), resource references containing a version + * will have the version removed when the resource is encoded. This is generally good behaviour because + * in most situations, references from one resource to another should be to the resource by ID, not + * by ID and version. In some cases though, it may be desirable to preserve the version in resource + * links. In that case, this value should be set to false. + * + * @return Returns the parser instance's configuration setting for stripping versions from resource references when encoding. Default is true. + */ + boolean isStripVersionsFromReferences(); + } 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 6b71ed53de9..a5ac3b2a5ca 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 @@ -358,13 +358,14 @@ public class JsonParser extends BaseParser implements IParser { switch (theChildDef.getChildType()) { case ID_DATATYPE: { IIdType value = (IIdType) theNextValue; - if (isBlank(value.getIdPart())) { + String encodedValue = "id".equals(theChildName) ? value.getIdPart() : value.getValue(); + if (isBlank(encodedValue)) { break; } if (theChildName != null) { - theWriter.write(theChildName, value.getIdPart()); + theWriter.write(theChildName, encodedValue); } else { - theWriter.write(value.getIdPart()); + theWriter.write(encodedValue); } break; } @@ -410,8 +411,8 @@ public class JsonParser extends BaseParser implements IParser { } else { theWriter.writeStartObject(); } - if (theNextValue instanceof ExtensionDt) { - theWriter.write("url", ((ExtensionDt) theNextValue).getUrlAsString()); + if (theNextValue instanceof IBaseExtension) { + theWriter.write("url", ((IBaseExtension) theNextValue).getUrl()); } encodeCompositeElementToStreamWriter(theResDef, theResource, theNextValue, theWriter, childCompositeDef, theIsSubElementWithinResource); theWriter.writeEnd(); @@ -871,7 +872,7 @@ public class JsonParser extends BaseParser implements IParser { IBaseHasExtensions element = (IBaseHasExtensions) theElement; List> ext = element.getExtension(); for (IBaseExtension next : ext) { - if (next == null || next.isEmpty()) { + if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue; } extensions.add(new HeldExtension(next, false)); @@ -1050,11 +1051,17 @@ public class JsonParser extends BaseParser implements IParser { if ("resourceType".equals(nextName)) { continue; } else if ("id".equals(nextName)) { + if (theObject.isNull(nextName)) { + continue; + } elementId = theObject.getString(nextName); if (myContext.getVersion().getVersion() == FhirVersionEnum.DSTU1) { continue; } } else if ("_id".equals(nextName)) { + if (theObject.isNull(nextName)) { + continue; + } // _id is incorrect, but some early examples in the FHIR spec used it elementId = theObject.getString(nextName); continue; @@ -1082,8 +1089,8 @@ public class JsonParser extends BaseParser implements IParser { IBase object = (IBase) theState.getObject(); if (object instanceof IIdentifiableElement) { ((IIdentifiableElement) object).setElementSpecificId(elementId); - } else if (object instanceof IResource) { - ((IResource) object).setId(new IdDt(elementId)); + } else if (object instanceof IBaseResource) { + ((IBaseResource) object).getId().setValue(elementId); } } } @@ -1196,31 +1203,35 @@ public class JsonParser extends BaseParser implements IParser { @Override public T doParseResource(Class theResourceType, Reader theReader) { - JsonReader reader = Json.createReader(theReader); - JsonObject object = reader.readObject(); - - JsonValue resourceTypeObj = object.get("resourceType"); - assertObjectOfType(resourceTypeObj, JsonValue.ValueType.STRING, "resourceType"); - String resourceType = ((JsonString) resourceTypeObj).getString(); - - RuntimeResourceDefinition def; - if (theResourceType != null) { - def = myContext.getResourceDefinition(theResourceType); - } else { - def = myContext.getResourceDefinition(resourceType); + try { + JsonReader reader = Json.createReader(theReader); + JsonObject object = reader.readObject(); + + JsonValue resourceTypeObj = object.get("resourceType"); + assertObjectOfType(resourceTypeObj, JsonValue.ValueType.STRING, "resourceType"); + String resourceType = ((JsonString) resourceTypeObj).getString(); + + RuntimeResourceDefinition def; + if (theResourceType != null) { + def = myContext.getResourceDefinition(theResourceType); + } else { + def = myContext.getResourceDefinition(resourceType); + } + + ParserState state = ParserState.getPreResourceInstance(def.getImplementingClass(), myContext, true); + state.enteringNewElement(null, def.getName()); + + parseChildren(object, state); + + state.endingElement(); + + @SuppressWarnings("unchecked") + T retVal = (T) state.getObject(); + + return retVal; + } catch (JsonParsingException e) { + throw new DataFormatException("Failed to parse JSON: " + e.getMessage(), e); } - - ParserState state = ParserState.getPreResourceInstance(def.getImplementingClass(), myContext, true); - state.enteringNewElement(null, def.getName()); - - parseChildren(object, state); - - state.endingElement(); - - @SuppressWarnings("unchecked") - T retVal = (T) state.getObject(); - - return retVal; } @Override 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 ccb29a4caf5..9e6fd5ef497 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 @@ -42,6 +42,7 @@ import org.hl7.fhir.instance.model.api.IBaseExtension; import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions; import org.hl7.fhir.instance.model.api.IBaseXhtml; +import org.hl7.fhir.instance.model.api.IDomainResource; import org.hl7.fhir.instance.model.api.IReference; import ca.uhn.fhir.context.BaseRuntimeChildDefinition; @@ -1682,7 +1683,7 @@ class ParserState { switch (target.getChildType()) { case COMPOSITE_DATATYPE: { BaseRuntimeElementCompositeDefinition compositeTarget = (BaseRuntimeElementCompositeDefinition) target; - ICompositeDatatype newChildInstance = (ICompositeDatatype) compositeTarget.newInstance(); + ICompositeType newChildInstance = (ICompositeType) compositeTarget.newInstance(); myExtension.setValue(newChildInstance); ElementCompositeState newState = new ElementCompositeState(getPreResourceState(), compositeTarget, newChildInstance); push(newState); @@ -1714,6 +1715,9 @@ class ParserState { case UNDECL_EXT: case EXTENSION_DECLARED: case CONTAINED_RESOURCES: + case CONTAINED_RESOURCE_LIST: + case ID_DATATYPE: + case PRIMITIVE_XHTML_HL7ORG: break; } } @@ -1952,6 +1956,17 @@ class ParserState { if (myTarget == null) { myObject = (T) getCurrentElement(); } + + if (getCurrentElement() instanceof IDomainResource) { + IDomainResource elem = (IDomainResource) getCurrentElement(); + String resourceName = myContext.getResourceDefinition(elem).getName(); + String versionId = elem.getMeta().getVersionId(); + if (StringUtils.isNotBlank(versionId)) { + elem.getIdElement().setValue(resourceName + "/" + elem.getId().getIdPart() + "/_history/" + versionId); + } else { + elem.getIdElement().setValue(resourceName + "/" + elem.getId().getIdPart()); + } + } } @Override 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 b36786e2107..e513f6035f9 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 @@ -458,11 +458,11 @@ public class XmlParser extends BaseParser implements IParser { switch (childDef.getChildType()) { case ID_DATATYPE: { - IIdType pd = (IIdType) nextValue; - String value = pd.getIdPart(); + IIdType value = (IIdType) nextValue; + String encodedValue = "id".equals(childName) ? value.getIdPart() : value.getValue(); if (value != null) { theEventWriter.writeStartElement(childName); - theEventWriter.writeAttribute("value", value); + theEventWriter.writeAttribute("value", encodedValue); encodeExtensionsIfPresent(theResource, theEventWriter, nextValue, theIncludedResource); theEventWriter.writeEndElement(); } @@ -494,7 +494,7 @@ public class XmlParser extends BaseParser implements IParser { IReference ref = (IReference) nextValue; if (!ref.isEmpty()) { theEventWriter.writeStartElement(childName); - encodeResourceReferenceToStreamWriter(theEventWriter, ref); + encodeResourceReferenceToStreamWriter(theEventWriter, ref, theResource, theIncludedResource); theEventWriter.writeEndElement(); } break; @@ -674,9 +674,11 @@ public class XmlParser extends BaseParser implements IParser { return retVal; } - private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, IReference theRef) throws XMLStreamException { + private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, IReference theRef, IBaseResource theResource, boolean theIncludedResource) throws XMLStreamException { String reference = determineReferenceText(theRef); + encodeExtensionsIfPresent(theResource, theEventWriter, theRef, theIncludedResource); + if (StringUtils.isNotBlank(reference)) { theEventWriter.writeStartElement(RESREF_REFERENCE); theEventWriter.writeAttribute("value", reference); @@ -890,7 +892,7 @@ public class XmlParser extends BaseParser implements IParser { private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List> theExtensions, String tagName, boolean theIncludedResource) throws XMLStreamException, DataFormatException { for (IBaseExtension next : theExtensions) { - if (next == null) { + if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java index bc0e8d1b5fd..c2a595f64b6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java @@ -20,7 +20,8 @@ package ca.uhn.fhir.rest.client; * #L% */ -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; @@ -39,6 +40,7 @@ import org.apache.http.client.methods.HttpRequestBase; import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseBundle; +import org.hl7.fhir.instance.model.api.IBaseConformance; import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IIdType; @@ -73,6 +75,8 @@ import ca.uhn.fhir.rest.gclient.IDelete; import ca.uhn.fhir.rest.gclient.IDeleteTyped; import ca.uhn.fhir.rest.gclient.IDeleteWithQuery; import ca.uhn.fhir.rest.gclient.IDeleteWithQueryTyped; +import ca.uhn.fhir.rest.gclient.IFetchConformanceTyped; +import ca.uhn.fhir.rest.gclient.IFetchConformanceUntyped; import ca.uhn.fhir.rest.gclient.IGetPage; import ca.uhn.fhir.rest.gclient.IGetPageTyped; import ca.uhn.fhir.rest.gclient.IGetTags; @@ -141,8 +145,13 @@ public class GenericClient extends BaseClient implements IGenericClient { myContext = theContext; } + @Override public BaseConformance conformance() { + if (myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) { + throw new IllegalArgumentException("Must call conformance(" + IBaseConformance.class.getSimpleName() + ") for HL7.org structures"); + } + HttpGetClientInvocation invocation = MethodUtil.createConformanceInvocation(); if (isKeepResponses()) { myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding()); @@ -166,7 +175,6 @@ public class GenericClient extends BaseClient implements IGenericClient { return myContext; } - @Override public MethodOutcome create(IResource theResource) { BaseHttpClientInvocation invocation = MethodUtil.createCreateInvocation(theResource, myContext); @@ -352,7 +360,8 @@ public class GenericClient extends BaseClient implements IGenericClient { @Override public IOperation operation() { if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1) == false) { - throw new IllegalStateException("Operations are only supported in FHIR DSTU2 and later. This client was created using a context configured for " + myContext.getVersion().getVersion().name()); + throw new IllegalStateException("Operations are only supported in FHIR DSTU2 and later. This client was created using a context configured for " + + myContext.getVersion().getVersion().name()); } return new OperationInternal(); } @@ -362,6 +371,11 @@ public class GenericClient extends BaseClient implements IGenericClient { return new ReadInternal(); } + @Override + public IFetchConformanceUntyped fetchConformance() { + return new FetchConformanceInternal(); + } + @Override public T read(Class theType, String theId) { return read(theType, new IdDt(theId)); @@ -374,7 +388,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public IResource read(UriDt theUrl) { + public IBaseResource read(UriDt theUrl) { IdDt id = new IdDt(theUrl); String resourceType = id.getResourceType(); if (isBlank(resourceType)) { @@ -384,7 +398,7 @@ public class GenericClient extends BaseClient implements IGenericClient { if (def == null) { throw new IllegalArgumentException(myContext.getLocalizer().getMessage(I18N_CANNOT_DETEMINE_RESOURCE_TYPE, theUrl.getValueAsString())); } - return (IResource) read(def.getImplementingClass(), id); + return (IBaseResource) read(def.getImplementingClass(), id); } @Override @@ -449,7 +463,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public List transaction(List theResources) { + public List transaction(List theResources) { BaseHttpClientInvocation invocation = TransactionMethodBinding.createTransactionInvocation(theResources, myContext); if (isKeepResponses()) { myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding()); @@ -457,7 +471,7 @@ public class GenericClient extends BaseClient implements IGenericClient { Bundle resp = invokeClient(myContext, new BundleResponseHandler(null), invocation, myLogRequestAndResponse); - return resp.toListOfResources(); + return new ArrayList(resp.toListOfResources()); } @Override @@ -680,7 +694,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public ICreateTyped resource(IResource theResource) { + public ICreateTyped resource(IBaseResource theResource) { Validate.notNull(theResource, "Resource can not be null"); myResource = theResource; return this; @@ -736,7 +750,7 @@ public class GenericClient extends BaseClient implements IGenericClient { private class DeleteInternal extends BaseClientExecutable implements IDelete, IDeleteTyped, IDeleteWithQuery, IDeleteWithQueryTyped { private CriterionList myCriterionList; - private IdDt myId; + private IIdType myId; private String myResourceType; private String mySearchUrl; @@ -775,7 +789,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public IDeleteTyped resourceById(IdDt theId) { + public IDeleteTyped resourceById(IIdType theId) { Validate.notNull(theId, "theId can not be null"); if (theId.hasResourceType() == false || theId.hasIdPart() == false) { throw new IllegalArgumentException("theId must contain a resource type and logical ID at a minimum (e.g. Patient/1234)found: " + theId.getValue()); @@ -914,7 +928,7 @@ public class GenericClient extends BaseClient implements IGenericClient { private class HistoryInternal extends BaseClientExecutable implements IHistory, IHistoryUntyped, IHistoryTyped { private Integer myCount; - private IdDt myId; + private IIdType myId; private Class myReturnType; private InstantDt mySince; private Class myType; @@ -967,7 +981,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public IHistoryUntyped onInstance(IdDt theId) { + public IHistoryUntyped onInstance(IIdType theId) { if (theId.hasResourceType() == false) { throw new IllegalArgumentException("Resource ID does not have a resource type: " + theId.getValue()); } @@ -1026,7 +1040,7 @@ public class GenericClient extends BaseClient implements IGenericClient { @SuppressWarnings("rawtypes") private class OperationInternal extends BaseClientExecutable implements IOperation, IOperationUnnamed, IOperationUntyped, IOperationUntypedWithInput { - private IdDt myId; + private IIdType myId; private String myOperationName; private IBaseParameters myParameters; private Class myType; @@ -1054,12 +1068,12 @@ public class GenericClient extends BaseClient implements IGenericClient { handler = new ResourceResponseHandler(myParameters.getClass(), null); Object retVal = invoke(null, handler, invocation); - if (myContext.getResourceDefinition((IBaseResource)retVal).getName().equals("Parameters")) { + if (myContext.getResourceDefinition((IBaseResource) retVal).getName().equals("Parameters")) { return retVal; } else { RuntimeResourceDefinition def = myContext.getResourceDefinition("Parameters"); IBaseResource parameters = def.newInstance(); - + BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition paramChildElem = (BaseRuntimeElementCompositeDefinition) paramChild.getChildByName("parameter"); IBase parameter = paramChildElem.newInstance(); @@ -1067,7 +1081,7 @@ public class GenericClient extends BaseClient implements IGenericClient { BaseRuntimeChildDefinition resourceElem = paramChildElem.getChildByName("resource"); resourceElem.getMutator().addValue(parameter, (IBase) retVal); - + return parameters; } } @@ -1075,12 +1089,12 @@ public class GenericClient extends BaseClient implements IGenericClient { @Override public IOperationUntyped named(String theName) { Validate.notBlank(theName, "theName can not be null"); - myOperationName =theName; + myOperationName = theName; return this; } @Override - public IOperationUnnamed onInstance(IdDt theId) { + public IOperationUnnamed onInstance(IIdType theId) { myId = theId; return this; } @@ -1113,7 +1127,8 @@ public class GenericClient extends BaseClient implements IGenericClient { throw new IllegalArgumentException("theOutputParameterType must refer to a HAPI FHIR Resource type: " + theOutputParameterType.getName()); } if (!"Parameters".equals(def.getName())) { - throw new IllegalArgumentException("theOutputParameterType must refer to a HAPI FHIR Resource type for a resource named " + "Parameters" + " - " + theOutputParameterType.getName() + " is a resource named: " + def.getName()); + throw new IllegalArgumentException("theOutputParameterType must refer to a HAPI FHIR Resource type for a resource named " + "Parameters" + " - " + theOutputParameterType.getName() + + " is a resource named: " + def.getName()); } myParameters = (IBaseParameters) def.newInstance(); return this; @@ -1290,7 +1305,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } - private final class ResourceListResponseHandler implements IClientResponseHandler> { + private final class ResourceListResponseHandler implements IClientResponseHandler> { private Class myType; @@ -1300,17 +1315,17 @@ public class GenericClient extends BaseClient implements IGenericClient { @SuppressWarnings("unchecked") @Override - public List invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map> theHeaders) throws IOException, + public List invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map> theHeaders) throws IOException, BaseServerResponseException { if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) { Class bundleType = myContext.getResourceDefinition("Bundle").getImplementingClass(); ResourceResponseHandler handler = new ResourceResponseHandler((Class) bundleType, null); IBaseResource response = handler.invokeClient(theResponseMimeType, theResponseReader, theResponseStatusCode, theHeaders); IVersionSpecificBundleFactory bundleFactory = myContext.newBundleFactory(); - bundleFactory.initializeWithBundleResource((IResource) response); + bundleFactory.initializeWithBundleResource((IBaseResource) response); return bundleFactory.toListOfResources(); } else { - return new BundleResponseHandler(myType).invokeClient(theResponseMimeType, theResponseReader, theResponseStatusCode, theHeaders).toListOfResources(); + return new ArrayList(new BundleResponseHandler(myType).invokeClient(theResponseMimeType, theResponseReader, theResponseStatusCode, theHeaders).toListOfResources()); } } } @@ -1340,7 +1355,8 @@ public class GenericClient extends BaseClient implements IGenericClient { } } - private class SearchInternal extends BaseClientExecutable implements IQuery, IUntypedQuery { + @SuppressWarnings({ "rawtypes", "unchecked" }) + private class SearchInternal extends BaseClientExecutable, Object> implements IQuery, IUntypedQuery { private String myCompartmentName; private CriterionList myCriterion = new CriterionList(); @@ -1352,6 +1368,7 @@ public class GenericClient extends BaseClient implements IGenericClient { private Class myResourceType; private SearchStyleEnum mySearchStyle; private List mySort = new ArrayList(); + private Class myReturnBundleType; public SearchInternal() { myResourceType = null; @@ -1365,7 +1382,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public Bundle execute() { + public IBase execute() { Map> params = new LinkedHashMap>(); // Map> initial = createExtraParams(); @@ -1391,7 +1408,17 @@ public class GenericClient extends BaseClient implements IGenericClient { addParam(params, Constants.PARAM_COUNT, Integer.toString(myParamLimit)); } - BundleResponseHandler binding = new BundleResponseHandler(myResourceType); + if (myReturnBundleType == null && myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) { + throw new IllegalArgumentException("When using the client with HL7.org structures, you must specify " + + "the bundle return type for the client by adding \".returnBundle(org.hl7.fhir.instance.model.Bundle.class)\" to your search method call before the \".execute()\" method"); + } + + IClientResponseHandler binding; + if (myReturnBundleType != null) { + binding = new ResourceResponseHandler(myReturnBundleType, null); + } else { + binding = new BundleResponseHandler(myResourceType); + } IdDt resourceId = myResourceId != null ? new IdDt(myResourceId) : null; @@ -1407,7 +1434,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public IQuery forResource(Class theResourceType) { + public IQuery forResource(Class theResourceType) { setType(theResourceType); return this; } @@ -1434,7 +1461,7 @@ public class GenericClient extends BaseClient implements IGenericClient { return this; } - private void setType(Class theResourceType) { + private void setType(Class theResourceType) { myResourceType = theResourceType; RuntimeResourceDefinition definition = myContext.getResourceDefinition(theResourceType); myResourceName = definition.getName(); @@ -1472,13 +1499,23 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public IQuery revinclude(Include theInclude) { + public IQuery revInclude(Include theInclude) { myRevInclude.add(theInclude); return this; } + @Override + public IClientExecutable returnBundle(Class theClass) { + if (theClass == null) { + throw new NullPointerException("theClass must not be null"); + } + myReturnBundleType = theClass; + return this; + } + } + @SuppressWarnings("rawtypes") private static class SortInternal implements ISort { private SearchInternal myFor; @@ -1537,14 +1574,14 @@ public class GenericClient extends BaseClient implements IGenericClient { private final class TransactionExecutable extends BaseClientExecutable, T> implements ITransactionTyped { private Bundle myBundle; - private List myResources; + private List myResources; private IBaseBundle myBaseBundle; public TransactionExecutable(Bundle theResources) { myBundle = theResources; } - public TransactionExecutable(List theResources) { + public TransactionExecutable(List theResources) { myResources = theResources; } @@ -1561,9 +1598,9 @@ public class GenericClient extends BaseClient implements IGenericClient { BaseHttpClientInvocation invocation = TransactionMethodBinding.createTransactionInvocation(myResources, myContext); return (T) invoke(params, binding, invocation); } else if (myBaseBundle != null) { - ResourceResponseHandler binding = new ResourceResponseHandler(myBaseBundle.getClass(),null); + ResourceResponseHandler binding = new ResourceResponseHandler(myBaseBundle.getClass(), null); BaseHttpClientInvocation invocation = TransactionMethodBinding.createTransactionInvocation(myBaseBundle, myContext); - return (T) invoke(params, binding, invocation); + return (T) invoke(params, binding, invocation); } else { BundleResponseHandler binding = new BundleResponseHandler(null); BaseHttpClientInvocation invocation = TransactionMethodBinding.createTransactionInvocation(myBundle, myContext); @@ -1582,9 +1619,9 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public ITransactionTyped> withResources(List theResources) { + public ITransactionTyped> withResources(List theResources) { Validate.notNull(theResources, "theResources must not be null"); - return new TransactionExecutable>(theResources); + return new TransactionExecutable>(theResources); } @Override @@ -1658,7 +1695,7 @@ public class GenericClient extends BaseClient implements IGenericClient { } @Override - public IUpdateTyped resource(IResource theResource) { + public IUpdateTyped resource(IBaseResource theResource) { Validate.notNull(theResource, "Resource can not be null"); myResource = theResource; return this; @@ -1703,4 +1740,36 @@ public class GenericClient extends BaseClient implements IGenericClient { } + + + + + + + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private class FetchConformanceInternal extends BaseClientExecutable implements IFetchConformanceUntyped, IFetchConformanceTyped { + private RuntimeResourceDefinition myType; + + @Override + public Object execute() { + ResourceResponseHandler binding = new ResourceResponseHandler(myType.getImplementingClass(), null); + HttpGetClientInvocation invocation = MethodUtil.createConformanceInvocation(); + return invokeClient(myContext, binding, invocation, myLogRequestAndResponse); + } + + + @Override + public IFetchConformanceTyped ofType(Class theResourceType) { + Validate.notNull(theResourceType, "theResourceType must not be null"); + myType = myContext.getResourceDefinition(theResourceType); + if (myType == null) { + throw new IllegalArgumentException(myContext.getLocalizer().getMessage(I18N_CANNOT_DETEMINE_RESOURCE_TYPE, theResourceType)); + } + return this; + } + + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IGenericClient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IGenericClient.java index eabef4c4ed0..ae7f01030b3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IGenericClient.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IGenericClient.java @@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IRestfulClient; import ca.uhn.fhir.rest.gclient.ICreate; import ca.uhn.fhir.rest.gclient.IDelete; +import ca.uhn.fhir.rest.gclient.IFetchConformanceUntyped; import ca.uhn.fhir.rest.gclient.IGetPage; import ca.uhn.fhir.rest.gclient.IGetTags; import ca.uhn.fhir.rest.gclient.IHistory; @@ -49,9 +50,17 @@ public interface IGenericClient extends IRestfulClient { /** * Retrieves and returns the server conformance statement + * + * @deprecated Use {@link #fetchConformance()} instead */ + @Deprecated BaseConformance conformance(); + /** + * Retrieves the server's conformance statement + */ + IFetchConformanceUntyped fetchConformance(); + /** * Fluent method for the "create" operation, which creates a new resource instance on the server */ @@ -217,7 +226,7 @@ public interface IGenericClient extends IRestfulClient { * The absolute URL, e.g. "http://example.com/fhir/Patient/123" * @return The returned resource from the server */ - IResource read(UriDt theUrl); + IBaseResource read(UriDt theUrl); /** * Register a new interceptor for this client. An interceptor can be used to add additional logging, or add security @@ -274,7 +283,7 @@ public interface IGenericClient extends IRestfulClient { * */ @Deprecated - List transaction(List theResources); + List transaction(List theResources); /** * Remove an intercaptor that was previously registered using @@ -363,4 +372,5 @@ public interface IGenericClient extends IRestfulClient { */ T vread(Class theType, String theId, String theVersionId); + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java index 6de0dbdfd27..021816d07a9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java @@ -43,15 +43,17 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.ProxyAuthenticationStrategy; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.IPrimitiveType; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.model.base.resource.BaseConformance; import ca.uhn.fhir.rest.client.api.IRestfulClient; import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException; import ca.uhn.fhir.rest.method.BaseMethodBinding; import ca.uhn.fhir.rest.server.Constants; +import ca.uhn.fhir.util.FhirTerser; public class RestfulClientFactory implements IRestfulClientFactory { @@ -267,26 +269,34 @@ public class RestfulClientFactory implements IRestfulClientFactory { myHttpClient = null; } + @SuppressWarnings("unchecked") private void validateServerBase(String theServerBase, HttpClient theHttpClient) { GenericClient client = new GenericClient(myContext, theHttpClient, theServerBase, this); client.setDontValidateConformance(true); - BaseConformance conformance; + IBaseResource conformance; try { - conformance = client.conformance(); + @SuppressWarnings("rawtypes") + Class implementingClass = myContext.getResourceDefinition("Conformance").getImplementingClass(); + conformance = (IBaseResource) client.fetchConformance().ofType(implementingClass).execute(); } catch (FhirClientConnectionException e) { throw new FhirClientConnectionException(myContext.getLocalizer().getMessage(RestfulClientFactory.class, "failedToRetrieveConformance", theServerBase + Constants.URL_TOKEN_METADATA), e); } - String serverFhirVersionString = conformance.getFhirVersionElement().getValueAsString(); + FhirTerser t = myContext.newTerser(); + String serverFhirVersionString = null; + Object value = t.getSingleValueOrNull(conformance, "fhirVersion"); + if (value instanceof IPrimitiveType) { + serverFhirVersionString = ((IPrimitiveType) value).getValueAsString(); + } FhirVersionEnum serverFhirVersionEnum = null; if (StringUtils.isBlank(serverFhirVersionString)) { // we'll be lenient and accept this } else { if (serverFhirVersionString.startsWith("0.80") || serverFhirVersionString.startsWith("0.0.8")) { serverFhirVersionEnum = FhirVersionEnum.DSTU1; - } else if (serverFhirVersionString.startsWith("0.4")) { + } else if (serverFhirVersionString.startsWith("0.4") || serverFhirVersionString.startsWith("0.5")) { serverFhirVersionEnum = FhirVersionEnum.DSTU2; } else { // we'll be lenient and accept this diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IBaseOn.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IBaseOn.java index 098ca4ccf30..bd7f526587e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IBaseOn.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IBaseOn.java @@ -21,8 +21,7 @@ package ca.uhn.fhir.rest.gclient; */ import org.hl7.fhir.instance.model.IBaseResource; - -import ca.uhn.fhir.model.primitive.IdDt; +import org.hl7.fhir.instance.model.api.IIdType; public interface IBaseOn { @@ -43,6 +42,6 @@ public interface IBaseOn { * * @throws IllegalArgumentException If theId does not contain at least a resource type and ID */ - T onInstance(IdDt theId); + T onInstance(IIdType theId); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreate.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreate.java index 33bac4b9ece..1131e5d98c2 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreate.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreate.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.gclient; -import ca.uhn.fhir.model.api.IResource; +import org.hl7.fhir.instance.model.IBaseResource; /* * #%L @@ -23,7 +23,7 @@ import ca.uhn.fhir.model.api.IResource; */ public interface ICreate { - ICreateTyped resource(IResource theResource); + ICreateTyped resource(IBaseResource theResource); ICreateTyped resource(String theResourceAsText); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java index ccd30029fa4..464e41fa02e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java @@ -1,7 +1,8 @@ package ca.uhn.fhir.rest.gclient; +import org.hl7.fhir.instance.model.api.IIdType; + import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.primitive.IdDt; /* * #%L @@ -27,7 +28,7 @@ public interface IDelete { IDeleteTyped resource(IResource theResource); - IDeleteTyped resourceById(IdDt theId); + IDeleteTyped resourceById(IIdType theId); IDeleteTyped resourceById(String theResourceType, String theLogicalId); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IFetchConformanceTyped.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IFetchConformanceTyped.java new file mode 100644 index 00000000000..d524daf0a1d --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IFetchConformanceTyped.java @@ -0,0 +1,7 @@ +package ca.uhn.fhir.rest.gclient; + +import org.hl7.fhir.instance.model.api.IBaseConformance; + +public interface IFetchConformanceTyped extends IClientExecutable, T> { + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IFetchConformanceUntyped.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IFetchConformanceUntyped.java new file mode 100644 index 00000000000..32b9f1160f0 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IFetchConformanceUntyped.java @@ -0,0 +1,12 @@ +package ca.uhn.fhir.rest.gclient; + +import org.hl7.fhir.instance.model.api.IBaseConformance; + +public interface IFetchConformanceUntyped { + + /** + * Retrieve the conformance statement using the given model type + */ + IFetchConformanceTyped ofType(Class theType); + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java index fbec19e6722..a4a6bed93fe 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java @@ -20,20 +20,21 @@ package ca.uhn.fhir.rest.gclient; * #L% */ -import ca.uhn.fhir.model.api.Bundle; +import org.hl7.fhir.instance.model.api.IBaseBundle; + import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.rest.method.SearchStyleEnum; -public interface IQuery extends IClientExecutable, IBaseQuery { +public interface IQuery extends IClientExecutable, T>, IBaseQuery> { /** * Add an "_include" specification */ - IQuery include(Include theInclude); + IQuery include(Include theInclude); - ISort sort(); + ISort sort(); - IQuery limitTo(int theLimitTo); + IQuery limitTo(int theLimitTo); /** * Forces the query to perform the search using the given method (allowable methods are described in the @@ -42,15 +43,21 @@ public interface IQuery extends IClientExecutable, IBaseQuery usingStyle(SearchStyleEnum theStyle); - IQuery withIdAndCompartment(String theResourceId, String theCompartmentName); + IQuery withIdAndCompartment(String theResourceId, String theCompartmentName); /** * Add a "_revinclude" specification * * @since 1.0 */ - IQuery revinclude(Include theIncludeTarget); + IQuery revInclude(Include theIncludeTarget); + + /** + * Request that the client return the specified bundle type, e.g. org.hl7.fhir.instance.model.Bundle.class + * or ca.uhn.fhir.model.dstu2.resource.Bundle.class + */ + IClientExecutable, B> returnBundle(Class theClass); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ISort.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ISort.java index eca4d3d6dc0..f12be0f36b5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ISort.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ISort.java @@ -20,12 +20,12 @@ package ca.uhn.fhir.rest.gclient; * #L% */ -public interface ISort { +public interface ISort { - IQuery ascending(IParam theParam); + IQuery ascending(IParam theParam); - IQuery defaultOrder(IParam theParam); + IQuery defaultOrder(IParam theParam); - IQuery descending(IParam theParam); + IQuery descending(IParam theParam); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ITransaction.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ITransaction.java index 28bab9cbe5e..cbed783919a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ITransaction.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ITransaction.java @@ -22,17 +22,17 @@ package ca.uhn.fhir.rest.gclient; import java.util.List; +import org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseBundle; import ca.uhn.fhir.model.api.Bundle; -import ca.uhn.fhir.model.api.IResource; public interface ITransaction { /** * Use a list of resources as the transaction input */ - ITransactionTyped> withResources(List theResources); + ITransactionTyped> withResources(List theResources); /** * Use a DSTU1 Bundle (Atom) as the transaction input diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUntypedQuery.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUntypedQuery.java index cf24a7b2146..118668c5119 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUntypedQuery.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUntypedQuery.java @@ -20,15 +20,17 @@ package ca.uhn.fhir.rest.gclient; * #L% */ -import ca.uhn.fhir.model.api.IResource; +import org.hl7.fhir.instance.model.IBaseResource; + +import ca.uhn.fhir.model.api.Bundle; public interface IUntypedQuery { - IQuery forAllResources(); + IQuery forAllResources(); - IQuery forResource(String theResourceName); + IQuery forResource(String theResourceName); - IQuery forResource(Class theClass); + IQuery forResource(Class theClass); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUpdate.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUpdate.java index 4ac5f0c8bcb..88cb23e0ff0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUpdate.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IUpdate.java @@ -20,11 +20,11 @@ package ca.uhn.fhir.rest.gclient; * #L% */ -import ca.uhn.fhir.model.api.IResource; +import org.hl7.fhir.instance.model.IBaseResource; public interface IUpdate { - IUpdateTyped resource(IResource theResource); + IUpdateTyped resource(IBaseResource theResource); IUpdateTyped resource(String theResourceBody); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java index 376dde07cf4..475709fdf1e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java @@ -38,7 +38,6 @@ import org.hl7.fhir.instance.model.api.IBaseBinary; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.parser.DataFormatException; @@ -64,7 +63,7 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca private String myIfNoneExistString; private Map> myParams; private final IBaseResource myResource; - private final List myResources; + private final List myResources; private final TagList myTagList; private final String myUrlPath; @@ -104,7 +103,7 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca myBundleType = null; } - public BaseHttpClientInvocationWithContents(FhirContext theContext, List theResources, BundleTypeEnum theBundleType) { + public BaseHttpClientInvocationWithContents(FhirContext theContext, List theResources, BundleTypeEnum theBundleType) { myContext = theContext; myResource = null; myTagList = null; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseMethodBinding.java index 9fd7a32a297..5013174f13d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseMethodBinding.java @@ -510,9 +510,9 @@ public abstract class BaseMethodBinding implements IClientResponseHandler } else if (response instanceof IResource) { return BundleProviders.newList((IResource) response); } else if (response instanceof Collection) { - List retVal = new ArrayList(); + List retVal = new ArrayList(); for (Object next : ((Collection) response)) { - retVal.add((IResource) next); + retVal.add((IBaseResource) next); } return BundleProviders.newList(retVal); } else { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java index e04f1573e16..aa86fdc744d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java @@ -255,7 +255,7 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding= 0; i--) { IServerInterceptor next = theServer.getInterceptors().get(i); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java index c6b893aec95..abd11e53f36 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/DeleteMethodBinding.java @@ -26,6 +26,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.hl7.fhir.instance.model.api.IIdType; + import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; @@ -140,7 +142,7 @@ public class DeleteMethodBinding extends BaseOutcomeReturningMethodBinding { return retVal; } - public static HttpDeleteClientInvocation createDeleteInvocation(IdDt theId) { + public static HttpDeleteClientInvocation createDeleteInvocation(IIdType theId) { HttpDeleteClientInvocation retVal = new HttpDeleteClientInvocation(theId); return retVal; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java index 5ad0c0a097b..e98b44c5014 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java @@ -186,15 +186,15 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding { } @Override - public List getResources(int theFromIndex, int theToIndex) { - List retVal = resources.getResources(theFromIndex, theToIndex); + public List getResources(int theFromIndex, int theToIndex) { + List retVal = resources.getResources(theFromIndex, theToIndex); int index = theFromIndex; - for (IResource nextResource : retVal) { + for (IBaseResource nextResource : retVal) { if (nextResource.getId() == null || isBlank(nextResource.getId().getIdPart())) { throw new InternalErrorException("Server provided resource at index " + index + " with no ID set (using IResource#setId(IdDt))"); } - if (isBlank(nextResource.getId().getVersionIdPart())) { - IdDt versionId = (IdDt) ResourceMetadataKeyEnum.VERSION_ID.get(nextResource); + if (isBlank(nextResource.getId().getVersionIdPart()) && nextResource instanceof IResource) { + IdDt versionId = (IdDt) ResourceMetadataKeyEnum.VERSION_ID.get((IResource) nextResource); if (versionId == null || versionId.isEmpty()) { throw new InternalErrorException("Server provided resource at index " + index + " with no Version ID set (using IResource#setId(IdDt))"); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpDeleteClientInvocation.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpDeleteClientInvocation.java index 3bee2d4770e..02471c13751 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpDeleteClientInvocation.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpDeleteClientInvocation.java @@ -25,8 +25,8 @@ import java.util.Map; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpRequestBase; +import org.hl7.fhir.instance.model.api.IIdType; -import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.client.BaseHttpClientInvocation; import ca.uhn.fhir.rest.server.EncodingEnum; @@ -35,7 +35,7 @@ public class HttpDeleteClientInvocation extends BaseHttpClientInvocation { private String myUrlPath; private Map> myParams; - public HttpDeleteClientInvocation(IdDt theId) { + public HttpDeleteClientInvocation(IIdType theId) { super(); myUrlPath = theId.toUnqualifiedVersionless().getValue(); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpPostClientInvocation.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpPostClientInvocation.java index 8bf41041b4f..a3e7d2403bb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpPostClientInvocation.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HttpPostClientInvocation.java @@ -29,7 +29,6 @@ import org.hl7.fhir.instance.model.IBaseResource; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.valueset.BundleTypeEnum; @@ -48,7 +47,7 @@ public class HttpPostClientInvocation extends BaseHttpClientInvocationWithConten super(theContext, theTagList, theUrlExtension); } - public HttpPostClientInvocation(FhirContext theContext, List theResources, BundleTypeEnum theBundleType) { + public HttpPostClientInvocation(FhirContext theContext, List theResources, BundleTypeEnum theBundleType) { super(theContext, theResources, theBundleType); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java index d3a32cf8886..67ddb0a1ecf 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationMethodBinding.java @@ -45,7 +45,6 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum; import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum; import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.annotation.Operation; @@ -237,12 +236,12 @@ public class OperationMethodBinding extends BaseResourceReturningMethodBinding { Map> params = new HashMap>(); for (Object nextParameter : parameters) { - StringDt nextNameDt = (StringDt) t.getSingleValueOrNull((IBase) nextParameter, "name"); + IPrimitiveType nextNameDt = (IPrimitiveType) t.getSingleValueOrNull((IBase) nextParameter, "name"); if (nextNameDt == null || nextNameDt.isEmpty()) { ourLog.warn("Ignoring input parameter with no value in Parameters.parameter.name in operation client invocation"); continue; } - String nextName = nextNameDt.getValue(); + String nextName = nextNameDt.getValueAsString(); if (!params.containsKey(nextName)) { params.put(nextName, new ArrayList()); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParamBinder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParamBinder.java index 7970e5b6349..5ca6e39f9eb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParamBinder.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParamBinder.java @@ -35,6 +35,7 @@ import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.BaseRuntimeChildDefinition.IAccessor; import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.RuntimeChildPrimitiveDatatypeDefinition; import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition; @@ -51,6 +52,7 @@ class OperationParamBinder implements IParameter { private final String myName; private Class myParameterType; + @SuppressWarnings("rawtypes") private Class myInnerCollectionType; private final String myOperationName; @@ -72,30 +74,36 @@ class OperationParamBinder implements IParameter { BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition paramChildElem = (BaseRuntimeElementCompositeDefinition) paramChild.getChildByName("parameter"); - addClientParameter(theSourceClientArgument, theTargetResource, paramChild, paramChildElem); + addClientParameter(theContext, theSourceClientArgument, theTargetResource, paramChild, paramChildElem); } - private void addClientParameter(Object theSourceClientArgument, IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition paramChildElem) { + private void addClientParameter(FhirContext theContext, Object theSourceClientArgument, IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition paramChildElem) { if (theSourceClientArgument instanceof IBaseResource) { - IBase parameter = createParameterRepetition(theTargetResource, paramChild, paramChildElem); + IBase parameter = createParameterRepetition(theContext, theTargetResource, paramChild, paramChildElem); paramChildElem.getChildByName("resource").getMutator().addValue(parameter, (IBaseResource) theSourceClientArgument); } else if (theSourceClientArgument instanceof IBaseDatatype) { - IBase parameter = createParameterRepetition(theTargetResource, paramChild, paramChildElem); + IBase parameter = createParameterRepetition(theContext, theTargetResource, paramChild, paramChildElem); paramChildElem.getChildByName("value[x]").getMutator().addValue(parameter, (IBaseDatatype) theSourceClientArgument); } else if (theSourceClientArgument instanceof Collection) { Collection collection = (Collection) theSourceClientArgument; for (Object next : collection) { - addClientParameter(next, theTargetResource, paramChild, paramChildElem); + addClientParameter(theContext, next, theTargetResource, paramChild, paramChildElem); } } else { throw new IllegalArgumentException("Don't know how to handle value of type " + theSourceClientArgument.getClass() + " for paramater " + myName); } } - private IBase createParameterRepetition(IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition paramChildElem) { + private IBase createParameterRepetition(FhirContext theContext, IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition paramChildElem) { IBase parameter = paramChildElem.newInstance(); paramChild.getMutator().addValue(theTargetResource, parameter); - paramChildElem.getChildByName("name").getMutator().addValue(parameter, new StringDt(myName)); + IPrimitiveType value; + if (theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) { + value = (IPrimitiveType) theContext.getElementDefinition("string").newInstance(myName); + } else { + value = new StringDt(myName); + } + paramChildElem.getChildByName("name").getMutator().addValue(parameter, value); return parameter; } 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 4bfb86ca82f..2016f19dbe6 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 @@ -205,8 +205,8 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding implem if (theRequest.getServer().getETagSupport() == ETagSupportEnum.ENABLED) { String ifNoneMatch = ((Request)theRequest).getServletRequest().getHeader(Constants.HEADER_IF_NONE_MATCH_LC); if (retVal.size() == 1 && StringUtils.isNotBlank(ifNoneMatch)) { - List responseResources = retVal.getResources(0, 1); - IResource responseResource = responseResources.get(0); + List responseResources = retVal.getResources(0, 1); + IBaseResource responseResource = responseResources.get(0); ifNoneMatch = MethodUtil.parseETagValue(ifNoneMatch); if (responseResource.getId() != null && responseResource.getId().hasVersionIdPart()) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionMethodBinding.java index 29cc5d4158b..83fa8dfe9fa 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/TransactionMethodBinding.java @@ -20,13 +20,14 @@ package ca.uhn.fhir.rest.method; * #L% */ -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.io.IOException; import java.lang.reflect.Method; import java.util.IdentityHashMap; import java.util.List; +import org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseBundle; import ca.uhn.fhir.context.ConfigurationException; @@ -117,7 +118,7 @@ public class TransactionMethodBinding extends BaseResourceReturningMethodBinding return createTransactionInvocation(bundle, context); } else { @SuppressWarnings("unchecked") - List resources = (List) theArgs[myTransactionParamIndex]; + List resources = (List) theArgs[myTransactionParamIndex]; return createTransactionInvocation(resources, context); } } @@ -161,10 +162,10 @@ public class TransactionMethodBinding extends BaseResourceReturningMethodBinding * " entries, but server method response contained " + retVal.size() + " entries (must be the same)"); } } */ - List retResources = retVal.getResources(0, retVal.size()); + List retResources = retVal.getResources(0, retVal.size()); for (int i = 0; i < retResources.size(); i++) { IdDt oldId = oldIds.get(retResources.get(i)); - IResource newRes = retResources.get(i); + IBaseResource newRes = retResources.get(i); if (newRes.getId() == null || newRes.getId().isEmpty()) { if (!(newRes instanceof BaseOperationOutcome)) { throw new InternalErrorException("Transaction method returned resource at index " + i + " with no id specified - IResource#setId(IdDt)"); @@ -172,8 +173,8 @@ public class TransactionMethodBinding extends BaseResourceReturningMethodBinding } if (oldId != null && !oldId.isEmpty()) { - if (!oldId.equals(newRes.getId())) { - newRes.getResourceMetadata().put(ResourceMetadataKeyEnum.PREVIOUS_ID, oldId); + if (!oldId.equals(newRes.getId()) && newRes instanceof IResource) { + ((IResource)newRes).getResourceMetadata().put(ResourceMetadataKeyEnum.PREVIOUS_ID, oldId); } } } @@ -194,7 +195,7 @@ public class TransactionMethodBinding extends BaseResourceReturningMethodBinding return new HttpPostClientInvocation(theContext, theBundle); } - public static BaseHttpClientInvocation createTransactionInvocation(List theResources, FhirContext theContext) { + public static BaseHttpClientInvocation createTransactionInvocation(List theResources, FhirContext theContext) { return new HttpPostClientInvocation(theContext, theResources, BundleTypeEnum.TRANSACTION); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/BundleProviders.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/BundleProviders.java index db8e294cd1b..37cce69bf67 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/BundleProviders.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/BundleProviders.java @@ -23,6 +23,8 @@ package ca.uhn.fhir.rest.server; import java.util.Collections; import java.util.List; +import org.hl7.fhir.instance.model.IBaseResource; + import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.primitive.InstantDt; @@ -43,7 +45,7 @@ public class BundleProviders { final InstantDt published = InstantDt.withCurrentTime(); return new IBundleProvider() { @Override - public List getResources(int theFromIndex, int theToIndex) { + public List getResources(int theFromIndex, int theToIndex) { return Collections.emptyList(); } @@ -64,11 +66,11 @@ public class BundleProviders { }; } - public static IBundleProvider newList(IResource theResource) { + public static IBundleProvider newList(IBaseResource theResource) { return new SimpleBundleProvider(theResource); } - public static IBundleProvider newList(List theResources) { + public static IBundleProvider newList(List theResources) { return new SimpleBundleProvider(theResources); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java index eaf7b4a2471..f27e6c5bc39 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java @@ -28,6 +28,8 @@ import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; +import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.api.IIdType; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; @@ -57,7 +59,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { @Override - public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { + public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { if (myBundle == null) { myBundle = new Bundle(); } @@ -65,14 +67,15 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { List includedResources = new ArrayList(); Set addedResourceIds = new HashSet(); - for (IResource next : theResult) { + for (IBaseResource next : theResult) { if (next.getId().isEmpty() == false) { - addedResourceIds.add(next.getId()); + addedResourceIds.add((IdDt) next.getId()); } } - for (IResource next : theResult) { - + for (IBaseResource nextBaseRes : theResult) { + IResource next = (IResource)nextBaseRes; + Set containedIds = new HashSet(); for (IResource nextContained : next.getContained().getContainedResources()) { if (nextContained.getId().isEmpty() == false) { @@ -152,7 +155,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { public void initializeBundleFromBundleProvider(RestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { int numToReturn; String searchId = null; - List resourceList; + List resourceList; if (theServer.getPagingProvider() == null) { numToReturn = theResult.size(); resourceList = theResult.getResources(0, numToReturn); @@ -180,7 +183,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } } - for (IResource next : resourceList) { + for (IBaseResource next : resourceList) { if (next.getId() == null || next.getId().isEmpty()) { if (!(next instanceof BaseOperationOutcome)) { throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)"); @@ -189,7 +192,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - for (IResource nextRes : resourceList) { + for (IBaseResource nextRes : resourceList) { RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); @@ -197,7 +200,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } } - addResourcesToBundle(resourceList, theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); + addResourcesToBundle(new ArrayList(resourceList), theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType); myBundle.setPublished(theResult.getPublished()); @@ -261,7 +264,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeBundleFromResourceList(String theAuthor, List theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { + public void initializeBundleFromResourceList(String theAuthor, List theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { myBundle = new Bundle(); myBundle.getAuthorName().setValue(theAuthor); @@ -271,17 +274,18 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { myBundle.getLinkSelf().setValue(theCompleteUrl); myBundle.getType().setValueAsEnum(theBundleType); - List includedResources = new ArrayList(); - Set addedResourceIds = new HashSet(); + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); - for (IResource next : theResult) { + for (IBaseResource next : theResult) { if (next.getId().isEmpty() == false) { addedResourceIds.add(next.getId()); } } - for (IResource next : theResult) { - + for (IBaseResource nextRes : theResult) { + IResource next = (IResource) nextRes; + Set containedIds = new HashSet(); for (IResource nextContained : next.getContained().getContainedResources()) { if (nextContained.getId().isEmpty() == false) { @@ -301,26 +305,26 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class); do { - List addedResourcesThisPass = new ArrayList(); + List addedResourcesThisPass = new ArrayList(); for (BaseResourceReferenceDt nextRef : references) { - IResource nextRes = (IResource) nextRef.getResource(); - if (nextRes != null) { - if (nextRes.getId().hasIdPart()) { - if (containedIds.contains(nextRes.getId().getValue())) { + IBaseResource nextRefRes = (IBaseResource) nextRef.getResource(); + if (nextRefRes != null) { + if (nextRefRes.getId().hasIdPart()) { + if (containedIds.contains(nextRefRes.getId().getValue())) { // Don't add contained IDs as top level resources continue; } - IdDt id = nextRes.getId(); + IIdType id = nextRefRes.getId(); if (id.hasResourceType() == false) { - String resName = myContext.getResourceDefinition(nextRes).getName(); + String resName = myContext.getResourceDefinition(nextRefRes).getName(); id = id.withResourceType(resName); } if (!addedResourceIds.contains(id)) { addedResourceIds.add(id); - addedResourcesThisPass.add(nextRes); + addedResourcesThisPass.add(nextRefRes); } } @@ -329,7 +333,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { // Linked resources may themselves have linked resources references = new ArrayList(); - for (IResource iResource : addedResourcesThisPass) { + for (IBaseResource iResource : addedResourcesThisPass) { List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class); references.addAll(newReferences); } @@ -345,8 +349,8 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { /* * Actually add the resources to the bundle */ - for (IResource next : includedResources) { - BundleEntry entry = myBundle.addResource(next, myContext, theServerBase); + for (IBaseResource next : includedResources) { + BundleEntry entry = myBundle.addResource((IResource) next, myContext, theServerBase); if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) { if (entry.getSearchMode().isEmpty()) { entry.getSearchMode().setValueAsEnum(BundleEntrySearchModeEnum.INCLUDE); @@ -358,14 +362,14 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeWithBundleResource(IResource theResource) { + public void initializeWithBundleResource(IBaseResource theResource) { throw new UnsupportedOperationException("DSTU1 server doesn't support resource style bundles"); } @Override - public List toListOfResources() { - return myBundle.toListOfResources(); + public List toListOfResources() { + return new ArrayList( myBundle.toListOfResources()); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java index 42b310a90f2..1f518bca07a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java @@ -22,7 +22,8 @@ package ca.uhn.fhir.rest.server; import java.util.List; -import ca.uhn.fhir.model.api.IResource; +import org.hl7.fhir.instance.model.IBaseResource; + import ca.uhn.fhir.model.primitive.InstantDt; public interface IBundleProvider { @@ -37,7 +38,7 @@ public interface IBundleProvider { * @param theToIndex The high index (exclusive) to return * @return A list of resources. The size of this list must be at least theToIndex - theFromIndex. */ - List getResources(int theFromIndex, int theToIndex); + List getResources(int theFromIndex, int theToIndex); /** * Optionally may be used to signal a preferred page size to the server, e.g. because diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java index 5e6e1f8d9ce..77f379bc75f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java @@ -23,8 +23,9 @@ package ca.uhn.fhir.rest.server; import java.util.List; import java.util.Set; +import org.hl7.fhir.instance.model.IBaseResource; + import ca.uhn.fhir.model.api.Bundle; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.valueset.BundleTypeEnum; @@ -34,7 +35,7 @@ import ca.uhn.fhir.model.valueset.BundleTypeEnum; */ public interface IVersionSpecificBundleFactory { - void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes); + void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes); void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType); @@ -43,12 +44,12 @@ public interface IVersionSpecificBundleFactory { Bundle getDstu1Bundle(); - IResource getResourceBundle(); + IBaseResource getResourceBundle(); - void initializeBundleFromResourceList(String theAuthor, List theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType); + void initializeBundleFromResourceList(String theAuthor, List theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType); - void initializeWithBundleResource(IResource theResource); + void initializeWithBundleResource(IBaseResource theResource); - List toListOfResources(); + List toListOfResources(); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java index 44cef3dfc59..26daa5255cd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java @@ -27,6 +27,7 @@ import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URLEncoder; +import java.util.Date; import java.util.Enumeration; import java.util.List; import java.util.Map; @@ -39,7 +40,10 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.http.client.utils.DateUtils; +import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseBinary; +import org.hl7.fhir.instance.model.api.IIdType; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; @@ -49,7 +53,6 @@ import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.method.Request; @@ -72,13 +75,13 @@ public class RestfulServerUtils { return count; } - public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint, + public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IBaseResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint, boolean theRequestIsBrowser, RestfulServer.NarrativeModeEnum theNarrativeMode, int stausCode, boolean theRespondGzip, String theServerBase) throws IOException { theHttpResponse.setStatus(stausCode); if (theResource.getId() != null && theResource.getId().hasIdPart() && isNotBlank(theServerBase)) { String resName = theServer.getFhirContext().getResourceDefinition(theResource).getName(); - IdDt fullId = theResource.getId().withServerBase(theServerBase, resName); + IIdType fullId = theResource.getId().withServerBase(theServerBase, resName); theHttpResponse.addHeader(Constants.HEADER_CONTENT_LOCATION, fullId.getValue()); } @@ -130,24 +133,31 @@ public class RestfulServerUtils { theServer.addHeadersToResponse(theHttpResponse); - InstantDt lastUpdated = ResourceMetadataKeyEnum.UPDATED.get(theResource); - if (lastUpdated != null && lastUpdated.isEmpty() == false) { - theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated.getValue())); - } - - TagList list = (TagList) theResource.getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST); - if (list != null) { - for (Tag tag : list) { - if (StringUtils.isNotBlank(tag.getTerm())) { - theHttpResponse.addHeader(Constants.HEADER_CATEGORY, tag.toHeaderValue()); + if (theResource instanceof IResource) { + InstantDt lastUpdated = ResourceMetadataKeyEnum.UPDATED.get((IResource) theResource); + if (lastUpdated != null && lastUpdated.isEmpty() == false) { + theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated.getValue())); + } + + TagList list = (TagList) ((IResource)theResource).getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST); + if (list != null) { + for (Tag tag : list) { + if (StringUtils.isNotBlank(tag.getTerm())) { + theHttpResponse.addHeader(Constants.HEADER_CATEGORY, tag.toHeaderValue()); + } } } + } else { + Date lastUpdated = ((IAnyResource)theResource).getMeta().getLastUpdated(); + if (lastUpdated != null) { + theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated)); + } } Writer writer = getWriter(theHttpResponse, theRespondGzip); try { - if (theNarrativeMode == RestfulServer.NarrativeModeEnum.ONLY) { - writer.append(theResource.getText().getDiv().getValueAsString()); + if (theNarrativeMode == RestfulServer.NarrativeModeEnum.ONLY && theResource instanceof IResource) { + writer.append(((IResource)theResource).getText().getDiv().getValueAsString()); } else { IParser parser = getNewParser(theServer.getFhirContext(), responseEncoding, thePrettyPrint, theNarrativeMode); parser.setServerBaseUrl(theServerBase); @@ -267,18 +277,19 @@ public class RestfulServerUtils { } } - public static void addProfileToBundleEntry(FhirContext theContext, IResource theResource, String theServerBase) { - - TagList tl = ResourceMetadataKeyEnum.TAG_LIST.get(theResource); - if (tl == null) { - tl = new TagList(); - ResourceMetadataKeyEnum.TAG_LIST.put(theResource, tl); - } - - RuntimeResourceDefinition nextDef = theContext.getResourceDefinition(theResource); - String profile = nextDef.getResourceProfile(theServerBase); - if (isNotBlank(profile)) { - tl.add(new Tag(Tag.HL7_ORG_PROFILE_TAG, profile, null)); + public static void addProfileToBundleEntry(FhirContext theContext, IBaseResource theResource, String theServerBase) { + if (theResource instanceof IResource) { + TagList tl = ResourceMetadataKeyEnum.TAG_LIST.get((IResource) theResource); + if (tl == null) { + tl = new TagList(); + ResourceMetadataKeyEnum.TAG_LIST.put((IResource) theResource, tl); + } + + RuntimeResourceDefinition nextDef = theContext.getResourceDefinition(theResource); + String profile = nextDef.getResourceProfile(theServerBase); + if (isNotBlank(profile)) { + tl.add(new Tag(Tag.HL7_ORG_PROFILE_TAG, profile, null)); + } } } @@ -402,14 +413,14 @@ public class RestfulServerUtils { } } - public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint, + public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IBaseResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint, boolean theRequestIsBrowser, RestfulServer.NarrativeModeEnum theNarrativeMode, boolean theRespondGzip, String theServerBase) throws IOException { int stausCode = 200; RestfulServerUtils.streamResponseAsResource(theServer, theHttpResponse, theResource, theResponseEncoding, thePrettyPrint, theRequestIsBrowser, theNarrativeMode, stausCode, theRespondGzip, theServerBase); } - public static void validateResourceListNotNull(List theResourceList) { + public static void validateResourceListNotNull(List theResourceList) { if (theResourceList == null) { throw new InternalErrorException("IBundleProvider returned a null list of resources - This is not allowed"); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/SimpleBundleProvider.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/SimpleBundleProvider.java index 1c004974537..058539d306b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/SimpleBundleProvider.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/SimpleBundleProvider.java @@ -23,18 +23,19 @@ package ca.uhn.fhir.rest.server; import java.util.Collections; import java.util.List; -import ca.uhn.fhir.model.api.IResource; +import org.hl7.fhir.instance.model.IBaseResource; + import ca.uhn.fhir.model.primitive.InstantDt; public class SimpleBundleProvider implements IBundleProvider { - private List myList; + private List myList; - public SimpleBundleProvider(List theList) { + public SimpleBundleProvider(List theList) { myList = theList; } - public SimpleBundleProvider(IResource theResource) { + public SimpleBundleProvider(IBaseResource theResource) { myList = Collections.singletonList(theResource); } @@ -46,7 +47,7 @@ public class SimpleBundleProvider implements IBundleProvider { } @Override - public List getResources(int theFromIndex, int theToIndex) { + public List getResources(int theFromIndex, int theToIndex) { return myList.subList(theFromIndex, Math.min(theToIndex, myList.size())); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java index a03696e2ac3..bc9ba133544 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java @@ -26,6 +26,7 @@ import java.util.List; import org.hl7.fhir.instance.model.IBase; import ca.uhn.fhir.model.api.ICompositeElement; +import ca.uhn.fhir.model.api.IElement; public class ElementUtil { @@ -62,6 +63,19 @@ public class ElementUtil { return true; } + public static boolean isEmpty(IElement... theElements) { + if (theElements == null) { + return true; + } + for (int i = 0; i < theElements.length; i++) { + IBase next = theElements[i]; + if (next != null && !next.isEmpty()) { + return false; + } + } + return true; + } + public static boolean isEmpty(List theElements) { if (theElements == null) { return true; diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/IBaseResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/IBaseResource.java index e0cad744a75..b1c1512b088 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/IBaseResource.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/IBaseResource.java @@ -2,6 +2,8 @@ package org.hl7.fhir.instance.model; import org.hl7.fhir.instance.model.api.IIdType; +import ca.uhn.fhir.model.api.TagList; + /* * #%L * HAPI FHIR - Core Library diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseConformance.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseConformance.java new file mode 100644 index 00000000000..66752739afb --- /dev/null +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseConformance.java @@ -0,0 +1,7 @@ +package org.hl7.fhir.instance.model.api; + +import org.hl7.fhir.instance.model.IBaseResource; + +public interface IBaseConformance extends IBaseResource { + +} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java index 072b3c37eb6..24ab6d8e11a 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java @@ -22,7 +22,7 @@ package org.hl7.fhir.instance.model.api; import java.util.List; -public interface IDomainResource { +public interface IDomainResource extends IAnyResource { List getContained(); diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java index 649d9d2437c..de8b50555c6 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java @@ -1,5 +1,7 @@ package org.hl7.fhir.instance.model.api; +import ca.uhn.fhir.model.primitive.IdDt; + /* * #%L * HAPI FHIR - Core Library @@ -55,4 +57,16 @@ public interface IIdType { String getVersionIdPart(); + IIdType toUnqualified(); + + boolean hasResourceType(); + + IIdType withResourceType(String theResName); + + String getResourceType(); + + IIdType withServerBase(String theServerBase, String theResourceName); + + boolean isAbsolute(); + } diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IMetaType.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IMetaType.java index af3a21bffe7..f48954d8ed1 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IMetaType.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IMetaType.java @@ -30,4 +30,8 @@ public interface IMetaType extends ICompositeType { IMetaType setLastUpdated(Date theHeaderDateValue); + Date getLastUpdated(); + + String getVersionId(); + } diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/ContainedResourceEncodingTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/ContainedResourceEncodingTest.java index a38f716dbdb..5cdbff08581 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/ContainedResourceEncodingTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/ContainedResourceEncodingTest.java @@ -1,11 +1,12 @@ package ca.uhn.fhir.parser; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -14,7 +15,6 @@ import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu.composite.HumanNameDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; @@ -191,7 +191,7 @@ public class ContainedResourceEncodingTest { observation.setPerformer(performers); - List list = new ArrayList(); + List list = new ArrayList(); list.add(dr); IVersionSpecificBundleFactory factory = ctx.newBundleFactory(); @@ -233,7 +233,7 @@ public class ContainedResourceEncodingTest { observation.setPerformer(performers); - List list = new ArrayList(); + List list = new ArrayList(); list.add(dr); IVersionSpecificBundleFactory factory = ctx.newBundleFactory(); diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java index 782a4d971c6..e20ca86e6ca 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java @@ -687,7 +687,7 @@ public class GenericClientTest { Bundle response = client.search() .forResource(Patient.class) .encodedJson() - .revinclude(Provenance.INCLUDE_TARGET) + .revInclude(Provenance.INCLUDE_TARGET) .execute(); //@formatter:on diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/Dstu1BundleFactoryTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/Dstu1BundleFactoryTest.java index bd314628214..404564532be 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/Dstu1BundleFactoryTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/Dstu1BundleFactoryTest.java @@ -1,26 +1,36 @@ package ca.uhn.fhir.rest.server; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.hl7.fhir.instance.model.IBaseResource; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + import ca.uhn.fhir.context.FhirContext; 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.api.Include; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; -import ca.uhn.fhir.model.dstu.resource.*; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.*; - -import static org.junit.Assert.assertEquals; +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.resource.Practitioner; +import ca.uhn.fhir.model.dstu.resource.Specimen; /** * Created by Bill de Beaubien on 3/3/2015. */ public class Dstu1BundleFactoryTest { private static FhirContext ourCtx; - private List myResourceList; + private List myResourceList; private Dstu1BundleFactory myBundleFactory; @BeforeClass @@ -71,7 +81,7 @@ public class Dstu1BundleFactoryTest { specimen1.setSubject(new ResourceReferenceDt(patient)); specimen1.getCollection().setCollector(new ResourceReferenceDt(practitioner)); - myResourceList = Arrays.asList(new IResource[]{diagnosticReport}); + myResourceList = Arrays.asList(new IBaseResource[]{diagnosticReport}); myBundleFactory = new Dstu1BundleFactory(ourCtx); } diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/PagingTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/PagingTest.java index 6ae30ade1d6..2b2178438db 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/PagingTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/PagingTest.java @@ -1,8 +1,13 @@ package ca.uhn.fhir.rest.server; import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; @@ -19,6 +24,7 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hamcrest.Matchers; +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -284,7 +290,7 @@ public class PagingTest { builder.setConnectionManager(connectionManager); ourClient = builder.build(); - List retVal = new ArrayList(); + List retVal = new ArrayList(); for (int i = 0; i < 10; i++) { Patient patient = new Patient(); patient.setId("" + i); diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/RestfulServerMethodTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/RestfulServerMethodTest.java index b852e94b021..b6872afbbf3 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/RestfulServerMethodTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/RestfulServerMethodTest.java @@ -1,8 +1,13 @@ package ca.uhn.fhir.rest.server; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Arrays; @@ -33,6 +38,7 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hamcrest.core.StringContains; import org.hamcrest.core.StringEndsWith; +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -95,7 +101,7 @@ public class RestfulServerMethodTest { @Test public void testCreateBundleDoesntCreateDoubleEntries() { - List resources = new ArrayList(); + List resources = new ArrayList(); Patient p = new Patient(); p.setId("Patient/1"); diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index 242553ea6f1..d92c8cf282b 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -40,7 +40,7 @@ xmlunit xmlunit - 1.5 + 1.6 test diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java index b0b5e254061..1034d2319cd 100644 --- a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java @@ -31,9 +31,11 @@ import java.util.UUID; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.rest.server.*; import ca.uhn.fhir.util.ResourceReferenceInfo; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.api.IIdType; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; @@ -63,7 +65,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { + public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { if (myBundle == null) { myBundle = new Bundle(); } @@ -71,13 +73,14 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { List includedResources = new ArrayList(); Set addedResourceIds = new HashSet(); - for (IResource next : theResult) { + for (IBaseResource next : theResult) { if (next.getId().isEmpty() == false) { - addedResourceIds.add(next.getId()); + addedResourceIds.add((IdDt) next.getId()); } } - for (IResource next : theResult) { + for (IBaseResource nextBaseRes : theResult) { + IResource next = (IResource) nextBaseRes; Set containedIds = new HashSet(); for (IResource nextContained : next.getContained().getContainedResources()) { @@ -197,7 +200,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { public void initializeBundleFromBundleProvider(RestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { int numToReturn; String searchId = null; - List resourceList; + List resourceList; if (theServer.getPagingProvider() == null) { numToReturn = theResult.size(); resourceList = theResult.getResources(0, numToReturn); @@ -225,7 +228,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } } - for (IResource next : resourceList) { + for (IBaseResource next : resourceList) { if (next.getId() == null || next.getId().isEmpty()) { if (!(next instanceof BaseOperationOutcome)) { throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)"); @@ -234,7 +237,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - for (IResource nextRes : resourceList) { + for (IBaseResource nextRes : resourceList) { RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); @@ -242,7 +245,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } } - addResourcesToBundle(resourceList, theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); + addResourcesToBundle(new ArrayList(resourceList), theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType); if (theServer.getPagingProvider() != null) { @@ -273,7 +276,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { + public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { myBundle = new Bundle(); myBundle.setId(UUID.randomUUID().toString()); @@ -285,7 +288,8 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) { - for (IResource next : theResources) { + for (IBaseResource nextBaseRes : theResources) { + IResource next = (IResource)nextBaseRes; Entry nextEntry = myBundle.addEntry(); nextEntry.setResource(next); @@ -308,18 +312,18 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { myBundle.getTotalElement().setValue(theTotalResults); } - private void addResourcesForSearch(List theResult) { - List includedResources = new ArrayList(); - Set addedResourceIds = new HashSet(); + private void addResourcesForSearch(List theResult) { + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); - for (IResource next : theResult) { + for (IBaseResource next : theResult) { if (next.getId().isEmpty() == false) { addedResourceIds.add(next.getId()); } } - for (IResource next : theResult) { - + for (IBaseResource nextBaseRes : theResult) { + IResource next = (IResource)nextBaseRes; Set containedIds = new HashSet(); for (IResource nextContained : next.getContained().getContainedResources()) { if (nextContained.getId().isEmpty() == false) { @@ -383,19 +387,19 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { /* * Actually add the resources to the bundle */ - for (IResource next : includedResources) { - myBundle.addEntry().setResource(next).getSearch().setMode(SearchEntryModeEnum.INCLUDE); + for (IBaseResource next : includedResources) { + myBundle.addEntry().setResource((IResource) next).getSearch().setMode(SearchEntryModeEnum.INCLUDE); } } @Override - public void initializeWithBundleResource(IResource theBundle) { + public void initializeWithBundleResource(IBaseResource theBundle) { myBundle = (Bundle) theBundle; } @Override - public List toListOfResources() { - ArrayList retVal = new ArrayList(); + public List toListOfResources() { + ArrayList retVal = new ArrayList(); for (Entry next : myBundle.getEntry()) { if (next.getResource()!=null) { retVal.add(next.getResource()); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java index 9ae9f365144..504dc280898 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java @@ -58,6 +58,28 @@ public class JsonParserDstu2Test { assertEquals("{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val); } + + @Test + public void testEncodingNullExtension() { + Patient p = new Patient(); + ExtensionDt extension = new ExtensionDt(false, "http://foo#bar"); + p.addUndeclaredExtension(extension); + String str = ourCtx.newJsonParser().encodeResourceToString(p); + + assertEquals("{\"resourceType\":\"Patient\"}", str); + + extension.setValue(new StringDt()); + + str = ourCtx.newJsonParser().encodeResourceToString(p); + assertEquals("{\"resourceType\":\"Patient\"}", str); + + extension.setValue(new StringDt("")); + + str = ourCtx.newJsonParser().encodeResourceToString(p); + assertEquals("{\"resourceType\":\"Patient\"}", str); + + } + /** * See #144 and #146 */ diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/RoundTripDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/RoundTripDstu2Test.java new file mode 100644 index 00000000000..f3cb36fd9de --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/RoundTripDstu2Test.java @@ -0,0 +1,113 @@ +package ca.uhn.fhir.parser; + +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.XMLEvent; + +import org.apache.commons.io.IOUtils; +import org.custommonkey.xmlunit.DetailedDiff; +import org.custommonkey.xmlunit.Diff; +import org.custommonkey.xmlunit.Difference; +import org.custommonkey.xmlunit.DifferenceListener; +import org.hl7.fhir.instance.model.IBaseResource; +import org.junit.Test; +import org.w3c.dom.Node; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.util.XmlUtil; + +public class RoundTripDstu2Test { + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RoundTripDstu2Test.class); + private static FhirContext ourCtx = FhirContext.forDstu2(); + + @Test + public void testRoundTrip() throws Exception { + ZipInputStream is = new ZipInputStream(new FileInputStream("src/test/resources/examples.zip")); + try { + while (true) { + ZipEntry nextEntry = is.getNextEntry(); + if (nextEntry == null) { + break; + } + + ByteArrayOutputStream oos = new ByteArrayOutputStream(); + byte[] buffer = new byte[2048]; + int len = 0; + while ((len = is.read(buffer)) > 0) { + oos.write(buffer, 0, len); + } + + String exampleText = oos.toString("UTF-8"); + ourLog.info("Next file: {} - Size: {} bytes", nextEntry.getName(), exampleText.length()); + if (!nextEntry.getName().contains("diagnosticreport-examples-lab")) { + continue; + } + + IBaseResource parsed = ourCtx.newXmlParser().parseResource(exampleText); + String encodedXml = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(parsed); + + exampleText = cleanXml(exampleText); + encodedXml = cleanXml(encodedXml); + + DetailedDiff d = new DetailedDiff(new Diff(new StringReader(exampleText), new StringReader(encodedXml))); +// d.overrideDifferenceListener(new DifferenceListener() { +// +// @Override +// public void skippedComparison(Node theControl, Node theTest) { +// ourLog.info("" + theControl); +// } +// +// @Override +// public int differenceFound(Difference theDifference) { +// ourLog.info("" + theDifference); +// return 0; +// } +// }); + + boolean similar = d.similar(); + if (!similar) { + exampleText = exampleText.replace(" xmlns=\"http://hl7.org/fhir\"", ""); + encodedXml = encodedXml.replace(" xmlns=\"http://hl7.org/fhir\"", ""); + if (exampleText.length() != encodedXml.length()) { +// ourLog.info("Expected: " + exampleText); +// ourLog.info("Actual : " + encodedXml); + assertTrue(d.toString(), similar); + } + } + + } + + } finally { + is.close(); + } + } + + private String cleanXml(String exampleText) throws Error, Exception { + XMLEventReader read = XmlUtil.createXmlReader(new StringReader(exampleText)); + StringWriter sw = new StringWriter(); + XMLEventWriter write = XmlUtil.createXmlWriter(sw); + while (read.hasNext()) { + XMLEvent nextEvent = read.nextEvent(); + if (nextEvent.getEventType() == XMLStreamConstants.COMMENT) { + continue; + } + write.add(nextEvent); + } + write.add(read); + sw.close(); + return sw.toString().replaceAll("", "").replace("\n", " ").replace("\r", " ").replaceAll(">\\s+<", "><").replaceAll("<\\?.*\\?>", "").replaceAll("\\s+", " "); + } + +} diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java index 831215fd597..d701f863529 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java @@ -1,7 +1,16 @@ package ca.uhn.fhir.parser; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.emptyOrNullString; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.stringContainsInOrder; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import java.io.StringReader; import java.util.ArrayList; @@ -29,12 +38,15 @@ import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.ContainedDt; import ca.uhn.fhir.model.dstu2.composite.DurationDt; +import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt; +import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt.Binding; import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance; import ca.uhn.fhir.model.dstu2.resource.Binary; import ca.uhn.fhir.model.dstu2.resource.Composition; +import ca.uhn.fhir.model.dstu2.resource.DataElement; import ca.uhn.fhir.model.dstu2.resource.Encounter; import ca.uhn.fhir.model.dstu2.resource.Medication; import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription; @@ -60,6 +72,282 @@ public class XmlParserDstu2Test { XMLUnit.setIgnoreWhitespace(true); } + @Test + public void testContainedResourceInExtensionUndeclared() { + Patient p = new Patient(); + p.addName().addFamily("PATIENT"); + + Organization o = new Organization(); + o.setName("ORG"); + p.addUndeclaredExtension(new ExtensionDt(false, "urn:foo", new ResourceReferenceDt(o))); + + String str = ourCtx.newXmlParser().encodeResourceToString(p); + ourLog.info(str); + + p = ourCtx.newXmlParser().parseResource(Patient.class, str); + assertEquals("PATIENT", p.getName().get(0).getFamily().get(0).getValue()); + + List exts = p.getUndeclaredExtensionsByUrl("urn:foo"); + assertEquals(1, exts.size()); + ResourceReferenceDt rr = (ResourceReferenceDt)exts.get(0).getValue(); + o = (Organization) rr.getResource(); + assertEquals("ORG", o.getName()); + } + + @Test + public void testEncodeAndParseExtensionOnResourceReference() { + DataElement de = new DataElement(); + Binding b = de.addElement().getBinding(); + b.setName("BINDING"); + + Organization o = new Organization(); + o.setName("ORG"); + b.addUndeclaredExtension(new ExtensionDt(false, "urn:foo", new ResourceReferenceDt(o))); + + String str = ourCtx.newXmlParser().encodeResourceToString(de); + ourLog.info(str); + + de = ourCtx.newXmlParser().parseResource(DataElement.class, str); + b = de.getElement().get(0).getBinding(); + assertEquals("BINDING", b.getName()); + + List exts = b.getUndeclaredExtensionsByUrl("urn:foo"); + assertEquals(1, exts.size()); + ResourceReferenceDt rr = (ResourceReferenceDt)exts.get(0).getValue(); + o = (Organization) rr.getResource(); + assertEquals("ORG", o.getName()); + + } + + @Test + public void testParseAndEncodeExtensionOnResourceReference() { + //@formatter:off + String input = "" + + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + //@formatter:on + DataElement de = ourCtx.newXmlParser().parseResource(DataElement.class, input); + String output = ourCtx.newXmlParser().encodeResourceToString(de).replace(" xmlns=\"http://hl7.org/fhir\"", ""); + + ElementDefinitionDt elem = de.getElement().get(0); + Binding b = elem.getBinding(); + assertEquals("Gender", b.getName()); + + ResourceReferenceDt ref = (ResourceReferenceDt) b.getValueSet(); + assertEquals("#2179414", ref.getReference().getValue()); + + assertEquals(2, ref.getUndeclaredExtensions().size()); + ExtensionDt ext = ref.getUndeclaredExtensions().get(0); + assertEquals("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset", ext.getUrl()); + assertEquals(ResourceReferenceDt.class, ext.getValue().getClass()); + assertEquals("#2179414-permitted", ((ResourceReferenceDt)ext.getValue()).getReference().getValue()); + + ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(de)); + + assertThat(output, containsString("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset")); + + ourLog.info("Expected: {}", input); + ourLog.info("Actual : {}", output); + assertEquals(input, output); + } + @Test public void testEncodeBinaryWithNoContentType() { Binary b = new Binary(); @@ -71,6 +359,60 @@ public class XmlParserDstu2Test { assertEquals("", output); } + @Test + public void testMoreExtensions() throws Exception { + + Patient patient = new Patient(); + patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:example").setValue("7000135"); + + ExtensionDt ext = new ExtensionDt(); + ext.setUrl("http://example.com/extensions#someext"); + ext.setValue(new DateTimeDt("2011-01-02T11:13:15")); + + // Add the extension to the resource + patient.addUndeclaredExtension(ext); + // END SNIPPET: resourceExtension + + // START SNIPPET: resourceStringExtension + HumanNameDt name = patient.addName(); + name.addFamily("Shmoe"); + StringDt given = name.addGiven(); + given.setValue("Joe"); + ExtensionDt ext2 = new ExtensionDt().setUrl("http://examples.com#givenext").setValue(new StringDt("given")); + given.addUndeclaredExtension(ext2); + + StringDt given2 = name.addGiven(); + given2.setValue("Shmoe"); + ExtensionDt given2ext = new ExtensionDt().setUrl("http://examples.com#givenext_parent"); + given2.addUndeclaredExtension(given2ext); + ExtensionDt givenExtChild = new ExtensionDt(); + givenExtChild.setUrl("http://examples.com#givenext_child").setValue(new StringDt("CHILD")); + given2ext.addUndeclaredExtension(givenExtChild); + // END SNIPPET: resourceStringExtension + + // START SNIPPET: subExtension + ExtensionDt parent = new ExtensionDt().setUrl("http://example.com#parent"); + patient.addUndeclaredExtension(parent); + + ExtensionDt child1 = new ExtensionDt().setUrl("http://example.com#child").setValue(new StringDt("value1")); + parent.addUndeclaredExtension(child1); + + ExtensionDt child2 = new ExtensionDt().setUrl("http://example.com#child").setValue(new StringDt("value1")); + parent.addUndeclaredExtension(child2); + // END SNIPPET: subExtension + + String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); + ourLog.info(output); + + String enc = ourCtx.newXmlParser().encodeResourceToString(patient); + assertThat(enc, containsString("")); + assertThat( + enc, + containsString("")); + assertThat(enc, containsString("")); + assertThat(enc, containsString("")); + } + @Test public void testEncodeNonContained() { diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java index 0a606efabb0..9d7384cec39 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java @@ -19,6 +19,7 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hamcrest.Matchers; +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -64,7 +65,7 @@ public class BundleTypeTest { p1.addIdentifier().setSystem("urn:system").setValue("value"); IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); - client.transaction().withResources(Arrays.asList((IResource) p1)).execute(); + client.transaction().withResources(Arrays.asList((IBaseResource) p1)).execute(); HttpUriRequest value = capt.getValue(); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestDstu2.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestDstu2.java index c761c51392b..f420d038793 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestDstu2.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestDstu2.java @@ -54,7 +54,7 @@ public class ClientServerValidationTestDstu2 { @Test public void testServerReturnsAppropriateVersionForDstu2_040() throws Exception { Conformance conf = new Conformance(); - conf.setFhirVersion("0.4.0"); + conf.setFhirVersion("0.5.0"); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientTestDstu2.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java similarity index 99% rename from hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientTestDstu2.java rename to hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java index a8816228240..94f51f5d11c 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientTestDstu2.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java @@ -23,6 +23,7 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -34,6 +35,7 @@ import org.mockito.stubbing.Answer; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.dstu2.resource.Parameters; import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.primitive.IdDt; @@ -42,7 +44,7 @@ import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.EncodingEnum; -public class GenericClientTestDstu2 { +public class GenericClientDstu2Test { private static FhirContext ourCtx; private HttpClient myHttpClient; private HttpResponse myHttpResponse; @@ -78,7 +80,7 @@ public class GenericClientTestDstu2 { Bundle response = client.search() .forResource(Patient.class) .encodedJson() - .revinclude(ca.uhn.fhir.model.dstu2.resource.Provenance.INCLUDE_TARGET) + .revInclude(new Include("Provenance:target")) .execute(); //@formatter:on @@ -577,7 +579,7 @@ public class GenericClientTestDstu2 { IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - List input = new ArrayList(); + List input = new ArrayList(); Patient p1 = new Patient(); // No ID p1.addName().addFamily("PATIENT1"); @@ -589,7 +591,7 @@ public class GenericClientTestDstu2 { input.add(p2); //@formatter:off - List response = client.transaction() + List response = client.transaction() .withResources(input) .encodedJson() .execute(); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerTest.java index 4fbd7817784..a72934fc5d8 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerTest.java @@ -1,7 +1,10 @@ package ca.uhn.fhir.rest.server; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; import java.util.ArrayList; import java.util.List; @@ -20,6 +23,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -356,7 +360,7 @@ public class OperationServerTest { public IBundleProvider opInstanceReturnsBundleProvider() { ourLastMethod = "$OP_INSTANCE_BUNDLE_PROVIDER"; - List resources = new ArrayList(); + List resources = new ArrayList(); for (int i =0; i < 100;i++) { Patient p = new Patient(); p.setId("Patient/" + i); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java index 19f662d8245..1bdebb08164 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactoryTest.java @@ -1,23 +1,33 @@ package ca.uhn.fhir.rest.server.provider.dstu2; -import ca.uhn.fhir.rest.server.BundleInclusionRule; -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.*; -import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; -import ca.uhn.fhir.model.dstu2.resource.*; -import ca.uhn.fhir.model.dstu2.resource.Bundle; +import static org.junit.Assert.assertEquals; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.hl7.fhir.instance.model.IBaseResource; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import java.util.*; - -import static org.junit.Assert.assertEquals; +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.Include; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu2.resource.Bundle; +import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; +import ca.uhn.fhir.model.dstu2.resource.Observation; +import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.model.dstu2.resource.Practitioner; +import ca.uhn.fhir.model.dstu2.resource.Specimen; +import ca.uhn.fhir.rest.server.BundleInclusionRule; public class Dstu2BundleFactoryTest { private static FhirContext ourCtx; - private List myResourceList; + private List myResourceList; private Dstu2BundleFactory myBundleFactory; @BeforeClass @@ -68,7 +78,7 @@ public class Dstu2BundleFactoryTest { specimen1.setSubject(new ResourceReferenceDt(patient)); specimen1.getCollection().setCollector(new ResourceReferenceDt(practitioner)); - myResourceList = Arrays.asList(new IResource[]{diagnosticReport}); + myResourceList = Arrays.asList(new IBaseResource[]{diagnosticReport}); myBundleFactory = new Dstu2BundleFactory(ourCtx); } diff --git a/hapi-fhir-structures-dstu2/src/test/resources/diagnosticreport-examples-lab-text(72ac8493-52ac-41bd-8d5d-7258c289b5ea).xml b/hapi-fhir-structures-dstu2/src/test/resources/diagnosticreport-examples-lab-text(72ac8493-52ac-41bd-8d5d-7258c289b5ea).xml new file mode 100644 index 00000000000..6792efa86ed --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/test/resources/diagnosticreport-examples-lab-text(72ac8493-52ac-41bd-8d5d-7258c289b5ea).xml @@ -0,0 +1,20914 @@ + + + + + + + + + + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z168748  Z968634  Z986932
+      Date:  10/12/02 05/04/12 05/04/12
+      Time:     16:00    11:15    23:30                   Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1        *        *                          0.8-1.3
+APTT               26        *        *                    secs  23-36
+Fibrinogen        8.1H       *        *                    g/L   2.0-5.0
+
+12Z968932 05/04/12 23:30
+Comment: Please note specimen clotted. Ward notified.
+
+12Z968634 05/04/12 11:15
+Comment: * Specimen clotted.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z916580  Z661921  Z766455  Z986634  Z968932
+  Date:  09/10/06 26/03/07 28/09/07 05/04/12 05/04/12
+  Time:     09:25    10:10    08:45    11:15    23:30  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            130      119      121      136      129  g/L       115-150
+WCC           6.1      5.5      6.0      8.9      8.6  x10^9/L   4.0-11.0
+PLT           263      237      264        *      213  x10^9/L   140-400
+RCC          4.92     4.41     4.58     4.63     4.42  x10^12/L  3.80-5.10
+PCV          0.39     0.35     0.36     0.39     0.38  L/L       0.35-0.45
+MCV          79.3L    79.7L    79.3L    84.6     86.0  fL        80.0-96.0
+MCH          26.5L    26.8L    26.3L    29.3     29.3  pg        27.0-33.0
+MCHC          334      337      332      346      341  g/L       320-360
+RDW          15.1H    15.5H    15.2H    13.7     14.0  %         11.0-15.0
+White Cell Differential
+Neut         3.8      2.9      3.4      6.7      6.2   x10^9/L   2.0-8.0
+Lymph        1.6      2.0      2.0      1.5      1.5   x10^9/L   1.2-4.0
+Mono         0.4      0.5      0.5      0.6      0.8   x10^9/L   0.1-1.0
+Eos          0.2      0.0      0.1      0.0      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.1   x10^9/L   0.0-0.1
+
+07Z661921 26/03/07 10:10
+Film Comment : Film scanned.
+
+12Z986634 05/04/12 11:15
+Film Comment : Platelets are clumped, but appear adequate in number. Red
+               cells are mainly normocytic normochromic with mild
+               rouleaux. White cells appear normal.
+Comment: *PLEASE NOTE AMENDED REPORT*
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516369
+      Date: 05/04/12                                              Arterial
+      Time:    23:55                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.38                                              7.35-7.45
+pCO2              55H                                     mmHg    35-45
+Base Excess      7.1H                                     mmol/L  -3.0/3.0
+pO2               30L                                     mmHg    75-100
+O2 Sat            41L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.3                                      mmol/L  3.5-5.5
+Sodium           141                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       145                                      g/L     130-170
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Anti-Factor Xa Assay (Plasma)
+Heparin Level by Anti-Xa          0.03   U/mL
+
+Anti-Factor Xa Comment:
+   Reference range for Anti-Xa level depends upon route, time, dose and
+   reason for anticoagulation.
+   Therapeutic anticoagulation with LMWH (such as Enoxaparin) generally does
+   not require routine monitoring. However, anti-Xa levels are recommended
+   for patients on LMWH requiring dose adjustment in settings of (1) renal
+   impairment, (2) obesity and (3) pregnancy.  To assist interpretation of
+   therapeutic ranges, anti-Xa levels should be collected four hours after
+   the third dose.  For less common indications such a patients at high risk
+   of bleeding, and interpretation of results, please contact the on-call
+   laboratory Haematology registrar or Haematologist via ACME switchboard.
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968427  Z968448  Z986671  Z968774  Z968942
+      Date:  05/04/12 05/04/12 05/04/12 05/04/12 05/04/12
+      Time:     03:30    05:10    09:10    17:02    23:40 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.7H     1.7H                                  0.8-1.3
+APTT               31       31       27       31       35  secs  23-36
+Fibrinogen        1.9L     1.8L                            g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z466872  Z864523  Z560485  Z896274  Z968972
+      Date:  08/01/09 08/01/09 17/02/09 19/02/09 05/04/12
+      Time:     08:10    09:34    15:30    06:00    23:10 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR                 *      1.0      0.8      0.9      1.0        0.8-1.3
+APTT                *       23L      25       25       24  secs  23-36
+Fibrinogen          *      3.5      2.9      3.3      5.3H g/L   2.0-5.0
+
+09Z466872 08/01/09 08:10
+Comment: * Note: unsuitable specimen - tube underfilled.   Please
+         fill coag. tubes to the blue line.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride          108     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine         62     umol/L ( 64-104   )
+ (Creatinine)    0.062    mmol/L ( 0.05-0.11)
+Urea              6.3     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Calcium          2.40     mmol/L ( 2.10-2.60)
+Phosphate        1.74     mmol/L ( 0.8-1.5  )
+Magnesium        0.87     mmol/L ( 0.7-1.1  )
+Albumin            32     g/L    ( 35-50    )
+Troponin I       24.15    ug/L   (See Below )
+CK                828     IU/L   ( <175     )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + +
+
+THYROID FUNCTION
+Free T4                   75.1    H  pmol/L  ( 9.0-26.0 )
+Free T3                   14.9    H  pmol/L  ( 3.5-6.5  )
+TSH                       0.01    L  mIU/L   ( 0.1-4.0  )
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z466872  Z560485  Z869274  Z676769  Z968972
+  Date:  08/01/09 17/02/09 19/02/09 24/01/12 05/04/12
+  Time:     08:10    15:30    06:00    15:50    23:10  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            159      143      144      149      132  g/L       130-170
+WCC           7.3      6.5      7.1      7.6      6.9  x10^9/L   4.0-11.0
+PLT           231      241      220      225      227  x10^9/L   140-400
+RCC          4.96     4.54     4.54     4.68     4.17L x10^12/L  4.50-5.70
+PCV          0.46     0.42     0.42     0.43     0.38L L/L       0.40-0.50
+MCV          92.9     92.7     92.3     92.4     91.7  fL        80.0-96.0
+MCH          32.1     31.5     31.6     31.8     31.8  pg        27.0-33.0
+MCHC          345      340      343      344      346  g/L       320-360
+RDW          12.8     13.3     13.7     13.3     12.4  %         11.0-15.0
+White Cell Differential
+Neut         4.6      3.3      4.5      4.0      3.7   x10^9/L   2.0-8.0
+Lymph        1.9      2.4      1.8      2.7      2.1   x10^9/L   1.2-4.0
+Mono         0.5      0.5      0.6      0.6      0.8   x10^9/L   0.1-1.0
+Eos          0.2      0.3      0.2      0.2      0.3   x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.6     mmol/L ( 3.5-5.5  )
+Chloride          109     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine         66     umol/L ( 49-90    )
+ (Creatinine)    0.066    mmol/L ( 0.05-0.09)
+Urea              4.0     mmol/L ( 2.5-8.3  )
+ eGFR             76             ( SEE-BELOW)
+C-React Prot      152     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986922
+  Date:  05/04/12
+  Time:     23:30                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            123                                      g/L       115-150
+WCC           9.7                                      x10^9/L   4.0-11.0
+PLT           217                                      x10^9/L   140-400
+RCC          3.93                                      x10^12/L  3.80-5.10
+PCV          0.36                                      L/L       0.35-0.45
+MCV          91.1                                      fL        80.0-96.0
+MCH          31.3                                      pg        27.0-33.0
+MCHC          344                                      g/L       320-360
+RDW          13.2                                      %         11.0-15.0
+White Cell Differential
+Neut         7.2                                       x10^9/L   2.0-8.0
+Lymph        1.9                                       x10^9/L   1.2-4.0
+Mono         0.6                                       x10^9/L   0.1-1.0
+Eos          0.0                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         3.8     mmol/L ( 3.5-5.5  )
+Chloride          108     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine        117     umol/L ( 64-104   )
+ (Creatinine)    0.117    mmol/L ( 0.05-0.11)
+Urea             10.0     mmol/L ( 2.5-8.3  )
+ eGFR             53             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968331  Z968584  Z986666  Z968991
+  Date:  04/04/12 05/04/12 05/04/12 05/04/12
+  Time:     19:45    04:35    12:05    22:40           Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             76L      81L      86L      80L          g/L       130-170
+WCC          10.6      9.0     11.1H     8.1           x10^9/L   4.0-11.0
+PLT           177      155      141      207           x10^9/L   140-400
+RCC          2.24L    2.39L    2.51L    2.37L          x10^12/L  4.50-5.70
+PCV          0.22L    0.23L    0.24L    0.23L          L/L       0.40-0.50
+MCV          98.6H    96.4H    96.9H    96.3H          fL        80.0-96.0
+MCH          33.7H    34.0H    34.1H    33.9H          pg        27.0-33.0
+MCHC          342      352      352      352           g/L       320-360
+RDW          15.8H    16.3H    16.8H    17.5H          %         11.0-15.0
+White Cell Differential
+Neut         7.8      6.8      9.8H     6.3            x10^9/L   2.0-8.0
+Lymph        1.1L     1.1L     0.7L     0.9L           x10^9/L   1.2-4.0
+Mono         0.6      0.8      0.7      0.7            x10^9/L   0.1-1.0
+Eos          0.1      0.2      0.0      0.2            x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0            x10^9/L   0.0-0.1
+Bands        0.8H                                      x10^9/L   0.0-0.5
+Meta         0.1H                                      x10^9/L   0.0
+NRBC            1H                                     /100WBCs  0
+NRBC Abs     0.1H                                      x10^9/L   0
+
+12Z968331 04/04/12 19:45
+Film Comment : Red cells show moderate polychromasia with occasional
+               nucleated red cells.
+               Mild neutrophilia with moderate left shift and toxic
+               changes. Manual differential.
+               Platelets appear normal.
+Conclusion: In keeping with stated history of acute blood loss.
+            Infection / inflammation cannot be excluded. Suggest
+            clinical correlation and follow up FBE.
+Comment: Film reviewed by Dr Radio Xray - Haematology
+         Registrar
+
+12Z986584 05/04/12 04:35
+Comment: Please note rise in haemoglobin since the last
+         examination. ? Consistent with post blood transfusion.
+
+12Z968666 05/04/12 12:05
+Film Comment : Mild neutrophilia with mild toxic changes. Manual
+               differential. Red cells are mildly macrocytic with some
+               target cells and polychromatic cells. Platelets appear
+               normal.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z362693  Z763647  Z886473  Z461534  Z968912
+      Date:  08/02/12 15/02/12 15/02/12 29/02/12 05/04/12
+      Time:     20:20    14:15    16:37    12:20    19:50 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.3        *      1.2      1.2        *        0.8-1.3
+APTT               28        *       26       27        *  secs  23-36
+Fibrinogen        6.5H       *      4.6      6.3H       *  g/L   2.0-5.0
+
+12Z986912 05/04/12 19:50
+Comment: Please note specimen clotted. Ward notified.
+
+12Z763647 15/02/12 14:15
+Comment: * Specimen clotted. Suggest repeat. Ward notified.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         6.1     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               20     mmol/L ( 22-30    )
+Creatinine        193     umol/L ( 49-90    )
+ (Creatinine)    0.193    mmol/L ( 0.05-0.09)
+Urea             19.8     mmol/L ( 2.5-8.3  )
+ eGFR             22             ( SEE-BELOW)
+
+Comment: The Potassium result has been checked.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z963032  Z346840  Z963807  Z963931  Z986912
+  Date:  26/03/12 02/04/12 03/04/12 05/04/12 05/04/12
+  Time:     09:15    10:10    09:15    08:10    19:50  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             82L      80L      80L      92L      80L g/L       115-150
+WCC          10.1     12.1H    10.5     13.0H     8.1  x10^9/L   4.0-11.0
+PLT           553H     554H     596H     683H     578H x10^9/L   140-400
+RCC          3.13L    3.11L    3.11L    3.57L    3.17L x10^12/L  3.80-5.10
+PCV          0.24L    0.24L    0.24L    0.27L    0.24L L/L       0.35-0.45
+MCV          76.9L    76.7L    76.3L    76.0L    76.3L fL        80.0-96.0
+MCH          26.3L    25.8L    25.6L    25.8L    25.2L pg        27.0-33.0
+MCHC          343      336      336      340      331  g/L       320-360
+RDW          16.0H    16.3H    15.8H    16.4H    16.4H %         11.0-15.0
+White Cell Differential
+Neut         7.4      9.5H     8.3H    10.7H     6.3   x10^9/L   2.0-8.0
+Lymph        1.5      1.5      1.2      1.5      1.3   x10^9/L   1.2-4.0
+Mono         0.6      0.6      0.4      0.5      0.4   x10^9/L   0.1-1.0
+Eos          0.5      0.5      0.6H     0.1      0.1   x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.1      0.1      0.1   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561960  Z561162  Z516464  Z561266  Z561269
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    14:05    14:50    17:35    20:21    23:31  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH                 *     7.38     7.36     7.39     7.41          7.35-7.45
+pCO2              37       38       35       37       36  mmHg    35-45
+HCO3(Std)                  23       20L      22       23  mmol/L  22.0-30.0
+Base Excess              -2.1     -5.0L    -2.5     -1.8  mmol/L  -3.0/3.0
+pO2              113H     203H      89      102H      99  mmHg    75-100
+O2 Sat            99      100       97       98       98  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.0      4.3      4.1      4.1      4.1  mmol/L  3.5-5.5
+Sodium           139      138      139      138      140  mmol/L  135-145
+Chloride         108      109      109      109      109  mmol/L  95-110
+iCa++           1.10L    1.09L    1.09L    1.11L    1.14  mmol/L  1.12-1.30
+Glucose          8.3H     7.4      8.7H     8.1H     6.1  mmol/L  3.6-7.7
+Lactate          1.2      1.5      1.6      1.2      1.1  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        89L      90L      86L      87L      87L g/L     130-170
+Reduced Hb       1.4      0.4      3.0      1.9      1.8  %       0-5
+CarbOxy Hb       1.8H     1.5      1.7H     1.6H     1.7H %       0.5-1.5
+Meth    Hb       1.7H     1.1      1.5      1.1      1.4  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         4.8     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine        153     umol/L ( 64-104   )
+ (Creatinine)    0.153    mmol/L ( 0.05-0.11)
+Urea             10.0     mmol/L ( 2.5-8.3  )
+ eGFR             40             ( SEE-BELOW)
+Troponin I       <0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z568494  Z068305  R099045  Z826677  Z968941
+  Date:  02/07/10 14/09/10 02/02/11 07/02/12 05/04/12
+  Time:     15:25    08:50    09:00    10:54    23:21  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            127L     126L     123L     123L     110L g/L       130-170
+WCC                    5.7      5.1      8.9      5.3  x10^9/L   4.0-11.0
+PLT                    141      140      189      132L x10^9/L   140-400
+RCC                   3.74L    3.57L    3.79L    3.42L x10^12/L  4.50-5.70
+PCV                   0.36L    0.35L    0.36L    0.32L L/L       0.40-0.50
+MCV                   95.8     97.7H    93.7     92.5  fL        80.0-96.0
+MCH                   33.8H    34.3H    32.3     32.3  pg        27.0-33.0
+MCHC                   353      351      345      349  g/L       320-360
+RDW                   13.9     13.5     14.8     14.9  %         11.0-15.0
+White Cell Differential
+Neut                  3.5      3.1      5.4      3.5   x10^9/L   2.0-8.0
+Lymph                 1.8      1.5      2.4      1.3   x10^9/L   1.2-4.0
+Mono                  0.3      0.3      0.8      0.4   x10^9/L   0.1-1.0
+Eos                   0.2      0.1      0.3      0.1   x10^9/L   0.0-0.5
+Baso                  0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.0     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         78     umol/L ( 64-104   )
+ (Creatinine)    0.078    mmol/L ( 0.05-0.11)
+Urea              5.4     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Troponin I       <0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968951
+  Date:  05/04/12
+  Time:     23:00                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            133                                      g/L       130-170
+WCC           7.0                                      x10^9/L   4.0-11.0
+PLT           248                                      x10^9/L   140-400
+RCC          4.44L                                     x10^12/L  4.50-5.70
+PCV          0.39L                                     L/L       0.40-0.50
+MCV          87.4                                      fL        80.0-96.0
+MCH          30.0                                      pg        27.0-33.0
+MCHC          343                                      g/L       320-360
+RDW          12.7                                      %         11.0-15.0
+White Cell Differential
+Neut         4.0                                       x10^9/L   2.0-8.0
+Lymph        2.2                                       x10^9/L   1.2-4.0
+Mono         0.6                                       x10^9/L   0.1-1.0
+Eos          0.2                                       x10^9/L   0.0-0.5
+Baso         0.1                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z964154  Z946710  Z965564  Z265492  Z986961
+      Date:  04/03/12 05/03/12 19/03/12 20/03/12 05/04/12
+      Time:     22:57    21:40    10:10    09:55    23:00 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.4H     1.3      1.2      1.2      1.3        0.8-1.3
+APTT               30                29       29           secs  23-36
+Fibrinogen        1.9L              2.2      2.0           g/L   2.0-5.0
+
+12Z964154 04/03/12 22:57
+Comment: Please note mild hypofibrinogenaemia persists.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         4.4     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         62     umol/L ( 49-90    )
+ (Creatinine)    0.062    mmol/L ( 0.05-0.09)
+Urea             11.7     mmol/L ( 2.5-8.3  )
+ eGFR             78             ( SEE-BELOW)
+Albumin            22     g/L    ( 35-50    )
+AP                 71     IU/L   ( 30-120   )
+GGT                41     IU/L   ( 10-65    )
+ALT                76     IU/L   ( <34      )
+AST               134     IU/L   ( <31      )
+Bili Total         17     umol/L ( <19      )
+Protein Total      63     g/L    ( 65-85    )
+Troponin I        0.03    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         4.4     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         62     umol/L ( 49-90    )
+ (Creatinine)    0.062    mmol/L ( 0.05-0.09)
+Urea             11.7     mmol/L ( 2.5-8.3  )
+ eGFR             78             ( SEE-BELOW)
+Albumin            22     g/L    ( 35-50    )
+AP                 71     IU/L   ( 30-120   )
+GGT                41     IU/L   ( 10-65    )
+ALT                76     IU/L   ( <34      )
+AST               134     IU/L   ( <31      )
+Bili Total         17     umol/L ( <19      )
+Protein Total      63     g/L    ( 65-85    )
+Troponin I        0.03    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z268321  Z386901  Z965931  Z965863  Z986961
+  Date:  23/03/12 24/03/12 25/03/12 26/03/12 05/04/12
+  Time:     10:35    11:10    09:35    10:50    23:00  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            127      124      120      110L     101L g/L       115-150
+WCC           4.9      4.7      4.2      3.7L     5.9  x10^9/L   4.0-11.0
+PLT            98L      93L      85L      77L      96L x10^9/L   140-400
+RCC          3.81     3.73L    3.62L    3.37L    2.93L x10^12/L  3.80-5.10
+PCV          0.37     0.36     0.35     0.33L    0.29L L/L       0.35-0.45
+MCV          96.7H    96.7H    96.8H    97.1H    98.0H fL        80.0-96.0
+MCH          33.3H    33.2H    33.3H    32.8     34.4H pg        27.0-33.0
+MCHC          345      343      344      338      351  g/L       320-360
+RDW          20.1H    21.2H    20.4H    20.4H    21.7H %         11.0-15.0
+White Cell Differential
+Neut         3.4      2.7      2.6      2.3      3.8   x10^9/L   2.0-8.0
+Lymph        0.9L     1.3      1.0L     0.8L     1.4   x10^9/L   1.2-4.0
+Mono         0.4      0.5      0.4      0.4      0.6   x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.1      0.1      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.1      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+12Z268321 23/03/12 10:35
+Comment: Please note moderate thrombocytopenia persists. Instrument
+         differential and parameters reported.
+
+12Z368901 24/03/12 11:10
+Comment: Instrument differential and parameters reported.
+
+12Z956931 25/03/12 09:35
+Comment: Note persistent thrombocytopenia. Instrument differential
+         and parameters reported.
+
+12Z965863 26/03/12 10:50
+Film Comment : Mild anaemia. Red cells show moderate anisocytosis with
+               some macrocytes, occasional target cells and mild
+               rouleaux. White cells are unremarkable. Moderate
+               thrombocytopenia.
+Comment: Please note moderate thrombocytopenia persists. Please
+         note: no clinical details given.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            134     mmol/L ( 135-145  )
+Potassium         3.4     mmol/L ( 3.5-5.5  )
+Chloride           97     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         45     umol/L ( 49-90    )
+ (Creatinine)    0.045    mmol/L ( 0.05-0.09)
+Urea              3.4     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            31     g/L    ( 35-50    )
+AP                 88     IU/L   ( 30-120   )
+GGT                51     IU/L   ( 10-65    )
+ALT                39     IU/L   ( <34      )
+AST                24     IU/L   ( <31      )
+Bili Total         <5     umol/L ( <19      )
+Protein Total      65     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z167613  Z167802  Z886375  Z868929  Z968971
+  Date:  01/04/12 02/04/12 03/04/12 04/04/12 05/04/12
+  Time:     20:15    06:20    04:50    05:30    23:23  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            104L     111L     113L     105L     114L g/L       115-150
+WCC           4.4      4.0      3.9L     4.7     10.3  x10^9/L   4.0-11.0
+PLT           163      183      236      250      310  x10^9/L   140-400
+RCC          3.76L    3.98     4.09     3.73L    4.05  x10^12/L  3.80-5.10
+PCV          0.31L    0.32L    0.34L    0.30L    0.33L L/L       0.35-0.45
+MCV          81.3     80.2     81.9     80.9     80.9  fL        80.0-96.0
+MCH          27.8     28.0     27.7     28.3     28.1  pg        27.0-33.0
+MCHC          342      349      338      350      348  g/L       320-360
+RDW          14.7     15.1H    14.9     14.9     14.8  %         11.0-15.0
+White Cell Differential
+Neut         3.0      2.1      1.6L     1.9L     7.6   x10^9/L   2.0-8.0
+Lymph        0.7L     1.2      1.7      1.8      0.9L  x10^9/L   1.2-4.0
+Mono         0.7      0.7      0.5      0.5      0.8   x10^9/L   0.1-1.0
+Eos          0.0      0.1      0.1      0.3      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+Bands                          0.0      0.1      0.9H  x10^9/L   0.0-0.5
+
+12Z176613 01/04/12 20:15
+Comment: Note: fall in haemoglobin.
+
+12Z868375 03/04/12 04:50
+Film Comment : White cells show mild neutropenia. Manual differential.
+               Red cells are mainly normocytic normochromic with
+               occasional elongated cells and target cells.
+               Platelets appear normal.
+Conclusion: ? Cause of decreasing neutrophil count, ? therapy-related.
+
+12Z868929 04/04/12 05:30
+Film Comment : White cells show mild neutropenia, the neutrophils present
+               show mild toxic changes. Manual differential.
+               Red cells appear essentially normal.
+               Platelets appear normal.
+
+12Z986971 05/04/12 23:23
+Film Comment : Mild neutrophilia with mild left shift, moderate toxic
+               granulation and vacuolation and occasional Doehle bodies.
+               Occasional reactive lymphocytes. Manual differential.
+Conclusion: Suggestive of infection.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+  Request No:  Z563831  Z986981
+        Date: 02/07/11 05/04/12                                   Therapeut
+        Time:    16:00    23:25                            Units    Range
+              -------- -------- -------- -------- -------- ------ ---------
+PLASMA
+Carbamazepine                <2L                           umol/L 20-50
+Hrs Since Dose          No Info                            HH:MM
+Phenytoin                    <2L                           umol/L 40-80
+Hrs Since Dose          No Info                            HH:MM
+Valproate          283L      57L                           umol/L 350-700
+Hrs Since Dose No Info  No Info                            HH:MM
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            139     mmol/L ( 135-145  )
+Potassium         3.5     mmol/L ( 3.5-5.5  )
+Chloride           91     mmol/L ( 95-110   )
+HCO3               28     mmol/L ( 22-30    )
+Creatinine         82     umol/L ( 64-104   )
+ (Creatinine)    0.082    mmol/L ( 0.05-0.11)
+Urea              3.8     mmol/L ( 2.5-8.3  )
+ eGFR             90             ( SEE-BELOW)
+Albumin            37     g/L    ( 35-50    )
+AP                 62     IU/L   ( 30-120   )
+GGT               117     IU/L   ( 10-65    )
+ALT                31     IU/L   ( <45      )
+AST                71     IU/L   ( <35      )
+Bili Total         10     umol/L ( <19      )
+Protein Total      78     g/L    ( 65-85    )
+Lipase             87     IU/L   ( <60      )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z563540  Z536831  Z468013  Z968981
+  Date:  02/07/11 02/07/11 03/07/11 05/04/12
+  Time:     02:00    16:00    04:20    23:25           Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            125L     113L     125L     148           g/L       130-170
+WCC           7.0      3.9L     7.1      6.2           x10^9/L   4.0-11.0
+PLT           292      268      267      246           x10^9/L   140-400
+RCC          3.40L    3.11L    3.36L    4.17L          x10^12/L  4.50-5.70
+PCV          0.36L    0.33L    0.36L    0.43           L/L       0.40-0.50
+MCV         106.5H   105.3H   106.5H   103.0H          fL        80.0-96.0
+MCH          36.7H    36.4H    37.2H    35.5H          pg        27.0-33.0
+MCHC          345      346      349      345           g/L       320-360
+RDW          16.5H    15.7H    15.2H    14.1           %         11.0-15.0
+White Cell Differential
+Neut         4.1      2.9      5.2      2.7            x10^9/L   2.0-8.0
+Lymph        2.1      0.5L     1.0L     3.0            x10^9/L   1.2-4.0
+Mono         0.5      0.4      0.7      0.4            x10^9/L   0.1-1.0
+Eos          0.1      0.0      0.1      0.0            x10^9/L   0.0-0.5
+Baso         0.0      0.1      0.1      0.0            x10^9/L   0.0-0.1
+
+11Z536540 02/07/11 02:00
+Film Comment : Red cells are macrocytic with some target cells and
+               stomatocytes.
+               White cells are unremarkable.
+               Platelets are plentiful.
+Conclusion: Common causes of macrocytosis include liver disease,
+            B12/folate deficiency, hypothyroidism, alcohol, smoking,
+            and certain drugs including chemotherapy. Suggest liver
+            function tests, serum B12/folate levels, and review drug
+            history if cause not already known.
+
+11Z563831 02/07/11 16:00
+Comment: Instrument differential and parameters reported.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z986931
+      Date:  05/04/12
+      Time:     23:00                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.2                                            0.8-1.3
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            132     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          101     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine        156     umol/L ( 64-104   )
+ (Creatinine)    0.156    mmol/L ( 0.05-0.11)
+Urea             19.5     mmol/L ( 2.5-8.3  )
+ eGFR             43             ( SEE-BELOW)
+Calcium          1.97     mmol/L ( 2.10-2.60)
+Phosphate        0.94     mmol/L ( 0.8-1.5  )
+Magnesium        0.58     mmol/L ( 0.7-1.1  )
+Albumin            26     g/L    ( 35-50    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561169
+      Date: 05/04/12                                              Arterial
+      Time:    23:19                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.39                                              7.35-7.45
+pCO2              40                                      mmHg    35-45
+Base Excess     -0.9                                      mmol/L  -3.0/3.0
+pO2               57L                                     mmHg    75-100
+O2 Sat            91L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.1                                      mmol/L  3.5-5.5
+Sodium           128L                                     mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       122L                                     g/L     130-170
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968921
+      Date:  05/04/12
+      Time:     23:00                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               3.0H                                           0.8-1.3
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         4.6     mmol/L ( 3.5-5.5  )
+Chloride          105     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine         73     umol/L ( 64-104   )
+ (Creatinine)    0.073    mmol/L ( 0.05-0.11)
+Urea              8.0     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968921
+  Date:  05/04/12
+  Time:     23:00                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            142                                      g/L       130-170
+WCC           7.2                                      x10^9/L   4.0-11.0
+PLT           184                                      x10^9/L   140-400
+RCC          4.31L                                     x10^12/L  4.50-5.70
+PCV          0.41                                      L/L       0.40-0.50
+MCV          96.0                                      fL        80.0-96.0
+MCH          33.0                                      pg        27.0-33.0
+MCHC          343                                      g/L       320-360
+RDW          15.2H                                     %         11.0-15.0
+White Cell Differential
+Neut         5.0                                       x10^9/L   2.0-8.0
+Lymph        1.3                                       x10^9/L   1.2-4.0
+Mono         0.5                                       x10^9/L   0.1-1.0
+Eos          0.3                                       x10^9/L   0.0-0.5
+Baso         0.1                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561576  Z516361  Z561663  Z561365  Z516069
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    09:27    14:18    17:00    19:04    23:15  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.50H       *     7.51H       *     7.51H         7.35-7.45
+pCO2              36       31L      34L      34L      33L mmHg    35-45
+HCO3(Std)         29                28                28  mmol/L  22.0-30.0
+Base Excess      4.5H              3.7H              3.8H mmol/L  -3.0/3.0
+pO2               90       86       89       86       78  mmHg    75-100
+O2 Sat            98       98       98       97       97  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.2      3.8      4.2      3.8      3.3L mmol/L  3.5-5.5
+Sodium           142      140      141      141      142  mmol/L  135-145
+Chloride         109      107      108      106      109  mmol/L  95-110
+iCa++           1.11L    1.09L    1.09L    1.12     1.07L mmol/L  1.12-1.30
+Glucose          5.9     13.0H    13.4H    12.6H     8.9H mmol/L  3.6-7.7
+Lactate          1.0      1.0      1.5      1.4      1.1  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        94L      92L      88L      88L      87L g/L     130-170
+Reduced Hb       1.8      2.2      2.2      2.6      3.1  %       0-5
+CarbOxy Hb       1.1      1.3      1.3      1.3      1.4  %       0.5-1.5
+Meth    Hb       1.0      1.5      1.2      1.4      1.3  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968901
+      Date:  05/04/12
+      Time:     22:30                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0                                            0.8-1.3
+APTT               29                                      secs  23-36
+Fibrinogen        5.5H                                     g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.6     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine        148     umol/L ( 64-104   )
+ (Creatinine)    0.148    mmol/L ( 0.05-0.11)
+Urea             14.6     mmol/L ( 2.5-8.3  )
+ eGFR             41             ( SEE-BELOW)
+Calcium          2.43     mmol/L ( 2.10-2.60)
+Albumin            32     g/L    ( 35-50    )
+AP                 90     IU/L   ( 30-120   )
+GGT                19     IU/L   ( 10-65    )
+ALT                14     IU/L   ( <45      )
+AST                22     IU/L   ( <35      )
+Bili Total         10     umol/L ( <19      )
+Protein Total      77     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968901
+  Date:  05/04/12
+  Time:     22:30                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            120L                                     g/L       130-170
+WCC           9.3                                      x10^9/L   4.0-11.0
+PLT           220                                      x10^9/L   140-400
+RCC          4.13L                                     x10^12/L  4.50-5.70
+PCV          0.35L                                     L/L       0.40-0.50
+MCV          85.5                                      fL        80.0-96.0
+MCH          29.0                                      pg        27.0-33.0
+MCHC          340                                      g/L       320-360
+RDW          14.4                                      %         11.0-15.0
+White Cell Differential
+Neut         5.6                                       x10^9/L   2.0-8.0
+Lymph        2.8                                       x10^9/L   1.2-4.0
+Mono         0.7                                       x10^9/L   0.1-1.0
+Eos          0.2                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+  Request No:  Z666913  Z076504  Z968911
+        Date: 27/11/11 30/03/12 05/04/12                          Therapeut
+        Time:    11:27    19:15    22:56                   Units    Range
+              -------- -------- -------- -------- -------- ------ ---------
+PLASMA
+Paracetamol        <60      <60      <60                   umol/L AS-BELOW
+Salicylate       <0.30             <0.30                   mmol/L <2.9
+
+* Paracetamol *  The significance of the plasma concentration depends
+                 on the timing of the sample after ingestion.
+                 Hepato-toxicity may be seen with a plasma concentration
+                 of 1000 umol/L at 4 hours after ingestion or 600 umol/L
+                 at 8 hours after ingestion.
+
+* Salicylate *   The significance of the plasma concentration depends
+                 on the timing of the sample after ingestion.
+                 Toxicity may be seen with a plasma concentration
+                 of greater than 3 mmol/L.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         3.5     mmol/L ( 3.5-5.5  )
+Chloride          100     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         76     umol/L ( 49-90    )
+ (Creatinine)    0.076    mmol/L ( 0.05-0.09)
+Urea              6.5     mmol/L ( 2.5-8.3  )
+ eGFR             68             ( SEE-BELOW)
+Calcium          2.33     mmol/L ( 2.10-2.60)
+Phosphate        1.27     mmol/L ( 0.8-1.5  )
+Magnesium        0.78     mmol/L ( 0.8-1.0  )
+Albumin            39     g/L    ( 35-50    )
+AP                 53     IU/L   ( 30-120   )
+GGT                13     IU/L   ( 10-65    )
+ALT                11     IU/L   ( <34      )
+AST                 9     IU/L   ( <31      )
+Bili Total         17     umol/L ( <19      )
+Protein Total      70     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z466067  Z267256  Z076504  Z067795  Z968911
+  Date:  05/12/11 07/12/11 30/03/12 31/03/12 05/04/12
+  Time:     09:25    07:40    19:15    06:00    22:56  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            115      105L     115      110L     105L g/L       115-150
+WCC          10.0      8.0      3.9L     4.5      5.2  x10^9/L   4.0-11.0
+PLT           508H     560H     200      189      208  x10^9/L   140-400
+RCC          3.74L    3.42L    3.73L    3.56L    3.43L x10^12/L  3.80-5.10
+PCV          0.34L    0.30L    0.33L    0.32L    0.30L L/L       0.35-0.45
+MCV          89.9     89.0     89.2     88.8     88.8  fL        80.0-96.0
+MCH          30.7     30.7     30.8     30.9     30.7  pg        27.0-33.0
+MCHC          342      345      345      348      346  g/L       320-360
+RDW          13.6     13.3     12.9     13.0     13.1  %         11.0-15.0
+White Cell Differential
+Neut         4.8      3.5      1.7L     2.0      1.5L  x10^9/L   2.0-8.0
+Lymph        3.4      3.5      1.9      2.1      3.3   x10^9/L   1.2-4.0
+Mono         1.5H     0.8      0.3      0.3      0.4   x10^9/L   0.1-1.0
+Eos          0.3      0.2      0.0      0.0      0.0   x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+11Z276256 07/12/11 07:40
+Comment: Specimen taken more than 12 hours before receipt in lab.
+
+12Z067504 30/03/12 19:15
+Film Comment : Mild neutropenia. Red cells and platelets appear normal.
+Comment: Please note mild neutropenia. ? cause. A repeat FBE may be
+         of value.
+
+12Z067795 31/03/12 06:00
+Comment: Please note fall in haemoglobin.
+
+12Z986911 05/04/12 22:56
+Film Comment : Film scanned.
+Comment: Mild neutropenia.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561762  Z516364  Z561766  Z561868  Z516968
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    15:28    17:29    20:59    23:13    23:13  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.31L    7.38     7.37     7.38     7.38          7.35-7.45
+pCO2              45       36       37       37       37  mmHg    35-45
+HCO3(Std)         21L      22       22       22       22  mmol/L  22.0-30.0
+Base Excess     -3.7L    -3.1L    -3.4L    -2.9     -2.9  mmol/L  -3.0/3.0
+pO2              210H      97      157H     129H     129H mmHg    75-100
+O2 Sat            99       98       99       99       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.6      4.6      4.6      4.4      4.4  mmol/L  3.5-5.5
+Sodium           131L     130L     129L     130L     130L mmol/L  135-145
+Chloride         103      103      102      102      102  mmol/L  95-110
+iCa++           1.12     1.10L    1.12     1.14     1.14  mmol/L  1.12-1.30
+Glucose          9.8H     9.0H     9.4H     9.7H     9.7H mmol/L  3.6-7.7
+Lactate          0.8      0.7      0.7      0.7      0.7  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        90L      87L      81L      84L      84L g/L     115-150
+Reduced Hb       0.6      2.1      0.8      1.0      1.0  %       0-5
+CarbOxy Hb       0.6      0.9      0.8      0.9      0.9  %       0.5-1.5
+Meth    Hb       1.0      1.3      1.2      1.1      1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561061  Z561762  Z516364  Z561766  Z561868
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    14:08    15:28    17:29    20:59    23:13  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.32L    7.31L    7.38     7.37     7.38          7.35-7.45
+pCO2              42       45       36       37       37  mmHg    35-45
+HCO3(Std)         21L      21L      22       22       22  mmol/L  22.0-30.0
+Base Excess     -4.0L    -3.7L    -3.1L    -3.4L    -2.9  mmol/L  -3.0/3.0
+pO2              203H     210H      97      157H     129H mmHg    75-100
+O2 Sat            99       99       98       99       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.4      4.6      4.6      4.6      4.4  mmol/L  3.5-5.5
+Sodium           131L     131L     130L     129L     130L mmol/L  135-145
+Chloride         104      103      103      102      102  mmol/L  95-110
+iCa++           1.10L    1.12     1.10L    1.12     1.14  mmol/L  1.12-1.30
+Glucose         10.5H     9.8H     9.0H     9.4H     9.7H mmol/L  3.6-7.7
+Lactate          1.1      0.8      0.7      0.7      0.7  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        94L      90L      87L      81L      84L g/L     115-150
+Reduced Hb       0.7      0.6      2.1      0.8      1.0  %       0-5
+CarbOxy Hb       0.8      0.6      0.9      0.8      0.9  %       0.5-1.5
+Meth    Hb       1.5      1.0      1.3      1.2      1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516160  Z561262  Z561962  Z516166  Z561768
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    12:51    15:08    16:17    20:08    23:01  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.48H       *        *     7.48H    7.46H         7.35-7.45
+pCO2              36       37       37       34L      39  mmHg    35-45
+HCO3(Std)         27                         27       27  mmol/L  22.0-30.0
+Base Excess      2.8                        2.1      3.3H mmol/L  -3.0/3.0
+pO2               76       76       78       88       89  mmHg    75-100
+O2 Sat            96       96       96       97       97  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.4      3.9      3.9      4.1      5.4  mmol/L  3.5-5.5
+Sodium           142      143      144      141      141  mmol/L  135-145
+Chloride         112H     110      111H     113H     111H mmol/L  95-110
+iCa++           1.09L    1.11L    1.11L    1.07L    1.06L mmol/L  1.12-1.30
+Glucose          9.0H     7.6      6.6      8.9H    11.2H mmol/L  3.6-7.7
+Lactate          2.5H     1.6      1.6      1.9H     1.6  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       122L     125L     127L     128L     132  g/L     130-170
+Reduced Hb       4.1      4.2      3.9      2.7      3.1  %       0-5
+CarbOxy Hb       0.7      0.8      0.8      0.6      0.6  %       0.5-1.5
+Meth    Hb       1.4      1.5      1.3      1.3      1.5  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561547  Z516569  Z561666  Z561068  Z516668
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    10:42    12:34    20:56    22:30    22:58  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.42     7.40     7.39     7.40     7.41          7.35-7.45
+pCO2              46H      47H      46H      43       42  mmHg    35-45
+HCO3(Std)         28       28       26       26       26  mmol/L  22.0-30.0
+Base Excess      4.6H     4.2H     2.6      1.8      1.7  mmol/L  -3.0/3.0
+pO2              103H     210H      78       89       88  mmHg    75-100
+O2 Sat            98      100       95       97       98  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.8      4.2      4.6      4.3      4.7  mmol/L  3.5-5.5
+Sodium           141      141      138      138      137  mmol/L  135-145
+Chloride         109      109      109      109      107  mmol/L  95-110
+iCa++           1.11L    1.14     1.14     1.10L    1.12  mmol/L  1.12-1.30
+Glucose          6.8      6.0      8.6H     7.3      7.4  mmol/L  3.6-7.7
+Lactate          0.6      0.3      1.0      1.0      1.0  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        81L      80L     100L     102L     105L g/L     130-170
+Reduced Hb       1.7      0.5      4.4      2.6      2.0  %       0-5
+CarbOxy Hb       1.3      1.4      2.0H     1.9H     2.0H %       0.5-1.5
+Meth    Hb       1.7H     1.8H     1.3      1.2      1.0  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561568
+      Date: 05/04/12                                              Arterial
+      Time:    22:57                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.48H                                             7.35-7.45
+pCO2              38                                      mmHg    35-45
+Base Excess      4.6H                                     mmol/L  -3.0/3.0
+pO2               60L                                     mmHg    75-100
+O2 Sat            92L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.3L                                     mmol/L  3.5-5.5
+Sodium           133L                                     mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       116                                      g/L     115-150
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561467  Z561468
+      Date: 05/04/12 05/04/12                                     Arterial
+      Time:    22:05    22:58                             Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0                             Deg. C
+pH              7.34L    7.34L                                    7.35-7.45
+pCO2              32L      32L                            mmHg    35-45
+HCO3(Std)       18.0L      18L                            mmol/L  22.0-30.0
+Base Excess     -7.9L    -8.2L                            mmol/L  -3.0/3.0
+pO2               80       78                             mmHg    75-100
+O2 Sat          96.0       96                             %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium          *      3.5                             mmol/L  3.5-5.5
+Sodium           141      142                             mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb        99L     101L                            g/L     115-150
+
+05/04/12 12Z516467
+General Comments: Potassium unavailable. Sample transported on ice.
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561463  Z516864  Z561765  Z561067  Z516368
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    16:46    18:10    19:54    21:22    22:36  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.36     7.40     7.36     7.24L    7.29L         7.35-7.45
+pCO2              23L      21L      27L      44       37  mmHg    35-45
+HCO3(Std)         16L      17L      17L      18L      18L mmol/L  22.0-30.0
+Base Excess    -11.8L   -10.8L    -9.4L    -7.9L    -8.1L mmol/L  -3.0/3.0
+pO2              138H     136H     306H     345H     141H mmHg    75-100
+O2 Sat            99      100      100      100       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        5.7H     6.0H     5.6H     6.2H     6.0H mmol/L  3.5-5.5
+Sodium           140      141      138      136      134L mmol/L  135-145
+Chloride         107      106      107      105      106  mmol/L  95-110
+iCa++           0.99L    0.98L    0.97L    0.98L    0.95L mmol/L  1.12-1.30
+Glucose          5.3      4.4      7.4      6.4      5.9  mmol/L  3.6-7.7
+Lactate         12.3H    11.7H     9.3H     7.5H     5.9H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       106L     109L     108L     108L     100L g/L     130-170
+Reduced Hb       0.6      0.5     -0.2L    -0.1L     0.9  %       0-5
+CarbOxy Hb       1.7H     1.8H     1.4      1.3      1.5  %       0.5-1.5
+Meth    Hb       1.0      1.2      1.1      0.7      1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561060  Z561268
+      Date: 05/04/12 05/04/12                                     Arterial
+      Time:    12:53    22:36                             Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0                             Deg. C
+pH              7.47H    7.49H                                    7.35-7.45
+pCO2              34L      34L                            mmHg    35-45
+HCO3(Std)       26.0       27                             mmol/L  22.0-30.0
+Base Excess      1.1      2.5                             mmol/L  -3.0/3.0
+pO2               58L      70L                            mmHg    75-100
+O2 Sat          91.0L      99                             %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium          *      3.3L                            mmol/L  3.5-5.5
+Sodium           136      137                             mmol/L  135-145
+Chloride                  108                             mmol/L  95-110
+iCa++                    1.14                             mmol/L  1.12-1.30
+Glucose                   7.9H                            mmol/L  3.6-7.7
+Lactate                   1.8                             mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       115      101L                            g/L     115-150
+Reduced Hb                0.8                             %       0-5
+CarbOxy Hb                1.2                             %       0.5-1.5
+Meth    Hb                1.1                             %       0-1.5
+
+05/04/12 12Z516060
+General Comments: Potassium unavailable. Sample transported on ice.
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type:  Serum
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type           Serum
+
+HEPATITIS SEROLOGY
+Hepatitis B Surface Antibody (by Architect)            : Moderate Positive
+HBsAB Titre                                            :      44 IU/L
+
+       Hepatitis B Surface Antibody Titres          Interpretation
+     =======================================       ================
+
+                   < 10 IU/L                          Not Detected
+              10 -  100 IU/L                       Moderate Positive
+                 >  100 IU/L                            Detected
+     =======================================       =================
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561594  Z561539  Z516763  Z561167  Z561168
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    08:02    12:24    17:03    21:26    22:33  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.37     7.32L    7.33L    7.39     7.41          7.35-7.45
+pCO2              42       47H      46H      37       34L mmHg    35-45
+HCO3(Std)         24       23       23       23       22  mmol/L  22.0-30.0
+Base Excess     -0.7     -1.6     -1.5     -2.1     -2.7  mmol/L  -3.0/3.0
+pO2              186H     115H     344H     239H     398H mmHg    75-100
+O2 Sat            99       97       99       99       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.3      5.4      5.4      4.2      3.8  mmol/L  3.5-5.5
+Sodium           141      137      136      134L     134L mmol/L  135-145
+Chloride         113H     109      105      105      107  mmol/L  95-110
+iCa++           1.20     1.20     1.19     1.18     1.15  mmol/L  1.12-1.30
+Glucose          7.1     10.4H     9.3H    13.8H    13.8H mmol/L  3.6-7.7
+Lactate          1.4      1.0      1.3      1.7      1.6  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        81L      86L      83L      71L      66L g/L     115-150
+Reduced Hb       1.1      2.5      0.9      1.2      0.9  %       0-5
+CarbOxy Hb       0.8      0.7      0.6      0.6      0.6  %       0.5-1.5
+Meth    Hb       1.6H     2.0H     2.1H     1.9H     2.5H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+THYROID FUNCTION
+Free T4                   18.5       pmol/L  ( 9.0-26.0 )
+Free T3                    5.3       pmol/L  ( 3.5-6.5  )
+TSH                       0.08    L  mIU/L   ( 0.1-4.0  )
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561595  Z561547  Z516569  Z561666  Z561068
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    08:49    10:42    12:34    20:56    22:30  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.42     7.42     7.40     7.39     7.40          7.35-7.45
+pCO2              43       46H      47H      46H      43  mmHg    35-45
+HCO3(Std)         27       28       28       26       26  mmol/L  22.0-30.0
+Base Excess      3.3H     4.6H     4.2H     2.6      1.8  mmol/L  -3.0/3.0
+pO2              105H     103H     210H      78       89  mmHg    75-100
+O2 Sat            98       98      100       95       97  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.6      4.8      4.2      4.6      4.3  mmol/L  3.5-5.5
+Sodium           141      141      141      138      138  mmol/L  135-145
+Chloride         108      109      109      109      109  mmol/L  95-110
+iCa++           1.11L    1.11L    1.14     1.14     1.10L mmol/L  1.12-1.30
+Glucose          7.6      6.8      6.0      8.6H     7.3  mmol/L  3.6-7.7
+Lactate          0.7      0.6      0.3      1.0      1.0  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        83L      81L      80L     100L     102L g/L     130-170
+Reduced Hb       1.6      1.7      0.5      4.4      2.6  %       0-5
+CarbOxy Hb       1.5      1.3      1.4      2.0H     1.9H %       0.5-1.5
+Meth    Hb       1.4      1.7H     1.8H     1.3      1.2  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z886959  Z968226  Z968410  Z386038  Z968970
+      Date:  04/04/12 04/04/12 05/04/12 05/04/12 05/04/12
+      Time:     05:10    18:13    00:15    10:00    22:20 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.2               1.3      1.3      1.4H       0.8-1.3
+APTT               73H      49H      50H      52H      45H secs  23-36
+Fibrinogen        4.1               4.0               3.8  g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366362
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561546  Z516519  Z561561  Z561964  Z516967
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    09:19    12:19    14:24    18:18    22:28  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.46H    7.43     7.42     7.48H       *          7.35-7.45
+pCO2              44       52H      53H      45           mmHg    35-45
+HCO3(Std)         30       32H      32H      33H          mmol/L  22.0-30.0
+Base Excess      6.9H     9.1H     8.6H     9.2H          mmol/L  -3.0/3.0
+pO2               62L      86      131H      81           mmHg    75-100
+O2 Sat            92L      96       98       96           %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.1      3.8      4.4      4.1           mmol/L  3.5-5.5
+Sodium           144      143      144      145           mmol/L  135-145
+Chloride         110      106      107      109           mmol/L  95-110
+iCa++           1.11L    1.11L    1.09L    1.11L          mmol/L  1.12-1.30
+Glucose          7.7      7.6      7.5      7.8H          mmol/L  3.6-7.7
+Lactate          1.0      0.7      0.5      0.6           mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       102L     115      111L     104L          g/L     115-150
+Reduced Hb       7.6H     3.6      1.6      3.6           %       0-5
+CarbOxy Hb       1.3      1.0      1.1      1.2           %       0.5-1.5
+Meth    Hb       1.6H     1.7H     1.9H     1.4           %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763774
+SPECIMEN
+Specimen Type : Urine Midstream
+
+
+CHEMISTRY
+pH              5.0
+Protein         NEGATIVE
+Specific Grav.  1.009
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    1          x10^6/L ( <2x10^6/L )
+Red Blood Cells               Nil        x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+
+1. Streptococcus agalactiae (group B)                 10^7 cfu/L
+
+
+SENSITIVITIES:   1
+Amoxicillin      S
+Cotrimoxazole    S
+Nitrofurantoin   S
+Penicillin       S
+Vancomycin       S
+
+ORGANISM 1: Isolates of beta haemolytic streptococci  (Groups A,
+B, C and G) susceptible to penicillin are  considered susceptible
+to ampicillin, amoxicillin,  augmentin, cefazolin, cephalothin,
+cefotaxime,  ceftriaxone, cefepime and meropenem.
+
+Group B Streptococcus is part of the normal vaginal flora.
+It may be significant in pregnant patients causing intrauterine,
+perinatal or neonatal infection.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561063  Z561963  Z516366  Z561567  Z561867
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    16:20    17:16    20:36    22:13    22:25  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.42     7.41     7.40        *     7.39          7.35-7.45
+pCO2              34L      35       36                40  mmHg    35-45
+HCO3(Std)         23       23       23                24  mmol/L  22.0-30.0
+Base Excess     -1.9     -2.4     -1.8              -0.4  mmol/L  -3.0/3.0
+pO2               68L      85       74L               59L mmHg    75-100
+O2 Sat            94L      99       95                90L %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.8      3.6      4.1               3.8  mmol/L  3.5-5.5
+Sodium           140      141      140               141  mmol/L  135-145
+Chloride         111H     112H     113H              110  mmol/L  95-110
+iCa++           1.17     1.15     1.18              1.19  mmol/L  1.12-1.30
+Glucose          5.7      5.5      5.8               6.1  mmol/L  3.6-7.7
+Lactate          0.8      0.8      0.8               0.9  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       104L     103L     112L              117L g/L     130-170
+Reduced Hb       5.5H     0.8      5.0               9.6H %       0-5
+CarbOxy Hb       1.4      1.1      1.2               1.2  %       0.5-1.5
+Meth    Hb       1.1      1.5      1.4               1.6H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+VITAMINS AND NUTRITION
+Retinol (Vitamin A)              *     umol/L( 0.7-3.0 )
+
+Test Referred to: Melbourne Pathology
+    Date Packed:      00/00/00
+Date Dispatched:      00/00/00
+Vitamin 25 D                 TF      nmol/L( SEE-BELOW
+Vitamin E                      *     umol/L(11-45     )
+
+Test Referred to: Melbourne Pathology
+    Date Packed:      00/00/00
+Date Dispatched:      00/00/00
+
+Comment: sample not protected from light ward notified for
+         recollection
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z167860  Z868247  Z986950
+      Date:  02/04/12 03/04/12 05/04/12
+      Time:     05:50    00:00    20:20                   Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR                 *      1.2      1.1                          0.8-1.3
+APTT                        24       24                    secs  23-36
+Fibrinogen                 2.3      2.7                    g/L   2.0-5.0
+
+12Z167860 02/04/12 05:50
+Comment: * Please note: no specimen received. CSR notified ward
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         4.2     mmol/L ( 3.5-5.5  )
+Chloride           98     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         75     umol/L ( 49-90    )
+ (Creatinine)    0.075    mmol/L ( 0.05-0.09)
+Urea              4.0     mmol/L ( 2.5-8.3  )
+ eGFR             74             ( SEE-BELOW)
+Calcium          2.05     mmol/L ( 2.10-2.60)
+Phosphate        0.96     mmol/L ( 0.8-1.5  )
+Magnesium        0.78     mmol/L ( 0.8-1.0  )
+Albumin            23     g/L    ( 35-50    )
+C-React Prot        2     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z167860  Z986368  Z968950
+  Date:  02/04/12 04/04/12 05/04/12
+  Time:     05:50    23:00    20:20                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             97L     112L     107L                   g/L       115-150
+WCC          11.9H     8.1      9.3                    x10^9/L   4.0-11.0
+PLT           349      285      347                    x10^9/L   140-400
+RCC          3.79L    4.48     4.29                    x10^12/L  3.80-5.10
+PCV          0.31L    0.35     0.34L                   L/L       0.35-0.45
+MCV          80.6     78.8L    79.9L                   fL        80.0-96.0
+MCH          25.5L    25.0L    24.9L                   pg        27.0-33.0
+MCHC          317L     317L     311L                   g/L       320-360
+RDW          21.5H    21.0H    21.8H                   %         11.0-15.0
+ESR            30H                                     mm in 1hr 2-12
+White Cell Differential
+Neut         7.4      3.4      5.2                     x10^9/L   2.0-8.0
+Lymph        3.1      3.9      3.3                     x10^9/L   1.2-4.0
+Mono         1.1H     0.7      0.6                     x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.0                     x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.1                     x10^9/L   0.0-0.1
+Bands        0.4                                       x10^9/L   0.0-0.5
+
+12Z167860 02/04/12 05:50
+Film Comment : White cells show mild monocytosis and nild toxic changes
+               in the neutrophils. Manual differential.
+               Red cells show moderate numbers of target cells and some
+               stomatocytes.
+               Platelets appear normal.
+Conclusion: No clinical information provided.
+            ? Infection / inflammation
+            Note anaemia, suggest iron studies.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Comment: Potassium unavailable. Sample transported on ice.
+
+Request No:  Z561767
+      Date: 05/04/12                                              Arterial
+      Time:    22:24                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.32L                                             7.35-7.45
+pCO2              43                                      mmHg    35-45
+HCO3(Std)       21.0L                                     mmol/L  22.0-30.0
+Base Excess     -3.4L                                     mmol/L  -3.0/3.0
+pO2               53L                                     mmHg    75-100
+O2 Sat          85.0L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium          *                                      mmol/L  3.5-5.5
+Sodium           139                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb        97L                                     g/L     115-150
+
+05/04/12 12Z516767
+General Comments: Potassium unavailable. Sample transported on ice.
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         4.0     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               28     mmol/L ( 22-30    )
+Creatinine         86     umol/L ( 64-104   )
+ (Creatinine)    0.086    mmol/L ( 0.05-0.11)
+Urea             12.2     mmol/L ( 2.5-8.3  )
+ eGFR             73             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968930
+  Date:  05/04/12
+  Time:     22:20                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            131                                      g/L       130-170
+WCC          11.6H                                     x10^9/L   4.0-11.0
+PLT           220                                      x10^9/L   140-400
+RCC          3.65L                                     x10^12/L  4.50-5.70
+PCV          0.38L                                     L/L       0.40-0.50
+MCV         104.1H                                     fL        80.0-96.0
+MCH          35.8H                                     pg        27.0-33.0
+MCHC          344                                      g/L       320-360
+RDW          14.9                                      %         11.0-15.0
+White Cell Differential
+Neut         9.3H                                      x10^9/L   2.0-8.0
+Lymph        1.2                                       x10^9/L   1.2-4.0
+Mono         0.9                                       x10^9/L   0.1-1.0
+Eos          0.0                                       x10^9/L   0.0-0.5
+Baso         0.1                                       x10^9/L   0.0-0.1
+
+12Z986930 05/04/12 22:20
+Film Comment : Red cells are mildly macrocytic with occasional target
+               cells. Mild neutrophilia.
+Conclusion: Common causes of macrocytosis include liver disease,
+            B12/folate deficiency, and certain drugs including
+            chemotherapy. Suggest liver function tests, serum
+            B12/folate levels, and review drug history if cause not
+            already known.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968940
+      Date:  05/04/12
+      Time:     22:00                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1                                            0.8-1.3
+APTT               27                                      secs  23-36
+Fibrinogen        4.0                                      g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            139     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         54     umol/L ( 49-90    )
+ (Creatinine)    0.054    mmol/L ( 0.05-0.09)
+Urea              3.4     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            38     g/L    ( 35-50    )
+AP                 90     IU/L   ( 30-120   )
+GGT                61     IU/L   ( 10-65    )
+ALT                23     IU/L   ( <34      )
+AST                25     IU/L   ( <31      )
+Bili Total          6     umol/L ( <19      )
+Protein Total      86     g/L    ( 65-85    )
+C-React Prot        4     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z362853  Z236704  Z363276  Z566600  Z986940
+  Date:  09/02/12 10/02/12 11/02/12 08/03/12 05/04/12
+  Time:     05:25    05:00    05:45    12:00    22:00  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            111L     109L     111L     140      133  g/L       115-150
+WCC          12.9H     5.3      5.2     10.6      6.0  x10^9/L   4.0-11.0
+PLT           358      359      380      288      373  x10^9/L   140-400
+RCC          3.62L    3.45L    3.53L    4.43     4.25  x10^12/L  3.80-5.10
+PCV          0.33L    0.31L    0.32L    0.40     0.39  L/L       0.35-0.45
+MCV          90.6     90.5     90.2     90.4     92.3  fL        80.0-96.0
+MCH          30.7     31.6     31.3     31.6     31.4  pg        27.0-33.0
+MCHC          339      350      347      349      340  g/L       320-360
+RDW          14.6     14.3     14.4     16.2H    14.8  %         11.0-15.0
+White Cell Differential
+Neut        10.5H     3.5      2.4      9.1H     3.0   x10^9/L   2.0-8.0
+Lymph        1.3      1.2      2.0      1.0L     2.5   x10^9/L   1.2-4.0
+Mono         0.9      0.5      0.5      0.5      0.4   x10^9/L   0.1-1.0
+Eos          0.0      0.1      0.2      0.1      0.1   x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561556  Z561559  Z516662  Z561764  Z561667
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    09:21    12:31    15:23    17:56    22:18  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.30L    7.31L       *        *     7.35          7.35-7.45
+pCO2              39       41       39       37       36  mmHg    35-45
+HCO3(Std)         19L      20L                        20L mmol/L  22.0-30.0
+Base Excess     -6.4L    -5.1L                      -4.8L mmol/L  -3.0/3.0
+pO2              111H     104H      98       85       92  mmHg    75-100
+O2 Sat            98       98       97       96       97  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        2.7L     4.4      4.0      3.8      4.5  mmol/L  3.5-5.5
+Sodium           153H     152H     152H     154H     153H mmol/L  135-145
+Chloride         125H     126H     125H     125H     125H mmol/L  95-110
+iCa++           1.28     1.24     1.26     1.25     1.24  mmol/L  1.12-1.30
+Glucose          7.6      7.5      6.6      6.9      6.9  mmol/L  3.6-7.7
+Lactate          1.8      1.5      1.8      1.7      1.9H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       100L     100L      96L     101L     105L g/L     130-170
+Reduced Hb       2.3      2.4      2.7      3.6      3.3  %       0-5
+CarbOxy Hb       0.5      0.6      0.6      0.7      0.6  %       0.5-1.5
+Meth    Hb       1.3      1.9H     1.6H     1.5      1.6H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z486606  Z468827  Z968920
+      Date:  02/04/12 04/04/12 05/04/12
+      Time:     11:40    09:45    22:10                   Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1      1.1      1.2                          0.8-1.3
+APTT               24       24       22L                   secs  23-36
+Fibrinogen        2.6      2.4      2.3                    g/L   2.0-5.0
+
+12Z986920 05/04/12 22:10
+Comment: Please note : Low APTT.  ? Cause  ? Pre-activation of
+         specimen.  Suggest repeat.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.6     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               24     mmol/L ( 22-30    )
+Creatinine        110     umol/L ( 64-104   )
+ (Creatinine)    0.110    mmol/L ( 0.05-0.11)
+Urea             11.1     mmol/L ( 2.5-8.3  )
+ eGFR             58             ( SEE-BELOW)
+Calcium          2.34     mmol/L ( 2.10-2.60)
+Phosphate        1.51     mmol/L ( 0.8-1.5  )
+Magnesium        0.81     mmol/L ( 0.7-1.1  )
+Albumin            34     g/L    ( 35-50    )
+AP                 99     IU/L   ( 30-120   )
+GGT                32     IU/L   ( 10-65    )
+ALT                37     IU/L   ( <45      )
+AST                26     IU/L   ( <35      )
+Bili Total         15     umol/L ( <19      )
+Protein Total      69     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z468606  Z568213  Z986920
+  Date:  02/04/12 05/04/12 05/04/12
+  Time:     11:40    10:40    22:10                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            147      137      140                    g/L       130-170
+WCC          10.1     11.2H    16.1H                   x10^9/L   4.0-11.0
+PLT            71L      89L      82L                   x10^9/L   140-400
+RCC          4.45L    4.21L    4.36L                   x10^12/L  4.50-5.70
+PCV          0.42     0.40     0.41                    L/L       0.40-0.50
+MCV          95.1     95.7     94.8                    fL        80.0-96.0
+MCH          32.9     32.6     32.2                    pg        27.0-33.0
+MCHC          346      341      340                    g/L       320-360
+RDW          13.6     13.0     13.1                    %         11.0-15.0
+White Cell Differential
+Neut         7.9      9.0H    14.7H                    x10^9/L   2.0-8.0
+Lymph        1.7      1.5      0.8L                    x10^9/L   1.2-4.0
+Mono         0.2      0.6      0.6                     x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.0                     x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0                     x10^9/L   0.0-0.1
+Bands        0.3                                       x10^9/L   0.0-0.5
+
+12Z468606 02/04/12 11:40
+Film Comment : Moderate thrombocytopenia. Occasional reactive
+               lymphocytes. Manual differential. Red cells are mainly
+               normocytic normochromic with occasional elongated cells.
+Conclusion: Known history of immune thrombocytopenic purpura (ITP).
+            Suggest follow up FBEs to monitor platelet count.
+Comment: Film reveiwed by Dr Radio Xray - Haematology
+         Registrar
+
+12Z568213 05/04/12 10:40
+Comment: Note neutrophilia.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Troponin I        0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Troponin I       <0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+No Test Requested
+NTRC
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               30     mmol/L ( 22-30    )
+Creatinine         94     umol/L ( 64-104   )
+ (Creatinine)    0.094    mmol/L ( 0.05-0.11)
+Urea              5.3     mmol/L ( 2.5-8.3  )
+ eGFR             75             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z568703  Z169290  Z886775  Z169620  Z968899
+  Date:  30/01/07 08/06/09 24/08/09 20/07/11 05/04/12
+  Time:     17:50    08:30    02:10    06:30    22:00  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            161      136      151      141      138  g/L       130-170
+WCC           6.9      7.3     10.2     13.8H     4.2  x10^9/L   4.0-11.0
+PLT           299      229      280      207      159  x10^9/L   140-400
+RCC          5.44     4.47L    4.98     4.67     4.55  x10^12/L  4.50-5.70
+PCV          0.47     0.40     0.44     0.41     0.40  L/L       0.40-0.50
+MCV          85.9     89.7     88.4     87.8     87.3  fL        80.0-96.0
+MCH          29.6     30.3     30.3     30.2     30.4  pg        27.0-33.0
+MCHC          345      338      343      344      348  g/L       320-360
+RDW          12.7     13.1     12.6     13.0     13.0  %         11.0-15.0
+White Cell Differential
+Neut         4.6      4.6      7.6     11.0H     3.8   x10^9/L   2.0-8.0
+Lymph        1.4      2.1      1.8      1.4      0.2L  x10^9/L   1.2-4.0
+Mono         0.7      0.5      0.6      1.2H     0.1   x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.1      0.2      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         3.5     mmol/L ( 3.5-5.5  )
+Chloride          107     mmol/L ( 95-110   )
+HCO3               24     mmol/L ( 22-30    )
+Creatinine         60     umol/L ( 49-90    )
+ (Creatinine)    0.060    mmol/L ( 0.05-0.09)
+Urea              6.1     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968889
+  Date:  05/04/12
+  Time:     22:11                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            128                                      g/L       115-150
+WCC           9.9                                      x10^9/L   4.0-11.0
+PLT           303                                      x10^9/L   140-400
+RCC          3.89                                      x10^12/L  3.80-5.10
+PCV          0.37                                      L/L       0.35-0.45
+MCV          94.8                                      fL        80.0-96.0
+MCH          32.9                                      pg        27.0-33.0
+MCHC          347                                      g/L       320-360
+RDW          12.1                                      %         11.0-15.0
+White Cell Differential
+Neut         6.8                                       x10^9/L   2.0-8.0
+Lymph        2.2                                       x10^9/L   1.2-4.0
+Mono         0.8                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z860599
+SPECIMEN
+Specimen Type : Swab
+Description   : site not stated
+
+
+
+GRAM STAIN
+Leucocytes                                     +
+Gram positive cocci                            +
+
+
+CULTURE
+
+
+
+
+1. Staphylococcus aureus                              ++
+
+
+SENSITIVITIES    1
+
+Clindamycin      S
+Cotrimoxazole    S
+Erythromycin     S
+Fusidic Acid     S
+Oxacillin        S
+Penicillin       S
+Rifampicin       S
+Vancomycin       S
+
+
+This oxacillin susceptible isolate will also be susceptible to
+flucloxacillin, methicillin, augmentin, cloxacillin, cephalexin,
+cephalothin and cefazolin.
+This clindamycin sensitive isolate will also be  sensitive to
+lincomycin.
+
+
+COMMENT
+Dry swab received only - swab in TRANSPORT MEDIUM is optimal for
+culture.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561062  Z561063  Z516963  Z561366  Z561567
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    14:47    16:20    17:16    20:36    22:13  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.40     7.42     7.41     7.40        *          7.35-7.45
+pCO2              38       34L      35       36           mmHg    35-45
+HCO3(Std)         24       23       23       23           mmol/L  22.0-30.0
+Base Excess     -0.9     -1.9     -2.4     -1.8           mmol/L  -3.0/3.0
+pO2               67L      68L      85       74L          mmHg    75-100
+O2 Sat            93L      94L      99       95           %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.0      3.8      3.6      4.1           mmol/L  3.5-5.5
+Sodium           140      140      141      140           mmol/L  135-145
+Chloride         111H     111H     112H     113H          mmol/L  95-110
+iCa++           1.21     1.17     1.15     1.18           mmol/L  1.12-1.30
+Glucose          5.6      5.7      5.5      5.8           mmol/L  3.6-7.7
+Lactate          0.8      0.8      0.8      0.8           mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       106L     104L     103L     112L          g/L     130-170
+Reduced Hb       6.4H     5.5H     0.8      5.0           %       0-5
+CarbOxy Hb       1.3      1.4      1.1      1.2           %       0.5-1.5
+Meth    Hb       1.3      1.1      1.5      1.4           %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+URINE
+
+Urine Creatinine               11.5   mmol/L
+Urine Creatinine Excretion            mmol/D          ( 7-13     )
+Creatinine Clearance                  ml/sec          ( 1.5-2.5  )
+Creatinine Clearance                  ml/min          ( 90-150   )
+Urine Protein                  0.34   g/L
+Urine Protein Excretion               g/D             ( <0.15    )
+Protein/Creat Ratio              30   mg/mmol Creat   ( 15-35    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+LAB.NUMBER: Z364920
+
+SURVEILLANCE SCREENING
+
+
+CULTURE
+SCREENING TEST FOR            VRE
+
+GROIN SWAB                    VRE not detected
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z761461  Z663728  Z676651  Z364144  Z968859
+      Date:  11/10/08 21/12/08 28/09/11 16/02/12 05/04/12
+      Time:     09:45    21:20    12:45    07:55    21:50 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               2.2H     3.3H     1.1      1.2      1.1        0.8-1.3
+APTT                                          28       28  secs  23-36
+Fibrinogen                                   3.9      4.7  g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         5.2     mmol/L ( 3.5-5.5  )
+Chloride          107     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine        127     umol/L ( 64-104   )
+ (Creatinine)    0.127    mmol/L ( 0.05-0.11)
+Urea             16.8     mmol/L ( 2.5-8.3  )
+ eGFR             47             ( SEE-BELOW)
+Calcium          2.38     mmol/L ( 2.10-2.60)
+Phosphate        1.11     mmol/L ( 0.8-1.5  )
+Magnesium        0.94     mmol/L ( 0.7-1.1  )
+Albumin            32     g/L    ( 35-50    )
+AP                201     IU/L   ( 30-120   )
+GGT               360     IU/L   ( 10-65    )
+ALT                17     IU/L   ( <45      )
+AST                31     IU/L   ( <35      )
+Bili Total         12     umol/L ( <19      )
+Protein Total      79     g/L    ( 65-85    )
+Troponin I        0.08    ug/L   (See Below )
+CK                 43     IU/L   ( <175     )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z167305  Z868378  Z766119  Z367707  Z968859
+  Date:  01/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     09:16    06:00    11:40    08:20    21:50  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             93L      95L      92L      98L      94L g/L       130-170
+WCC           7.5      7.2      7.2      8.0      9.0  x10^9/L   4.0-11.0
+PLT           200      214        *      226      244  x10^9/L   140-400
+RCC          3.80L    3.92L    3.83L    4.01L    3.91L x10^12/L  4.50-5.70
+PCV          0.28L    0.29L    0.29L    0.30L    0.30L L/L       0.40-0.50
+MCV          74.2L    74.6L    74.9L    75.7L    75.8L fL        80.0-96.0
+MCH          24.5L    24.3L    24.1L    24.5L    24.1L pg        27.0-33.0
+MCHC          330      326      322      323      318L g/L       320-360
+RDW          15.7H    15.6H    15.7H    15.7H    16.1H %         11.0-15.0
+White Cell Differential
+Neut         4.9      5.1      5.9      5.5      5.8   x10^9/L   2.0-8.0
+Lymph        1.3      0.9L     0.7L     1.5      1.9   x10^9/L   1.2-4.0
+Mono         0.6      0.1      0.4      0.6      0.7   x10^9/L   0.1-1.0
+Eos          0.6H     0.6H     0.1      0.3      0.6H  x10^9/L   0.0-0.5
+Baso         0.1      0.2H     0.0      0.0      0.1   x10^9/L   0.0-0.1
+Bands                 0.2                              x10^9/L   0.0-0.5
+
+12Z886378 03/04/12 06:00
+Film Comment : Manual differential. Red cells are microcytic hypochromic
+               with some polychromasia, elongated cells and occasional
+               target cells. Platelets appear normal.
+Conclusion: Mild Eosinophilia persists.
+            Known Beta-Thalassaemia Minor. Iron
+            studies may be of value. Suggest repeat FBE.
+
+            Film reviewed by Dr Radio Xray - Haematology
+            Registrar
+
+12Z766119 04/04/12 11:40
+Film Comment : Platelets appear normocytic normochromic with occasional
+               fibrin strands noted. ? accuracy of platelet count. Red
+               cells are unchanged. White cells are unremarkable.
+Conclusion: Known beta thalassaemia minor. Suggest repeat FBE for an
+            accurate platelet count.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968315  Z968465  Z986643  Z968743  Z968869
+      Date:  04/04/12 05/04/12 05/04/12 05/04/12 05/04/12
+      Time:     21:10    03:15    10:54    16:10    22:05 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR                        1.3                                   0.8-1.3
+APTT              105H      44H      38H      40H      40H secs  23-36
+Fibrinogen                 4.9                             g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Comment: Potassium unavailable. Sample transported on ice.
+
+Request No:  Z516467
+      Date: 05/04/12                                              Arterial
+      Time:    22:05                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.34L                                             7.35-7.45
+pCO2              32L                                     mmHg    35-45
+HCO3(Std)       18.0L                                     mmol/L  22.0-30.0
+Base Excess     -7.9L                                     mmol/L  -3.0/3.0
+pO2               80                                      mmHg    75-100
+O2 Sat          96.0                                      %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium          *                                      mmol/L  3.5-5.5
+Sodium           141                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb        99L                                     g/L     115-150
+
+05/04/12 12Z561467
+General Comments: Potassium unavailable. Sample transported on ice.
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+URINE
+Period                          ru.   Hrs
+Volume                           nk   ml
+
+Urine Creatinine                2.2   mmol/L
+Urine Creatinine Excretion            mmol/D          ( 7-13     )
+Urine Protein                  0.51   g/L
+Urine Protein Excretion               g/D             ( <0.15    )
+Protein/Creat Ratio             232 H mg/mmol Creat   ( 15-35    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z736764
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              6.5
+Protein         +
+Specific Grav.  1.012
+Blood           +
+Glucose         +
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    5          x10^6/L ( <2x10^6/L )
+Red Blood Cells               2          x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     +
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z986839
+      Date:  05/04/12
+      Time:     21:40                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0                                            0.8-1.3
+APTT               21L                                     secs  23-36
+Fibrinogen        4.5                                      g/L   2.0-5.0
+
+12Z968839 05/04/12 21:40
+Comment: Please note : Low APTT.  ? Cause  ? Pre-activation of
+         specimen.  Suggest repeat.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            143     mmol/L ( 135-145  )
+Potassium         4.5     mmol/L ( 3.5-5.5  )
+Chloride          105     mmol/L ( 95-110   )
+HCO3               30     mmol/L ( 22-30    )
+Creatinine         77     umol/L ( 64-104   )
+ (Creatinine)    0.077    mmol/L ( 0.05-0.11)
+Urea              7.5     mmol/L ( 2.5-8.3  )
+ eGFR             86             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986839
+  Date:  05/04/12
+  Time:     21:40                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            143                                      g/L       130-170
+WCC           7.2                                      x10^9/L   4.0-11.0
+PLT           171                                      x10^9/L   140-400
+RCC          4.61                                      x10^12/L  4.50-5.70
+PCV          0.41                                      L/L       0.40-0.50
+MCV          88.4                                      fL        80.0-96.0
+MCH          31.1                                      pg        27.0-33.0
+MCHC          352                                      g/L       320-360
+RDW          13.8                                      %         11.0-15.0
+White Cell Differential
+Neut         5.5                                       x10^9/L   2.0-8.0
+Lymph        1.0L                                      x10^9/L   1.2-4.0
+Mono         0.7                                       x10^9/L   0.1-1.0
+Eos          0.0                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            139     mmol/L ( 135-145  )
+Potassium         4.7     mmol/L ( 3.5-5.5  )
+Chloride          101     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine        127     umol/L ( 49-90    )
+ (Creatinine)    0.127    mmol/L ( 0.05-0.09)
+Urea             16.2     mmol/L ( 2.5-8.3  )
+ eGFR             35             ( SEE-BELOW)
+Troponin I        0.04    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z864851  Z864950  Z836163  Z863134  Z968829
+  Date:  04/03/12 04/03/12 07/03/12 08/03/12 05/04/12
+  Time:     07:48    09:40    10:15    09:55    21:53  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            103L      93L      81L      84L      96L g/L       115-150
+WCC           5.6      6.8      5.6      4.8      6.7  x10^9/L   4.0-11.0
+PLT           267      283      240      230      302  x10^9/L   140-400
+RCC          3.45L    3.17L    2.77L    2.80L    3.50L x10^12/L  3.80-5.10
+PCV          0.31L    0.28L    0.25L    0.25L    0.30L L/L       0.35-0.45
+MCV          89.7     87.3     88.8     88.3     84.9  fL        80.0-96.0
+MCH          29.7     29.2     29.4     30.2     27.4  pg        27.0-33.0
+MCHC          331      334      330      342      323  g/L       320-360
+RDW          16.5H    16.5H    16.7H    16.9H    16.9H %         11.0-15.0
+White Cell Differential
+Neut         4.0      5.2      3.9      3.5      4.5   x10^9/L   2.0-8.0
+Lymph        0.8L     0.8L     0.7L     0.6L     0.8L  x10^9/L   1.2-4.0
+Mono         0.4      0.4      0.6      0.5      0.8   x10^9/L   0.1-1.0
+Eos          0.4      0.4      0.5      0.3      0.5   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.1   x10^9/L   0.0-0.1
+
+12Z846851 04/03/12 07:48
+Film Comment : Red cells are mainly normocytic normochromic with some
+               elongated cells, target cells, polychromatic cells and
+               mild rouleaux. Platelets show occasional large fomrs.
+               White cells appear normal.
+
+12Z863134 08/03/12 09:55
+Film Comment : Red cell changes persist. Film scanned.
+Conclusion: Note persistent anaemia.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            139     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride          110     mmol/L ( 95-110   )
+HCO3               18     mmol/L ( 22-30    )
+Creatinine        132     umol/L ( 49-90    )
+ (Creatinine)    0.132    mmol/L ( 0.05-0.09)
+Urea             10.7     mmol/L ( 2.5-8.3  )
+ eGFR             35             ( SEE-BELOW)
+Calcium          2.09     mmol/L ( 2.10-2.60)
+Phosphate        1.66     mmol/L ( 0.8-1.5  )
+Magnesium        1.10     mmol/L ( 0.8-1.0  )
+Albumin            28     g/L    ( 35-50    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968356  Z986691  Z968819
+  Date:  04/04/12 05/04/12 05/04/12
+  Time:     22:01    10:00    21:40                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            109L      90L     100L                   g/L       115-150
+WCC           7.3      8.8     12.8H                   x10^9/L   4.0-11.0
+PLT           184      170      206                    x10^9/L   140-400
+RCC          3.45L    2.82L    3.23L                   x10^12/L  3.80-5.10
+PCV          0.32L    0.26L    0.30L                   L/L       0.35-0.45
+MCV          92.5     92.1     92.4                    fL        80.0-96.0
+MCH          31.5     31.9     31.0                    pg        27.0-33.0
+MCHC          340      346      335                    g/L       320-360
+RDW          15.8H    16.5H    16.3H                   %         11.0-15.0
+White Cell Differential
+Neut         6.7      8.0     11.4H                    x10^9/L   2.0-8.0
+Lymph        0.5L     0.7L     0.5L                    x10^9/L   1.2-4.0
+Mono         0.1      0.0L     0.9                     x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.0                     x10^9/L   0.0-0.5
+Baso         0.0      0.1      0.1                     x10^9/L   0.0-0.1
+
+12Z968691 05/04/12 10:00
+Comment: Intra-op
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968694  Z986770  Z968745  Z968803  Z986809
+      Date:  05/04/12 05/04/12 05/04/12 05/04/12 05/04/12
+      Time:     11:25    14:57    17:00    19:00    21:30 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1                                            0.8-1.3
+APTT               55H      44H       *       67H      61H secs  23-36
+Fibrinogen        4.3                                      g/L   2.0-5.0
+
+12Z968803 05/04/12 19:00
+Comment: Further testing with a heparin resistant reagent confirmed
+         the presence of heparin. Please indicate anticoagulant
+         therapy on request form.
+
+12Z968745 05/04/12 17:00
+Comment: * Insufficient specimen to perform APTT. Ward informed.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561163  Z516164  Z561865  Z561566  Z516367
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    16:22    17:26    20:00    20:52    21:52  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.28L    7.17L    7.31L    7.37     7.37          7.35-7.45
+pCO2              51H      50H      41       35       32L mmHg    35-45
+HCO3(Std)                           20L      21L      20L mmol/L  22.0-30.0
+Base Excess     -2.3     -9.8L    -4.8L    -4.6L    -6.0L mmol/L  -3.0/3.0
+pO2              141H     233H     245H     134H     160H mmHg    75-100
+O2 Sat            98       98       99       99       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.9      3.7      4.2      4.3      4.2  mmol/L  3.5-5.5
+Sodium           141      144      141      142      141  mmol/L  135-145
+Chloride                           115H     114H     115H mmol/L  95-110
+iCa++                             1.07L    1.06L    1.07L mmol/L  1.12-1.30
+Glucose                           10.8H    10.7H    11.0H mmol/L  3.6-7.7
+Lactate                            1.0      1.2      1.1  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       104L      92L      94L      95L      98L g/L     130-170
+Reduced Hb                         0.8      1.4      1.0  %       0-5
+CarbOxy Hb                         0.3L     0.5      0.6  %       0.5-1.5
+Meth    Hb                         1.6H     1.7H     1.6H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561267
+      Date: 05/04/12                                              Arterial
+      Time:    21:49                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.37                                              7.35-7.45
+pCO2              53H                                     mmHg    35-45
+Base Excess      5.0H                                     mmol/L  -3.0/3.0
+pO2               19L                                     mmHg    75-100
+O2 Sat            25L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.6                                      mmol/L  3.5-5.5
+Sodium           142                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       149                                      g/L     130-170
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            142     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride          105     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         50     umol/L ( 49-90    )
+ (Creatinine)    0.050    mmol/L ( 0.05-0.09)
+Urea              4.4     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            40     g/L    ( 35-50    )
+AP                 91     IU/L   ( 30-120   )
+GGT                28     IU/L   ( 10-65    )
+ALT                34     IU/L   ( <34      )
+AST                22     IU/L   ( <31      )
+Bili Total          7     umol/L ( <19      )
+Protein Total      80     g/L    ( 65-85    )
+Troponin I       <0.02    ug/L   (See Below )
+C-React Prot        5     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968898
+  Date:  05/04/12
+  Time:     21:40                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            120                                      g/L       115-150
+WCC           6.9                                      x10^9/L   4.0-11.0
+PLT           250                                      x10^9/L   140-400
+RCC          4.16                                      x10^12/L  3.80-5.10
+PCV          0.34L                                     L/L       0.35-0.45
+MCV          81.1                                      fL        80.0-96.0
+MCH          28.9                                      pg        27.0-33.0
+MCHC          356                                      g/L       320-360
+RDW          13.4                                      %         11.0-15.0
+White Cell Differential
+Neut         3.8                                       x10^9/L   2.0-8.0
+Lymph        2.6                                       x10^9/L   1.2-4.0
+Mono         0.4                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+CK                344     IU/L   ( <175     )
+CKMB Mass         34.0    ug/L   ( <4       )
+LIPIDS
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z066808
+SPECIMEN
+Specimen Type:         Faeces
+Description:           Unformed
+
+
+CLOSTRIDIUM DIFFICILE
+C.difficile Culture:                       C.difficile NOT isolated
+
+
+COMMENT
+* Faeces examination for patients in hospital for >3 days will
+ONLY have C.difficile tests performed.
+
+ If the clinical condition requires more extensive culture, other
+pathogen detection, or if the clinical condition warrants further
+investigation, please contact the Microbiology Registrar.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z996588
+SPECIMEN
+Specimen Type : Tracheal Aspirate
+
+
+MICROSCOPY
+
+GRAM STAIN
+Pus Cells                                 +
+No organisms seen
+
+
+
+
+
+CULTURE
+
+Standard culture:   ++ Mixed upper respiratory tract flora
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z736754
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              5.5
+Protein         +
+Specific Grav.  >=1.030
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    4          x10^6/L ( <2x10^6/L )
+Red Blood Cells               Nil        x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366352
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Bili Total          *     umol/L ( <19      )
+Protein Total       *     g/L    ( 65-85    )
+
+Comment: The requested tests were not completed as no
+         sample was  received.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Miscellaneous Fluid
+Fluid Type:   CSF
+Cerebrospinal Fluid
+Csf Protein      0.22 g/L    ( 0.15-0.45
+Csf Glucose       3.6 mmol/L ( 2.5-5.0)
+
+Xanthochromia Test
+
+Date of Symptom Onset:   04/04/2012
+Time of Symptom Onset:   12:00
+Date of Lumbar Puncture: 05/04/2012
+Time of Lumbar Puncture: 21:30
+Hand Delivered?:         no
+Time Difference:         33:30
+Xan Result               As below
+Xanthochromia Comment:   Oxyhaemoglobin present but no significant
+                         bilirubin.   The concentration of oxyhaemoglobin
+                         may mask a small  but significant increase in
+                         bilirubin.  Subarachnoid  haemorrhage not
+                         excluded.
+                         NOTE: This xanthochromia result cannot be fully
+                         relied  upon as specimens were not collected /
+                         forwarded  according to protocol.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z262849
+SPECIMEN
+Specimen Type : CSF Lumbar Puncture
+
+MACROSCOPIC APPEARANCE                 MACROSCOPIC APPEARANCE
+
+CSF Total volume: 7    ml(s)
+
+TUBE 3                                 TUBE 1
+Clear and colourless                   Faintly bloodstained
+
+CELL COUNT:          x10^6/L           CELL COUNT:          x10^6/L
+Erythrocytes         3                 Erythrocytes         114
+Polymorphs           0                 Polymorphs           0
+Lymphocytes          0                 Lymphocytes          0
+
+CULTURE
+No Growth After 2 Days.
+
+COMMENT
+This CSF specimen will be cultured on routine media for 48 hours.
+Please contact the Microbiology registrar if either extended
+culture or special media are required.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z764221  Z566945  Z765513  Z765914  Z986838
+      Date:  28/07/11 09/03/12 10/03/12 11/03/12 05/04/12
+      Time:     16:20    04:30    06:10    01:20    21:25 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               2.6H     2.7H     3.4H     3.5H     1.9H       0.8-1.3
+APTT                                                   31  secs  23-36
+Fibrinogen                                            3.2  g/L   2.0-5.0
+
+12Z765513 10/03/12 06:10
+Comment: Please indicate anticoagulant therapy on request form.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            143     mmol/L ( 135-145  )
+Potassium         4.3     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine         89     umol/L ( 49-90    )
+ (Creatinine)    0.089    mmol/L ( 0.05-0.09)
+Urea              8.5     mmol/L ( 2.5-8.3  )
+ eGFR             53             ( SEE-BELOW)
+Troponin I        0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z765513  Z765823  Z756914  Z165519  Z968838
+  Date:  10/03/12 10/03/12 11/03/12 12/03/12 05/04/12
+  Time:     06:10    19:00    01:20    06:27    21:25  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            115        *      116      109L     112L g/L       115-150
+WCC           5.2               7.2      7.3      9.6  x10^9/L   4.0-11.0
+PLT           144        *      164      154      172  x10^9/L   140-400
+RCC          3.90              3.98     3.71L    3.83  x10^12/L  3.80-5.10
+PCV          0.34L             0.35     0.32L    0.34L L/L       0.35-0.45
+MCV          87.3              87.8     87.1     87.5  fL        80.0-96.0
+MCH          29.5              29.2     29.3     29.3  pg        27.0-33.0
+MCHC          338               332      337      335  g/L       320-360
+RDW          15.6H             15.5H    15.5H    15.6H %         11.0-15.0
+White Cell Differential
+Neut         3.2               4.7      5.3      6.7   x10^9/L   2.0-8.0
+Lymph        1.4               1.7      1.4      2.0   x10^9/L   1.2-4.0
+Mono         0.4               0.6      0.5      0.7   x10^9/L   0.1-1.0
+Eos          0.2               0.2      0.1      0.2   x10^9/L   0.0-0.5
+Baso         0.0               0.1      0.0      0.1   x10^9/L   0.0-0.1
+
+12Z756823 10/03/12 19:00
+Comment: * Please note: no specimen received.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type           Serum
+
+Test performed at Friends Laboratory
+
+
+
+COMMENT: This serum sample has been stored for 3 months.  If clinically
+         indicated please send convalescent sera 2-3  weeks after
+         symptom onset for Mycoplasma, Influenza, Chlamydia and Q fever
+         or 4-6 weeks after symptom onset for Legionella.  More rapid
+         results are available for Legionella  pneumophila and
+         Pneumococcus by urinary antigen  testing, or for Influenza by
+         PCR of nose/throat swabs.
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516524  Z561594  Z561539  Z516763  Z561167
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    06:18    08:02    12:24    17:03    21:26  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.36     7.37     7.32L    7.33L    7.39          7.35-7.45
+pCO2              37       42       47H      46H      37  mmHg    35-45
+HCO3(Std)         21L      24       23       23       23  mmol/L  22.0-30.0
+Base Excess     -3.7L    -0.7     -1.6     -1.5     -2.1  mmol/L  -3.0/3.0
+pO2              105H     186H     115H     344H     239H mmHg    75-100
+O2 Sat            97       99       97       99       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.5      4.3      5.4      5.4      4.2  mmol/L  3.5-5.5
+Sodium           145      141      137      136      134L mmol/L  135-145
+Chloride         118H     113H     109      105      105  mmol/L  95-110
+iCa++           1.11L    1.20     1.20     1.19     1.18  mmol/L  1.12-1.30
+Glucose          5.3      7.1     10.4H     9.3H    13.8H mmol/L  3.6-7.7
+Lactate          0.8      1.4      1.0      1.3      1.7  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        74L      81L      86L      83L      71L g/L     115-150
+Reduced Hb       2.7      1.1      2.5      0.9      1.2  %       0-5
+CarbOxy Hb       0.8      0.8      0.7      0.6      0.6  %       0.5-1.5
+Meth    Hb       2.4H     1.6H     2.0H     2.1H     1.9H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561261  Z516463  Z561864  Z561765  Z516067
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    14:13    16:46    18:10    19:54    21:22  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.26L    7.36     7.40     7.36     7.24L         7.35-7.45
+pCO2              26L      23L      21L      27L      44  mmHg    35-45
+HCO3(Std)         14L      16L      17L      17L      18L mmol/L  22.0-30.0
+Base Excess    -14.4L   -11.8L   -10.8L    -9.4L    -7.9L mmol/L  -3.0/3.0
+pO2              142H     138H     136H     306H     345H mmHg    75-100
+O2 Sat            99       99      100      100      100  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        5.0      5.7H     6.0H     5.6H     6.2H mmol/L  3.5-5.5
+Sodium           142      140      141      138      136  mmol/L  135-145
+Chloride         109      107      106      107      105  mmol/L  95-110
+iCa++           0.98L    0.99L    0.98L    0.97L    0.98L mmol/L  1.12-1.30
+Glucose          5.2      5.3      4.4      7.4      6.4  mmol/L  3.6-7.7
+Lactate         15.0H    12.3H    11.7H     9.3H     7.5H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        99L     106L     109L     108L     108L g/L     130-170
+Reduced Hb       1.2      0.6      0.5     -0.2L    -0.1L %       0-5
+CarbOxy Hb       1.4      1.7H     1.8H     1.4      1.3  %       0.5-1.5
+Meth    Hb       1.2      1.0      1.2      1.1      0.7  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.0     mmol/L ( 3.5-5.5  )
+Chloride          111     mmol/L ( 95-110   )
+HCO3               21     mmol/L ( 22-30    )
+Creatinine         75     umol/L ( 64-104   )
+ (Creatinine)    0.075    mmol/L ( 0.05-0.11)
+Urea              7.0     mmol/L ( 2.5-8.3  )
+ eGFR             89             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z069574  Z616341  Z968385  Z968583  Z986808
+  Date:  28/10/11 02/11/11 04/04/12 05/04/12 05/04/12
+  Time:     11:10    13:00    21:25    06:15    21:10  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            134      133      156      155      121L g/L       130-170
+WCC           7.0     11.6H    12.6H    12.8H     8.7  x10^9/L   4.0-11.0
+PLT           298      315      339      341      283  x10^9/L   140-400
+RCC          4.35L    4.31L    5.10     5.03     3.90L x10^12/L  4.50-5.70
+PCV          0.40     0.40     0.47     0.46     0.36L L/L       0.40-0.50
+MCV          91.5     92.1     91.8     92.3     91.6  fL        80.0-96.0
+MCH          30.7     30.8     30.5     30.9     31.0  pg        27.0-33.0
+MCHC          336      335      333      335      339  g/L       320-360
+RDW          15.2H    15.2H    14.8     14.5     14.4  %         11.0-15.0
+White Cell Differential
+Neut         4.7      8.8H    10.8H     9.1H     6.2   x10^9/L   2.0-8.0
+Lymph        1.7      1.8      1.1L     0.5L     1.7   x10^9/L   1.2-4.0
+Mono         0.4      1.0      0.6      0.6      0.8   x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.1      0.0      0.1   x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.1      0.0      0.0   x10^9/L   0.0-0.1
+Bands                                   2.6H           x10^9/L   0.0-0.5
+
+11Z661341 02/11/11 13:00
+Comment: Note: mild neutrophilia. Instrument differential and
+         parameters reported.
+
+12Z968583 05/04/12 06:15
+Film Comment : Mild neutrophilia with toxic changes and a moderate left
+               shift. Manual differential. Red cells are mainly
+               normocytic normochromic with occasional elongated cells.
+               Platelets appear normal.
+Conclusion: ? Infection / inflammation. repeat FBE may be of value.
+
+12Z986808 05/04/12 21:10
+Comment: Please note fall in haemoglobin and platelet count since
+         the previous examination. ?Rehydration. Suggest repeat.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            133     mmol/L ( 135-145  )
+Potassium         3.7     mmol/L ( 3.5-5.5  )
+Chloride           99     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine        175     umol/L ( 49-90    )
+ (Creatinine)    0.175    mmol/L ( 0.05-0.09)
+Urea              9.1     mmol/L ( 2.5-8.3  )
+ eGFR             28             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            133     mmol/L ( 135-145  )
+Potassium         3.7     mmol/L ( 3.5-5.5  )
+Chloride           99     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine        175     umol/L ( 49-90    )
+ (Creatinine)    0.175    mmol/L ( 0.05-0.09)
+Urea              9.1     mmol/L ( 2.5-8.3  )
+ eGFR             28             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z376489  Z868657  Z868982  Z986405  Z968818
+  Date:  03/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     09:38    16:45    03:45    02:35    20:10  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             95L      84L      97L      93L      81L g/L       115-150
+WCC           7.8     11.4H     8.1      9.1      6.8  x10^9/L   4.0-11.0
+PLT           127L     142      110L     123L     125L x10^9/L   140-400
+RCC          3.22L    2.90L    3.29L    3.16L    2.75L x10^12/L  3.80-5.10
+PCV          0.27L    0.24L    0.28L    0.27L    0.23L L/L       0.35-0.45
+MCV          85.1     84.0     85.1     86.3     85.1  fL        80.0-96.0
+MCH          29.5     29.1     29.4     29.4     29.3  pg        27.0-33.0
+MCHC          346      346      345      340      344  g/L       320-360
+RDW          14.2     14.3     14.9     14.3     15.0  %         11.0-15.0
+White Cell Differential
+Neut         6.4      8.1H     6.5      7.6      5.2   x10^9/L   2.0-8.0
+Lymph        0.9L     1.6      1.0L     0.8L     1.1L  x10^9/L   1.2-4.0
+Mono         0.4      1.0      0.5      0.6      0.5   x10^9/L   0.1-1.0
+Eos          0.0      0.1      0.0      0.1      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+Bands                 0.2                              x10^9/L   0.0-0.5
+Meta                  0.3H                             x10^9/L   0.0
+NRBC                     1H                            /100WBCs  0
+NRBC Abs              0.1H                             x10^9/L   0
+
+12Z868657 03/04/12 16:45
+Film Comment : Manual differential. Mild neutrophilia with slight left
+               shift. A rare nucleated red blood cell seen and increased
+               rouleaux. Mild thrombocytopenia.
+Conclusion: Please note fall in haemoglobin since the previous
+            examination. ? any infection / inflammation.
+            No clinical information provided.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Anti-Factor Xa Assay (Plasma)
+Heparin Level by Anti-Xa          0.07   U/mL
+
+Anti-Factor Xa Comment:
+   Reference range for Anti-Xa level depends upon route, time, dose and
+   reason for anticoagulation.
+   Therapeutic anticoagulation with LMWH (such as Enoxaparin) generally does
+   not require routine monitoring. However, anti-Xa levels are recommended
+   for patients on LMWH requiring dose adjustment in settings of (1) renal
+   impairment, (2) obesity and (3) pregnancy.  To assist interpretation of
+   therapeutic ranges, anti-Xa levels should be collected four hours after
+   the third dose.  For less common indications such a patients at high risk
+   of bleeding, and interpretation of results, please contact the on-call
+   laboratory Haematology registrar or Haematologist via ACME switchboard.
+
+Tests of Hypercoagulability (Plasma)
+Antithrombin (Functional)         88     %      (80-120)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z367489  Z886657  Z868982  Z968405  Z986818
+      Date:  03/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+      Time:     09:38    16:45    03:45    02:35    20:10 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.2      1.2      1.3      1.3      1.3        0.8-1.3
+APTT               74H      70H      59H      64H      66H secs  23-36
+Fibrinogen        6.5H     6.7H     6.4H     7.3H     6.2H g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type:  Urine
+
+Legionella Antigen by Immunochromatography               : NOT Detected
+
+S.pneumoniae Antigen by Immunochromatography             : NOT Detected
+
+
+GENERAL COMMENT:
+
+LEGIONELLA URINARY ANTIGEN:
+Presumptive negative for Legionella pneumophila  serogroup 1
+antigen in urine. Infection due to  Legionella cannot be ruled out
+since other serogroups  and species may cause disease.
+Antigen may not be  present in urine in early infection.
+Please send another urine if clinically indicated.
+
+STREPTOCOCCUS PNEUMONIAE ANTIGEN:
+Presumptive  negative for pneumococcal pneumonia.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         4.6     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine        161     umol/L ( 64-104   )
+ (Creatinine)    0.161    mmol/L ( 0.05-0.11)
+Urea             16.4     mmol/L ( 2.5-8.3  )
+ eGFR             37             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z996578
+SPECIMEN
+Specimen Type : Sputum
+
+
+MICROSCOPY
+
+GRAM STAIN
+Macroscopic Description                   Mucoid
+Pus:Epithelial Cell Ratio                 <25:10
+Pus Cells                                 Occasional
+Squamous Epithelial Cells                 ++
+Gram positive cocci                       +
+Gram positive bacilli                     +
+Gram negative bacilli                     +
+yeasts                                    Occasional
+
+ Standard bacterial culture is not indicated as the ratio
+ of pus to epithelial cells, or the bacteria seen in the
+ Gram stain indicate salivary contamination.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516566  Z561599  Z561862  Z516564  Z561866
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    09:24    12:42    15:58    17:46    21:08  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.32L    7.37     7.37     7.36     7.38          7.35-7.45
+pCO2              35       34L      34L      35       33L mmHg    35-45
+HCO3(Std)         18L      20L      20L      20L      20L mmol/L  22.0-30.0
+Base Excess     -7.3L    -5.1L    -5.0L    -5.3L    -4.8L mmol/L  -3.0/3.0
+pO2              129H     112H     117H      95       81  mmHg    75-100
+O2 Sat            99       98       99       98       96  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.4      3.9      4.6      4.3      4.2  mmol/L  3.5-5.5
+Sodium           135      134L     135      137      135  mmol/L  135-145
+Chloride         110      110      110      110      109  mmol/L  95-110
+iCa++           1.06L    1.05L    1.08L    1.09L    1.08L mmol/L  1.12-1.30
+Glucose          8.7H     9.0H     7.6      6.7     10.3H mmol/L  3.6-7.7
+Lactate          2.5H     2.1H     2.8H     2.6H     2.0H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        80L      79L      80L      81L      81L g/L     115-150
+Reduced Hb       1.3      1.7      1.1      2.4      3.7  %       0-5
+CarbOxy Hb       0.7      0.6      0.7      0.6      0.6  %       0.5-1.5
+Meth    Hb       1.1      1.6H     1.1      0.8      1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+THYROID FUNCTION
+TSH                       2.52       mIU/L   ( 0.1-4.0  )
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z736744
+SPECIMEN
+Specimen Type : Urine In/Out Catheter
+
+
+CHEMISTRY
+pH              5.5
+Protein         TRACE
+Specific Grav.  1.018
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      +
+
+
+MICROSCOPY
+Leucocytes                    5          x10^6/L ( <2x10^6/L )
+Red Blood Cells               Nil        x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z736734
+SPECIMEN
+Specimen Type : Urine Midstream
+
+
+CHEMISTRY
+pH              5.5
+Protein         +
+Specific Grav.  1.025
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      TRACE
+
+
+MICROSCOPY
+Leucocytes                    28         x10^6/L ( <2x10^6/L )
+Red Blood Cells               6          x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     ++
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z736724
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              5.0
+Protein         NEGATIVE
+Specific Grav.  1.014
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    1          x10^6/L ( <2x10^6/L )
+Red Blood Cells               3          x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z176645  Z868279  Z868875  Z986450  Z968847
+      Date:  01/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+      Time:     22:00    02:00    00:30    00:10    20:59 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0      1.0      1.0      1.1      1.1        0.8-1.3
+APTT               28       26       28       27       25  secs  23-36
+Fibrinogen        6.8H     7.8H     7.9H     8.9H     8.0H g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.9     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         43     umol/L ( 64-104   )
+ (Creatinine)    0.043    mmol/L ( 0.05-0.11)
+Urea              3.5     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Calcium          2.16     mmol/L ( 2.10-2.60)
+Phosphate        1.42     mmol/L ( 0.8-1.5  )
+Magnesium        0.81     mmol/L ( 0.7-1.1  )
+Albumin            21     g/L    ( 35-50    )
+AP                117     IU/L   ( 30-120   )
+GGT               172     IU/L   ( 10-65    )
+ALT                31     IU/L   ( <45      )
+AST                58     IU/L   ( <35      )
+Bili Total         17     umol/L ( <19      )
+Protein Total      55     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z176645  Z868279  Z868875  Z986450  Z968847
+  Date:  01/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     22:00    02:00    00:30    00:10    20:59  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             83L      79L      80L      82L      96L g/L       130-170
+WCC          12.7H     9.2      8.1     10.9     16.1H x10^9/L   4.0-11.0
+PLT           147      190      236      321      410H x10^9/L   140-400
+RCC          2.70L    2.54L    2.55L    2.64L    3.12L x10^12/L  4.50-5.70
+PCV          0.24L    0.23L    0.23L    0.24L    0.28L L/L       0.40-0.50
+MCV          90.5     90.2     90.1     91.3     89.3  fL        80.0-96.0
+MCH          30.9     31.1     31.3     31.0     30.8  pg        27.0-33.0
+MCHC          341      345      347      340      344  g/L       320-360
+RDW          14.4     14.5     14.7     14.6     14.3  %         11.0-15.0
+White Cell Differential
+Neut         9.6H     5.5      5.1      7.6     11.6H  x10^9/L   2.0-8.0
+Lymph        1.7      2.3      1.1L     1.5      0.5L  x10^9/L   1.2-4.0
+Mono         1.3H     0.6      1.4H     1.5H     2.6H  x10^9/L   0.1-1.0
+Eos          0.1      0.3      0.3      0.3      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.1      0.0   x10^9/L   0.0-0.1
+Bands                 0.5      0.2               1.4H  x10^9/L   0.0-0.5
+
+12Z868279 03/04/12 02:00
+Film Comment : Neutrophils show a slight left shift and mild toxic
+               changes. Manual differential. Red cells are mainly
+               normocytic normochromic with some target cells,
+               polychromatic cells and mild rouleaux. Platelets appear
+               normal.
+
+12Z886875 04/04/12 00:30
+Film Comment : Manual differential.
+
+12Z968847 05/04/12 20:59
+Film Comment : Manual differential. Mild neutrophilia and monocytosis
+               with left shift and slight toxic granulation. Red cells
+               essentially unchanged.
+Conclusion: Increase in leucocyte count since the last examination.
+            ? any acute infection / inflammation.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763714
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              7.5
+Protein         ++
+Specific Grav.  1.017
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    3          x10^6/L ( <2x10^6/L )
+Red Blood Cells               5          x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Cortisol                   37    L  nmol/L  ( 120-650  )
+Cortisol Diurnal Variation:AM (0800 - 0900): 150 - 650 nmol/L
+                           PM (1500 - 1600): 120 - 400 nmol/L
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.6     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               31     mmol/L ( 22-30    )
+Creatinine         88     umol/L ( 64-104   )
+ (Creatinine)    0.088    mmol/L ( 0.05-0.11)
+Urea              4.9     mmol/L ( 2.5-8.3  )
+ eGFR             88             ( SEE-BELOW)
+Osmolality        290     mosm/kg( 280-300  )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+URINE
+Period                          ru.   Hrs
+Volume                           nk   ml
+
+Urine Sodium                    147   mmol/L
+Urine Sodium Excretion                mmol/D          ( 75-300   )
+Urine Potassium                  29   mmol/L
+Urine Potassium Excretion             mmol/D          ( 40-100   )
+Urine Osmolality                618   mmol/L          ( 50-1200  )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561509  Z516061  Z561762  Z561364  Z516766
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    11:42    14:08    15:28    17:29    20:59  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.15L    7.32L    7.31L    7.38     7.37          7.35-7.45
+pCO2              58H      42       45       36       37  mmHg    35-45
+HCO3(Std)         17L      21L      21L      22       22  mmol/L  22.0-30.0
+Base Excess     -8.0L    -4.0L    -3.7L    -3.1L    -3.4L mmol/L  -3.0/3.0
+pO2               73L     203H     210H      97      157H mmHg    75-100
+O2 Sat            89L      99       99       98       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        5.4      4.4      4.6      4.6      4.6  mmol/L  3.5-5.5
+Sodium           130L     131L     131L     130L     129L mmol/L  135-145
+Chloride         100      104      103      103      102  mmol/L  95-110
+iCa++           1.24     1.10L    1.12     1.10L    1.12  mmol/L  1.12-1.30
+Glucose         13.9H    10.5H     9.8H     9.0H     9.4H mmol/L  3.6-7.7
+Lactate          7.7H     1.1      0.8      0.7      0.7  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        99L      94L      90L      87L      81L g/L     115-150
+Reduced Hb      10.6H     0.7      0.6      2.1      0.8  %       0-5
+CarbOxy Hb       0.9      0.8      0.6      0.9      0.8  %       0.5-1.5
+Meth    Hb       1.3      1.5      1.0      1.3      1.2  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+URINE
+Period                          ru.   Hrs
+Volume                           nk   ml
+
+Urine Sodium                     87   mmol/L
+Urine Sodium Excretion                mmol/D          ( 75-300   )
+Urine Potassium                  81   mmol/L
+Urine Potassium Excretion             mmol/D          ( 40-100   )
+Urine Osmolality                612   mmol/L          ( 50-1200  )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         91     umol/L ( 64-104   )
+ (Creatinine)    0.091    mmol/L ( 0.05-0.11)
+Urea              5.4     mmol/L ( 2.5-8.3  )
+ eGFR             78             ( SEE-BELOW)
+Osmolality        295     mosm/kg( 280-300  )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            128     mmol/L ( 135-145  )
+Potassium         5.0     mmol/L ( 3.5-5.5  )
+Chloride           94     mmol/L ( 95-110   )
+HCO3               24     mmol/L ( 22-30    )
+Creatinine        189     umol/L ( 64-104   )
+ (Creatinine)    0.189    mmol/L ( 0.05-0.11)
+Urea             20.8     mmol/L ( 2.5-8.3  )
+ eGFR             34             ( SEE-BELOW)
+Albumin            34     g/L    ( 35-50    )
+AP                 46     IU/L   ( 30-120   )
+GGT                30     IU/L   ( 10-65    )
+ALT                25     IU/L   ( <45      )
+AST                31     IU/L   ( <35      )
+Bili Total         31     umol/L ( <19      )
+Protein Total      73     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968896
+  Date:  05/04/12
+  Time:     20:55                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            142                                      g/L       130-170
+WCC          10.1                                      x10^9/L   4.0-11.0
+PLT           109L                                     x10^9/L   140-400
+RCC          4.47L                                     x10^12/L  4.50-5.70
+PCV          0.41                                      L/L       0.40-0.50
+MCV          92.6                                      fL        80.0-96.0
+MCH          31.7                                      pg        27.0-33.0
+MCHC          343                                      g/L       320-360
+RDW          12.8                                      %         11.0-15.0
+White Cell Differential
+Neut         5.4                                       x10^9/L   2.0-8.0
+Lymph        0.5L                                      x10^9/L   1.2-4.0
+Mono         0.3                                       x10^9/L   0.1-1.0
+Eos          0.0                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+Bands        3.8H                                      x10^9/L   0.0-0.5
+Meta         0.1H                                      x10^9/L   0.0
+
+12Z968896 05/04/12 20:55
+Film Comment : Manual differential. Mild neutrophilia with prominent left
+               shift and moderate vaccuolation. Red cells are normocytic
+               normochromic. Mild thrombocytopenia with occasional large
+               forms.
+Conclusion: Features suggestive of infection / inflammation. Suggest
+            repeat FBE to confirm thrombocytopenia.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.3     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         85     umol/L ( 64-104   )
+ (Creatinine)    0.085    mmol/L ( 0.05-0.11)
+Urea              4.1     mmol/L ( 2.5-8.3  )
+ eGFR             85             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968807
+  Date:  05/04/12
+  Time:     20:56                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            143                                      g/L       130-170
+WCC           9.3                                      x10^9/L   4.0-11.0
+PLT           294                                      x10^9/L   140-400
+RCC          4.23L                                     x10^12/L  4.50-5.70
+PCV          0.41                                      L/L       0.40-0.50
+MCV          97.1H                                     fL        80.0-96.0
+MCH          33.8H                                     pg        27.0-33.0
+MCHC          348                                      g/L       320-360
+RDW          11.9                                      %         11.0-15.0
+White Cell Differential
+Neut         6.3                                       x10^9/L   2.0-8.0
+Lymph        2.2                                       x10^9/L   1.2-4.0
+Mono         0.7                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.1                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561523  Z561595  Z516547  Z561569  Z561666
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    05:29    08:49    10:42    12:34    20:56  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.38     7.42     7.42     7.40     7.39          7.35-7.45
+pCO2              47H      43       46H      47H      46H mmHg    35-45
+HCO3(Std)         26       27       28       28       26  mmol/L  22.0-30.0
+Base Excess      2.4      3.3H     4.6H     4.2H     2.6  mmol/L  -3.0/3.0
+pO2               78      105H     103H     210H      78  mmHg    75-100
+O2 Sat            96       98       98      100       95  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.0      4.6      4.8      4.2      4.6  mmol/L  3.5-5.5
+Sodium           139      141      141      141      138  mmol/L  135-145
+Chloride         106      108      109      109      109  mmol/L  95-110
+iCa++           1.14     1.11L    1.11L    1.14     1.14  mmol/L  1.12-1.30
+Glucose          8.7H     7.6      6.8      6.0      8.6H mmol/L  3.6-7.7
+Lactate          0.6      0.7      0.6      0.3      1.0  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        87L      83L      81L      80L     100L g/L     130-170
+Reduced Hb       4.2      1.6      1.7      0.5      4.4  %       0-5
+CarbOxy Hb       1.4      1.5      1.3      1.4      2.0H %       0.5-1.5
+Meth    Hb       1.3      1.4      1.7H     1.8H     1.3  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516360  Z561163  Z561164  Z516865  Z561566
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    13:39    16:22    17:26    20:00    20:52  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.32L    7.28L    7.17L    7.31L    7.37          7.35-7.45
+pCO2              45       51H      50H      41       35  mmHg    35-45
+HCO3(Std)                                    20L      21L mmol/L  22.0-30.0
+Base Excess     -3.1L    -2.3     -9.8L    -4.8L    -4.6L mmol/L  -3.0/3.0
+pO2              110H     141H     233H     245H     134H mmHg    75-100
+O2 Sat            95       98       98       99       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.0      3.9      3.7      4.2      4.3  mmol/L  3.5-5.5
+Sodium           138      141      144      141      142  mmol/L  135-145
+Chloride                                    115H     114H mmol/L  95-110
+iCa++                                      1.07L    1.06L mmol/L  1.12-1.30
+Glucose                                    10.8H    10.7H mmol/L  3.6-7.7
+Lactate                                     1.0      1.2  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       109L     104L      92L      94L      95L g/L     130-170
+Reduced Hb                                  0.8      1.4  %       0-5
+CarbOxy Hb                                  0.3L     0.5  %       0.5-1.5
+Meth    Hb                                  1.6H     1.7H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type:  Viral Swab
+
+RESPIRATORY VIRUS PCR
+Influenza A PCR (ABI Taqman)  : Not detected
+Influenza B PCR (ABI Taqman)  : DETECTED
+RSV PCR (ABI Taqman)          : Not Detected
+Rhinovirus PCR (ABI Taqman)   : Not Detected
+
+
+
+GENERAL COMMENT:
+
+Please note this result has been notified to the  State
+Department of Health. Notification by the referring medical
+practitioner is also required  under the Public Health and
+Wellbeing Regulations  2009. To notify, go to
+  http://www.state.gov/xxx or
+call 1-800-555-2123 to contact the State Department of Health.
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366342
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Not-stated
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516466
+      Date: 05/04/12                                              Arterial
+      Time:    20:52                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.40                                              7.35-7.45
+pCO2              36                                      mmHg    35-45
+Base Excess     -2.1                                      mmol/L  -3.0/3.0
+pO2               81                                      mmHg    75-100
+O2 Sat            96                                      %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.3                                      mmol/L  3.5-5.5
+Sodium           138                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       148                                      g/L     130-170
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Troponin I        0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+C-React Prot      149     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366332
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Vitamin 25 D                 TF      nmol/L( SEE-BELOW
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z986856
+      Date: 05/04/12
+      Time:    20:39                                      Units   Ref Range
+             -------- -------- -------- -------- -------- ------- ---------
+Serum Vitamin B12 and Folate Studies
+Vit B12          979H                                     pmol/L  150-600
+Ser Fol         44.2                                      nmol/L  >12.2
+Iron Studies (Plasma/serum)
+Ferritin       182.0                                      ug/L    15-200
+Iron              15                                      umol/L  10-30
+Transferrin     2.33                                      g/L     1.9-3.2
+Transf'n IBC    58.4                                      umol/L  47.6-80.2
+Transf'n Sat      25                                      %       14.7-37.4
+
+NOTE NEW REFERENCE RANGES FOR FOLATE
+From 27th April 2004, B12 and Folate will be performed on the Bayer Centaur
+Serum Folate Deficient -           <7.63 nmol/L
+Serum Folate Indeterminate - 7.64 to 12.2 nmol/L
+Old Ref Ranges prior to 27th April 2004
+   Serum Folate    - 6.0 to 38.0 nmol/L
+   Red Cell Folate - 350 to 1350 nmol/L
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            134     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride           96     mmol/L ( 95-110   )
+HCO3               20     mmol/L ( 22-30    )
+Creatinine         56     umol/L ( 49-90    )
+ (Creatinine)    0.056    mmol/L ( 0.05-0.09)
+Urea              3.1     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Glucose           3.2     mmol/L ( 3.3-7.7  )
+ (fasting)      NoInfo
+Calcium          2.56     mmol/L ( 2.10-2.60)
+Phosphate        1.03     mmol/L ( 0.8-1.5  )
+Magnesium        0.75     mmol/L ( 0.8-1.0  )
+Albumin            43     g/L    ( 35-50    )
+AP                 60     IU/L   ( 30-120   )
+GGT                23     IU/L   ( 10-65    )
+ALT                17     IU/L   ( <34      )
+AST                24     IU/L   ( <31      )
+Bili Total         13     umol/L ( <19      )
+Protein Total      83     g/L    ( 65-85    )
+C-React Prot        2     mg/L   ( <5       )
+LIPIDS
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968856
+  Date:  05/04/12
+  Time:     20:39                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            132                                      g/L       115-150
+WCC           6.6                                      x10^9/L   4.0-11.0
+PLT           396                                      x10^9/L   140-400
+RCC          4.23                                      x10^12/L  3.80-5.10
+PCV          0.38                                      L/L       0.35-0.45
+MCV          90.4                                      fL        80.0-96.0
+MCH          31.3                                      pg        27.0-33.0
+MCHC          346                                      g/L       320-360
+RDW          12.7                                      %         11.0-15.0
+White Cell Differential
+Neut         2.9                                       x10^9/L   2.0-8.0
+Lymph        3.0                                       x10^9/L   1.2-4.0
+Mono         0.5                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            134     mmol/L ( 135-145  )
+Potassium         4.3     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine         49     umol/L ( 49-90    )
+ (Creatinine)    0.049    mmol/L ( 0.05-0.09)
+Urea              4.4     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z861610  Z156358  Z366626  Z467684  Z986846
+  Date:  25/07/11 05/12/11 26/03/12 05/04/12 05/04/12
+  Time:     15:30    13:45    13:55    13:30    20:39  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            129      133      149      139      123  g/L       115-150
+WCC          10.4      5.4      9.4     13.1H    13.2H x10^9/L   4.0-11.0
+PLT           172      179      208      188      156  x10^9/L   140-400
+RCC          3.97     4.16     4.56     4.26     3.76L x10^12/L  3.80-5.10
+PCV          0.38     0.40     0.44     0.41     0.36  L/L       0.35-0.45
+MCV          96.3H    94.8     95.8     97.3H    95.8  fL        80.0-96.0
+MCH          32.4     31.9     32.7     32.5     32.7  pg        27.0-33.0
+MCHC          337      336      341      334      341  g/L       320-360
+RDW          13.6     13.2     13.8     13.7     13.1  %         11.0-15.0
+ESR            67H                                     mm in 1hr 2-20
+White Cell Differential
+Neut         8.9H     3.9      8.2H    12.2H    12.5H  x10^9/L   2.0-8.0
+Lymph        0.9L     1.0L     0.5L     0.1L     0.3L  x10^9/L   1.2-4.0
+Mono         0.6      0.4      0.5      0.8      0.2   x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.1      0.0      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.1      0.1      0.0      0.1   x10^9/L   0.0-0.1
+
+12Z467684 05/04/12 13:30
+Film Comment : White cells show mild neutrophilia.
+               Manual differential.
+               Red cells and platelets appear normal.
+
+12Z968846 05/04/12 20:39
+Comment: Instrument differential and parameters reported.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366322
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763704
+SPECIMEN
+Specimen Type : Urine Midstream
+
+
+CHEMISTRY
+pH              6.0
+Protein         TRACE
+Specific Grav.  1.026
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      +++
+
+
+MICROSCOPY
+Leucocytes                    336        x10^6/L ( <2x10^6/L )
+Red Blood Cells               35         x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     ++
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+
+1. Pseudomonas aeruginosa                             10^8-10^9 cfu/L
+
+
+SENSITIVITIES:   1
+Ceftazidime      S
+Ciprofloxacin    S
+Gentamicin       S
+Meropenem        S
+Tazocin          S
+Timentin         S
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z969568
+SPECIMEN
+Specimen Type : Sputum
+
+
+MICROSCOPY
+
+GRAM STAIN
+Macroscopic Description                   Mucopurulent
+Pus:Epithelial Cell Ratio                 >25:10
+Pus Cells                                 ++
+Squamous Epithelial Cells                 +
+Gram negative bacilli                     Occasional
+
+
+
+
+
+CULTURE
+
+Standard culture:   +++  Mixed upper respiratory tract flora
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561660  Z516062  Z561063  Z561963  Z516366
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    13:53    14:47    16:20    17:16    20:36  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.32L    7.40     7.42     7.41     7.40          7.35-7.45
+pCO2              48H      38       34L      35       36  mmHg    35-45
+HCO3(Std)         23       24       23       23       23  mmol/L  22.0-30.0
+Base Excess     -1.6     -0.9     -1.9     -2.4     -1.8  mmol/L  -3.0/3.0
+pO2              189H      67L      68L      85       74L mmHg    75-100
+O2 Sat            99       93L      94L      99       95  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.2      4.0      3.8      3.6      4.1  mmol/L  3.5-5.5
+Sodium           142      140      140      141      140  mmol/L  135-145
+Chloride         110      111H     111H     112H     113H mmol/L  95-110
+iCa++           1.27     1.21     1.17     1.15     1.18  mmol/L  1.12-1.30
+Glucose          5.6      5.6      5.7      5.5      5.8  mmol/L  3.6-7.7
+Lactate          0.9      0.8      0.8      0.8      0.8  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       106L     106L     104L     103L     112L g/L     130-170
+Reduced Hb       0.7      6.4H     5.5H     0.8      5.0  %       0-5
+CarbOxy Hb       1.3      1.3      1.4      1.1      1.2  %       0.5-1.5
+Meth    Hb       1.7H     1.3      1.1      1.5      1.4  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            135     mmol/L ( 135-145  )
+Potassium         5.8     mmol/L ( 3.5-5.5  )
+Chloride           98     mmol/L ( 95-110   )
+HCO3               22     mmol/L ( 22-30    )
+Creatinine        281     umol/L ( 49-90    )
+ (Creatinine)    0.281    mmol/L ( 0.05-0.09)
+Urea             26.5     mmol/L ( 2.5-8.3  )
+ eGFR             14             ( SEE-BELOW)
+C-React Prot        2     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366312
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Central Line
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.0     mmol/L ( 3.5-5.5  )
+Chloride          108     mmol/L ( 95-110   )
+HCO3               21     mmol/L ( 22-30    )
+Creatinine         62     umol/L ( 49-90    )
+ (Creatinine)    0.062    mmol/L ( 0.05-0.09)
+Urea              5.3     mmol/L ( 2.5-8.3  )
+ eGFR             86             ( SEE-BELOW)
+Calcium          2.25     mmol/L ( 2.10-2.60)
+Phosphate        0.75     mmol/L ( 0.8-1.5  )
+Magnesium        0.79     mmol/L ( 0.8-1.0  )
+Albumin            22     g/L    ( 35-50    )
+AP                104     IU/L   ( 30-120   )
+GGT                24     IU/L   ( 10-65    )
+ALT                17     IU/L   ( <34      )
+AST                20     IU/L   ( <31      )
+Bili Total          5     umol/L ( <19      )
+Protein Total      56     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z176927  Z868800  Z868980  Z986417  Z968885
+  Date:  02/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     12:30    18:30    02:10    03:30    20:00  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            119      112L     105L      97L      91L g/L       115-150
+WCC          15.3H     8.9     14.0H    13.1H    15.5H x10^9/L   4.0-11.0
+PLT           233        *      194      157      177  x10^9/L   140-400
+RCC          4.14     3.89     3.70L    3.36L    3.24L x10^12/L  3.80-5.10
+PCV          0.35     0.33L    0.31L    0.29L    0.27L L/L       0.35-0.45
+MCV          84.7     85.4     84.4     85.2     83.7  fL        80.0-96.0
+MCH          28.8     28.9     28.4     28.8     28.2  pg        27.0-33.0
+MCHC          340      338      337      338      337  g/L       320-360
+RDW          17.9H    18.0H    17.5H    17.8H    17.6H %         11.0-15.0
+White Cell Differential
+Neut        11.3H     7.3     10.6H    12.7H    14.9H  x10^9/L   2.0-8.0
+Lymph        2.4      0.1L     0.4L     0.2L     0.2L  x10^9/L   1.2-4.0
+Mono         1.3H     0.1      0.0L     0.2      0.2   x10^9/L   0.1-1.0
+Eos          0.3      0.0      0.1      0.0      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+Bands                 1.4H     2.8H              0.3   x10^9/L   0.0-0.5
+
+12Z167927 02/04/12 12:30
+Comment: Note mild neutrophilia and mild monocytosis.
+
+12Z886800 03/04/12 18:30
+Film Comment : Red cells show mild anisocytosis and mild rouleaux.
+               Moderate left shift and mild vacuolation in the
+               neutrophils.  Manual differential.
+               * Film shows fibrin strands and platelet clumps suggestive
+               of a partially clotted specimen. Accurate platelet count
+               unavailable.  Please repeat FBE.
+Conclusion: Suggestive of infection / inflammation.
+
+12Z868980 04/04/12 02:10
+Film Comment : Mild neutrophilia with left shift and mild vacuolation.
+               Manual differential.
+
+12Z968417 05/04/12 03:30
+Comment: Instrument differential and parameters reported.
+
+12Z986885 05/04/12 20:00
+Film Comment : Red cells show some microcytes, elongated cells and mildly
+               increased rouleaux. Manual differential. Mild
+               neutrophilia. Slight vaccuolation noted.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z806548
+SPECIMEN
+Specimen Type : Fluid
+Description   : Drain Collection
+
+
+
+Total specimen volume:     3 ml(s)
+
+
+MICROSCOPY
+
+
+GRAM STAIN
+Leucocytes                       +++
+Yeast cells                      +
+
+
+Specimen clotted - cell count not possible.
+
+CULTURE
+
+1. Candida albicans                                   +++
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516527  Z561960  Z561162  Z516464  Z561266
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    10:32    14:05    14:50    17:35    20:21  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.41        *     7.38     7.36     7.39          7.35-7.45
+pCO2              35       37       38       35       37  mmHg    35-45
+HCO3(Std)         23                23       20L      22  mmol/L  22.0-30.0
+Base Excess     -2.2              -2.1     -5.0L    -2.5  mmol/L  -3.0/3.0
+pO2              134H     113H     203H      89      102H mmHg    75-100
+O2 Sat            99       99      100       97       98  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.3      4.0      4.3      4.1      4.1  mmol/L  3.5-5.5
+Sodium           138      139      138      139      138  mmol/L  135-145
+Chloride         109      108      109      109      109  mmol/L  95-110
+iCa++           1.10L    1.10L    1.09L    1.09L    1.11L mmol/L  1.12-1.30
+Glucose          7.3      8.3H     7.4      8.7H     8.1H mmol/L  3.6-7.7
+Lactate          1.3      1.2      1.5      1.6      1.2  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        91L      89L      90L      86L      87L g/L     130-170
+Reduced Hb       0.9      1.4      0.4      3.0      1.9  %       0-5
+CarbOxy Hb       1.8H     1.8H     1.5      1.7H     1.6H %       0.5-1.5
+Meth    Hb       1.2      1.7H     1.1      1.5      1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+LAB.NUMBER: Z769310
+
+SURVEILLANCE SCREENING
+
+
+CULTURE
+SCREENING TEST FOR            VRE
+
+RECTAL SWAB                   VRE not detected
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Troponin I       <0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium              *     mmol/L ( 135-145  )
+Potassium           *     mmol/L ( 3.5-5.5  )
+Chloride            *     mmol/L ( 95-110   )
+HCO3                *     mmol/L ( 22-30    )
+Creatinine      *         umol/L ( 64-104   )
+ (Creatinine)        *    mmol/L ( 0.05-0.11)
+Urea                *     mmol/L ( 2.5-8.3  )
+ eGFR             N/A            ( SEE-BELOW)
+
+Comment: The requested tests were not completed as the
+         sample was labeled incorrectly. Ward notified.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968855
+  Date:  05/04/12
+  Time:     20:12                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb              *                                      g/L       130-170
+PLT             *                                      x10^9/L   140-400
+
+12Z968855 05/04/12 20:12
+Comment: The specimen received was mislabeled. The ward has  been
+         notified and a new sample requested.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z536992  Z968835
+      Date: 19/02/10 05/04/12
+      Time:    08:30    19:30                             Units   Ref Range
+             -------- -------- -------- -------- -------- ------- ---------
+Serum Vitamin B12 and Folate Studies
+Vit B12          334      333                             pmol/L  150-600
+Ser Fol        >54.0     23.2                             nmol/L  >12.2
+Iron Studies (Plasma/serum)
+Ferritin       215.0                                      ug/L    30-300
+Iron              25                                      umol/L  10-35
+Transferrin     2.69                                      g/L     1.9-3.2
+Transf'n IBC    67.4                                      umol/L  47.6-80.2
+Transf'n Sat      38                                      %       14.7-43.6
+
+NOTE NEW REFERENCE RANGES FOR FOLATE
+From 27th April 2004, B12 and Folate will be performed on the Bayer Centaur
+Serum Folate Deficient -           <7.63 nmol/L
+Serum Folate Indeterminate - 7.64 to 12.2 nmol/L
+Old Ref Ranges prior to 27th April 2004
+   Serum Folate    - 6.0 to 38.0 nmol/L
+   Red Cell Folate - 350 to 1350 nmol/L
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z563488  Z986835
+      Date:  18/02/10 05/04/12
+      Time:     11:30    19:30                            Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1      1.0                                   0.8-1.3
+APTT               25       25                             secs  23-36
+Fibrinogen        3.4      3.5                             g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Vitamin 25 D                 TF      nmol/L( SEE-BELOW
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z668490  Z536488  Z563992  R059163  Z968835
+  Date:  26/02/08 18/02/10 19/02/10 11/11/10 05/04/12
+  Time:     08:35    11:30    08:30    11:50    19:30  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            139      143      140      130      124L g/L       130-170
+WCC           6.0     13.1H     9.2      8.4      5.4  x10^9/L   4.0-11.0
+PLT           216      253      226      265      227  x10^9/L   140-400
+RCC          6.70H    6.75H    6.63H    6.16H    5.89H x10^12/L  4.50-5.70
+PCV          0.43     0.43     0.42     0.40     0.38L L/L       0.40-0.50
+MCV          64.1L    64.1L    63.4L    64.7L    65.2L fL        80.0-96.0
+MCH          20.7L    21.2L    21.1L    21.0L    21.0L pg        27.0-33.0
+MCHC          323      330      333      325      322  g/L       320-360
+RDW          16.3H    15.8H    16.2H    15.3H    16.5H %         11.0-15.0
+White Cell Differential
+Neut         3.2      9.7H     5.1      5.5      2.9   x10^9/L   2.0-8.0
+Lymph        2.0      2.1      2.8      1.9      1.8   x10^9/L   1.2-4.0
+Mono         0.6      1.2H     1.1H     0.7      0.6   x10^9/L   0.1-1.0
+Eos          0.2      0.1      0.2      0.2      0.2   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.2     mmol/L ( 3.5-5.5  )
+Chloride          100     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         85     umol/L ( 64-104   )
+ (Creatinine)    0.085    mmol/L ( 0.05-0.11)
+Urea              4.1     mmol/L ( 2.5-8.3  )
+ eGFR             87             ( SEE-BELOW)
+Albumin            37     g/L    ( 35-50    )
+AP                 62     IU/L   ( 30-120   )
+GGT               184     IU/L   ( 10-65    )
+ALT                95     IU/L   ( <45      )
+AST                74     IU/L   ( <35      )
+Bili Total         13     umol/L ( <19      )
+Protein Total      77     g/L    ( 65-85    )
+C-React Prot       12     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366302
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Not-stated
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z656878  Z968616  Z766236  Z986763  Z968815
+      Date:  01/10/10 05/04/12 05/04/12 05/04/12 05/04/12
+      Time:     11:00    11:55    13:47    16:26    20:04 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               2.5H       *      4.4H     1.3      1.3        0.8-1.3
+APTT               43H       *       34       28       27  secs  23-36
+Fibrinogen        7.3H       *      3.2      3.4      3.0  g/L   2.0-5.0
+PT                                 43.1                    secs
+PT mix                             14.2                    secs
+
+12Z766236 05/04/12 13:47
+PT Mix  : 50/50 mixture of the patient's plasma with normal plasma -
+          CORRECTED.
+
+12Z986616 05/04/12 11:55
+Comment: * Specimen clotted. ED informed.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            142     mmol/L ( 135-145  )
+Potassium         4.3     mmol/L ( 3.5-5.5  )
+Chloride          114     mmol/L ( 95-110   )
+HCO3               22     mmol/L ( 22-30    )
+Creatinine        106     umol/L ( 64-104   )
+ (Creatinine)    0.106    mmol/L ( 0.05-0.11)
+Urea              7.4     mmol/L ( 2.5-8.3  )
+ eGFR             59             ( SEE-BELOW)
+Calcium          1.80     mmol/L ( 2.10-2.60)
+Phosphate        1.05     mmol/L ( 0.8-1.5  )
+Magnesium        0.63     mmol/L ( 0.7-1.1  )
+Albumin            26     g/L    ( 35-50    )
+AP                 50     IU/L   ( 30-120   )
+GGT                13     IU/L   ( 10-65    )
+ALT                18     IU/L   ( <45      )
+AST                25     IU/L   ( <35      )
+Bili Total         13     umol/L ( <19      )
+Protein Total      51     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z167500  Z663514  Z166157  Z968616  Z968815
+  Date:  29/09/10 30/09/10 01/10/10 05/04/12 05/04/12
+  Time:     10:35    09:28    08:05    11:55    20:04  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            123L     118L     127L     124L      90L g/L       130-170
+WCC           9.2      6.6      5.8     11.3H    13.3H x10^9/L   4.0-11.0
+PLT           268      244      258      240      164  x10^9/L   140-400
+RCC          4.01L    3.83L    4.11L    3.97L    2.90L x10^12/L  4.50-5.70
+PCV          0.36L    0.35L    0.37L    0.36L    0.27L L/L       0.40-0.50
+MCV          90.5     90.4     91.1     91.5     92.3  fL        80.0-96.0
+MCH          30.7     30.8     31.0     31.2     31.1  pg        27.0-33.0
+MCHC          340      341      340      341      337  g/L       320-360
+RDW          13.5     13.1     13.1     13.0     13.0  %         11.0-15.0
+White Cell Differential
+Neut         7.5      5.4      4.2      7.7     10.6H  x10^9/L   2.0-8.0
+Lymph        0.8L     0.5L     0.8L     2.6      0.7L  x10^9/L   1.2-4.0
+Mono         0.7      0.5      0.5      0.7      0.7   x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.2      0.2      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.1      0.0   x10^9/L   0.0-0.1
+Bands                                            1.3H  x10^9/L   0.0-0.5
+
+12Z986616 05/04/12 11:55
+Comment: Mildly reduced haemoglobin level.
+
+12Z968815 05/04/12 20:04
+Film Comment : Manual differential. Mild neutrophilia with left shift.
+               Red cells show some elongated cells. Platelets appear
+               normal.
+Conclusion: Please note fall in haemoglobin since the previous
+            examination.
+            Recent tissue damage / trauma.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561577  Z561160  Z516262  Z561962  Z561166
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    10:50    12:51    15:08    16:17    20:08  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.46H    7.48H       *        *     7.48H         7.35-7.45
+pCO2              37       36       37       37       34L mmHg    35-45
+HCO3(Std)         27       27                         27  mmol/L  22.0-30.0
+Base Excess      2.8      2.8                        2.1  mmol/L  -3.0/3.0
+pO2               78       76       76       78       88  mmHg    75-100
+O2 Sat            96       96       96       96       97  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.8      4.4      3.9      3.9      4.1  mmol/L  3.5-5.5
+Sodium           140      142      143      144      141  mmol/L  135-145
+Chloride         112H     112H     110      111H     113H mmol/L  95-110
+iCa++           1.08L    1.09L    1.11L    1.11L    1.07L mmol/L  1.12-1.30
+Glucose         10.5H     9.0H     7.6      6.6      8.9H mmol/L  3.6-7.7
+Lactate          1.7      2.5H     1.6      1.6      1.9H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       118L     122L     125L     127L     128L g/L     130-170
+Reduced Hb       4.0      4.1      4.2      3.9      2.7  %       0-5
+CarbOxy Hb       0.6      0.7      0.8      0.8      0.6  %       0.5-1.5
+Meth    Hb       1.5      1.4      1.5      1.3      1.3  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516502  Z561861  Z561362  Z516264  Z561066
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    03:10    14:31    15:18    17:26    20:05  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.41     7.45     7.28L    7.43     7.43          7.35-7.45
+pCO2              43       40       24L      42       41  mmHg    35-45
+HCO3(Std)         27       28       14L      28       27  mmol/L  22.0-30.0
+Base Excess      2.8      3.6H   -14.2L     3.9H     2.8  mmol/L  -3.0/3.0
+pO2              134H     189H     131H      73L      92  mmHg    75-100
+O2 Sat            99      100       99       96       98  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.9      4.3      5.3      4.1      4.2  mmol/L  3.5-5.5
+Sodium           146H     145      142      145      143  mmol/L  135-145
+Chloride         115H     112H     108      109      110  mmol/L  95-110
+iCa++           1.13     1.10L    1.02L    1.11L    1.06L mmol/L  1.12-1.30
+Glucose          8.5H     6.6      3.4L     6.8      7.0  mmol/L  3.6-7.7
+Lactate          0.8      0.9     14.5H     0.7      0.6  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        75L      79L     103L      77L      75L g/L     130-170
+Reduced Hb       0.7      0.4      1.3      3.8      2.0  %       0-5
+CarbOxy Hb       1.2      1.4      1.6H     1.4      1.4  %       0.5-1.5
+Meth    Hb       1.0      1.8H     1.3      1.5      1.3  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+THYROID FUNCTION
+TSH                       1.55       mIU/L   ( 0.1-4.0  )
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986805
+  Date:  05/04/12
+  Time:     19:50                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            141                                      g/L       130-170
+WCC           9.7                                      x10^9/L   4.0-11.0
+PLT           204                                      x10^9/L   140-400
+RCC          4.74                                      x10^12/L  4.50-5.70
+PCV          0.41                                      L/L       0.40-0.50
+MCV          87.7                                      fL        80.0-96.0
+MCH          29.8                                      pg        27.0-33.0
+MCHC          340                                      g/L       320-360
+RDW          13.4                                      %         11.0-15.0
+White Cell Differential
+Neut         7.7                                       x10^9/L   2.0-8.0
+Lymph        1.2                                       x10^9/L   1.2-4.0
+Mono         0.8                                       x10^9/L   0.1-1.0
+Eos          0.0                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine         66     umol/L ( 64-104   )
+ (Creatinine)    0.066    mmol/L ( 0.05-0.11)
+Urea              4.3     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Calcium          2.34     mmol/L ( 2.10-2.60)
+Phosphate        0.92     mmol/L ( 0.8-1.5  )
+Magnesium        0.82     mmol/L ( 0.7-1.1  )
+Albumin            38     g/L    ( 35-50    )
+Troponin I        0.03    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763793
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              5.5
+Protein         NEGATIVE
+Specific Grav.  1.013
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    8          x10^6/L ( <2x10^6/L )
+Red Blood Cells               13         x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     +
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+10^8-10^9 cfu/L Mixed organisms including: staphylococci,
+streptococci and diphtheroid bacilli.
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561588  Z561661  Z516761  Z561665  Z561965
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    11:30    14:28    14:28    19:43    20:02  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.41        *        *        *     7.40          7.35-7.45
+pCO2              38       36       36                41  mmHg    35-45
+HCO3(Std)         24                                  25  mmol/L  22.0-30.0
+Base Excess     -0.4                                 0.7  mmol/L  -3.0/3.0
+pO2               90       90       90                76  mmHg    75-100
+O2 Sat            98       98       98                96  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.3      3.7      3.7               3.7  mmol/L  3.5-5.5
+Sodium           147H     148H     148H              148H mmol/L  135-145
+Chloride         119H     118H     118H              119H mmol/L  95-110
+iCa++           1.10L    1.10L    1.10L             1.11L mmol/L  1.12-1.30
+Glucose          8.5H     8.5H     8.5H              8.4H mmol/L  3.6-7.7
+Lactate          1.0      1.0      1.0               0.9  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        94L     101L     101L               97L g/L     130-170
+Reduced Hb       1.9      1.8      1.8               3.8  %       0-5
+CarbOxy Hb       1.9H     1.8H     1.8H              1.5  %       0.5-1.5
+Meth    Hb       1.4      1.3      1.3               1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Prothrombin Gene Mutation Analysis
+
+G20210A Substitution Result:
+
+Factor V Gene Mutation Analysis
+
+G1691A Substitution Result:
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+URINE
+Period                          ru.   Hrs
+Volume                           na   ml
+
+Urine Creatinine                7.6   mmol/L
+Urine Creatinine Excretion            mmol/D          ( 8.0-17   )
+Urine Protein                  0.12   g/L
+Urine Protein Excretion               g/D             ( <0.15    )
+Protein/Creat Ratio              16   mg/mmol Creat   ( 15-35    )
+Urine Microalbumin               43 H mg/L            ( <15      )
+Urine Microalb Excretion              ug/min          ( <20.0    )
+MicroAlb/Creat Ratio           5.66 H mg/mmol creat   ( <2.5     )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561549  Z516360  Z561163  Z561164  Z516865
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    12:27    13:39    16:22    17:26    20:00  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.30L    7.32L    7.28L    7.17L    7.31L         7.35-7.45
+pCO2              45       45       51H      50H      41  mmHg    35-45
+HCO3(Std)                                             20L mmol/L  22.0-30.0
+Base Excess     -3.7L    -3.1L    -2.3     -9.8L    -4.8L mmol/L  -3.0/3.0
+pO2              322H     110H     141H     233H     245H mmHg    75-100
+O2 Sat            97       95       98       98       99  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.9      4.0      3.9      3.7      4.2  mmol/L  3.5-5.5
+Sodium           140      138      141      144      141  mmol/L  135-145
+Chloride                                             115H mmol/L  95-110
+iCa++                                               1.07L mmol/L  1.12-1.30
+Glucose                                             10.8H mmol/L  3.6-7.7
+Lactate                                              1.0  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       117L     109L     104L      92L      94L g/L     130-170
+Reduced Hb                                           0.8  %       0-5
+CarbOxy Hb                                           0.3L %       0.5-1.5
+Meth    Hb                                           1.6H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine         51     umol/L ( 64-104   )
+ (Creatinine)    0.051    mmol/L ( 0.05-0.11)
+Urea              5.0     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            30     g/L    ( 35-50    )
+AP                224     IU/L   ( 30-120   )
+GGT               468     IU/L   ( 10-65    )
+ALT                88     IU/L   ( <45      )
+AST                77     IU/L   ( <35      )
+Bili Total        103     umol/L ( <19      )
+Protein Total      64     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z766130  Z886994  Z866826  Z968535  Z986854
+  Date:  03/04/12 04/04/12 04/04/12 05/04/12 05/04/12
+  Time:     08:41    03:45    11:10    04:45    19:40  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            111L     107L     111L      92L      86L g/L       130-170
+WCC           7.2      5.7      5.7      5.7      7.8  x10^9/L   4.0-11.0
+PLT           157      155      164      161      167  x10^9/L   140-400
+RCC          3.42L    3.34L    3.45L    2.84L    2.64L x10^12/L  4.50-5.70
+PCV          0.32L    0.32L    0.32L    0.27L    0.25L L/L       0.40-0.50
+MCV          94.3     94.2     93.7     93.8     94.6  fL        80.0-96.0
+MCH          32.5     32.0     32.3     32.5     32.5  pg        27.0-33.0
+MCHC          345      340      345      346      344  g/L       320-360
+RDW          12.3     13.1     12.8     13.2     13.3  %         11.0-15.0
+White Cell Differential
+Neut         6.0      4.5      4.3      4.5      6.7   x10^9/L   2.0-8.0
+Lymph        0.5L     0.5L     0.8L     0.5L     0.5L  x10^9/L   1.2-4.0
+Mono         0.5      0.5      0.5      0.5      0.5   x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.2      0.2      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.1      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561579  Z561261  Z516463  Z561864  Z561765
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    12:36    14:13    16:46    18:10    19:54  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.17L    7.26L    7.36     7.40     7.36          7.35-7.45
+pCO2              28L      26L      23L      21L      27L mmHg    35-45
+HCO3(Std)         11L      14L      16L      17L      17L mmol/L  22.0-30.0
+Base Excess    -17.1L   -14.4L   -11.8L   -10.8L    -9.4L mmol/L  -3.0/3.0
+pO2              161H     142H     138H     136H     306H mmHg    75-100
+O2 Sat            98       99       99      100      100  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        6.2H     5.0      5.7H     6.0H     5.6H mmol/L  3.5-5.5
+Sodium           139      142      140      141      138  mmol/L  135-145
+Chloride         110      109      107      106      107  mmol/L  95-110
+iCa++           1.02L    0.98L    0.99L    0.98L    0.97L mmol/L  1.12-1.30
+Glucose          6.9      5.2      5.3      4.4      7.4  mmol/L  3.6-7.7
+Lactate         13.9H    15.0H    12.3H    11.7H     9.3H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       101L      99L     106L     109L     108L g/L     130-170
+Reduced Hb       1.6      1.2      0.6      0.5     -0.2L %       0-5
+CarbOxy Hb       1.1      1.4      1.7H     1.8H     1.4  %       0.5-1.5
+Meth    Hb       1.3      1.2      1.0      1.2      1.1  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z986844
+      Date:  05/04/12
+      Time:     19:45                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0                                            0.8-1.3
+APTT              111H                                     secs  23-36
+Fibrinogen        3.6                                      g/L   2.0-5.0
+
+12Z968844 05/04/12 19:45
+Comment: Further testing with a heparin resistant reagent confirmed
+         the presence of heparin. Suggest repeat.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         4.0     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine         68     umol/L ( 64-104   )
+ (Creatinine)    0.068    mmol/L ( 0.05-0.11)
+Urea              3.9     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Calcium          2.30     mmol/L ( 2.10-2.60)
+Phosphate        1.17     mmol/L ( 0.8-1.5  )
+Magnesium        0.88     mmol/L ( 0.7-1.1  )
+Albumin            34     g/L    ( 35-50    )
+AP                 96     IU/L   ( 30-120   )
+GGT               102     IU/L   ( 10-65    )
+ALT                50     IU/L   ( <45      )
+AST               128     IU/L   ( <35      )
+Bili Total          8     umol/L ( <19      )
+Protein Total      65     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986844
+  Date:  05/04/12
+  Time:     19:45                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            141                                      g/L       130-170
+WCC           7.2                                      x10^9/L   4.0-11.0
+PLT           218                                      x10^9/L   140-400
+RCC          4.64                                      x10^12/L  4.50-5.70
+PCV          0.41                                      L/L       0.40-0.50
+MCV          88.8                                      fL        80.0-96.0
+MCH          30.4                                      pg        27.0-33.0
+MCHC          342                                      g/L       320-360
+RDW          13.1                                      %         11.0-15.0
+White Cell Differential
+Neut         5.0                                       x10^9/L   2.0-8.0
+Lymph        1.5                                       x10^9/L   1.2-4.0
+Mono         0.6                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+12Z968844 05/04/12 19:45
+Film Comment : Film scanned. The blood film shows no diagnostic features.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763783
+SPECIMEN
+Specimen Type : Urine Catheter Specimen
+
+
+CHEMISTRY
+pH              7.5
+Protein         TRACE
+Specific Grav.  1.013
+Blood           +++
+Glucose         NEGATIVE
+Leucocytes      +++
+
+
+MICROSCOPY
+Leucocytes                    920        x10^6/L ( <2x10^6/L )
+Red Blood Cells               6940       x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+
+1. Escherichia coli                                   >10^9 cfu/L
+
+
+SENSITIVITIES:   1
+Ciprofloxacin    S
+Cotrimoxazole    R
+Gentamicin       S
+Meropenem        S
+Nitrofurantoin   I
+Trimethoprim     R
+
+ORGANISM 1: This organism has a raised ceftazidime and/  or
+ceftriaxone MIC. This would suggest that treatment of  this
+organism with cephalosporins, aztreonam and all  penicillins
+including augmentin, tazocin and timentin  could lead to rapid
+emergence of resistance  and clinical failure.
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            142     mmol/L ( 135-145  )
+Potassium         3.8     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         67     umol/L ( 64-104   )
+ (Creatinine)    0.067    mmol/L ( 0.05-0.11)
+Urea              6.0     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+C-React Prot       24     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z916147  Z968416  Z968824
+  Date:  13/07/09 15/09/09 05/04/12
+  Time:     16:20    14:00    19:45                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            140      138      129L                   g/L       130-170
+WCC           8.4      7.2      7.8                    x10^9/L   4.0-11.0
+PLT           538H     456H     373                    x10^9/L   140-400
+RCC          4.78     4.74     4.28L                   x10^12/L  4.50-5.70
+PCV          0.41     0.41     0.37L                   L/L       0.40-0.50
+MCV          86.1     86.4     86.8                    fL        80.0-96.0
+MCH          29.3     29.1     30.1                    pg        27.0-33.0
+MCHC          341      336      347                    g/L       320-360
+RDW          12.3     12.9     12.4                    %         11.0-15.0
+Retics %     1.09                                      %         0.5-2.0
+Retics       52.1                                      x10^9/L   20-130
+White Cell Differential
+Neut         5.4      4.4      5.2                     x10^9/L   2.0-8.0
+Lymph        2.1      1.8      1.2                     x10^9/L   1.2-4.0
+Mono         0.5      0.5      1.1H                    x10^9/L   0.1-1.0
+Eos          0.3      0.4      0.3                     x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0                     x10^9/L   0.0-0.1
+
+09Z916147 13/07/09 16:20
+Film Comment : Red cells and leucocytes are unremarkable. Mild
+               thrombocytosis.
+Conclusion: ? reactive thrombocytosis. Suggest follow up FBE.
+
+09Z968416 15/09/09 14:00
+Film Comment : Platelets are frequent large. Red cell and white cell
+               morphology is unremarkable.
+Conclusion: See trephine report. Dr Lab Labfellow
+Comment: FBE with BMAT. Report to follow.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Does the patient have a previously diagnosed prostatic disease? (Y/N) N
+
+PSA                      *           \XE6\g/L    (<4.0    )
+
+Comment: The requested tests were not completed as no sample was
+         received. Ward notified.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.9     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               30     mmol/L ( 22-30    )
+Creatinine         83     umol/L ( 64-104   )
+ (Creatinine)    0.083    mmol/L ( 0.05-0.11)
+Urea              6.5     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968814
+  Date:  05/04/12
+  Time:     19:45                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            152                                      g/L       130-170
+WCC           6.8                                      x10^9/L   4.0-11.0
+PLT           203                                      x10^9/L   140-400
+RCC          5.02                                      x10^12/L  4.50-5.70
+PCV          0.44                                      L/L       0.40-0.50
+MCV          88.6                                      fL        80.0-96.0
+MCH          30.2                                      pg        27.0-33.0
+MCHC          341                                      g/L       320-360
+RDW          12.1                                      %         11.0-15.0
+White Cell Differential
+Neut         3.7                                       x10^9/L   2.0-8.0
+Lymph        2.3                                       x10^9/L   1.2-4.0
+Mono         0.6                                       x10^9/L   0.1-1.0
+Eos          0.2                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+         Patient ID/Specimen/Reporting Errors
+** This Test Is For Laboratory Statistical Use Only **
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Albumin             *     g/L    ( 35-50    )
+AP                  *     IU/L   ( 30-120   )
+GGT                 *     IU/L   ( 10-65    )
+ALT                 *     IU/L   ( <34      )
+AST                 *     IU/L   ( <31      )
+Bili Total          *     umol/L ( <19      )
+Protein Total       *     g/L    ( 65-85    )
+
+Comment: The requested tests were not completed as no
+         sample was  received.Lfts added to Z968840.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968893
+      Date:  05/04/12
+      Time:     19:40                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0                                            0.8-1.3
+APTT               30                                      secs  23-36
+Fibrinogen        3.4                                      g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            132     mmol/L ( 135-145  )
+Potassium           *     mmol/L ( 3.5-5.5  )
+Chloride           96     mmol/L ( 95-110   )
+HCO3               22     mmol/L ( 22-30    )
+Creatinine        116     umol/L ( 49-90    )
+ (Creatinine)    0.116    mmol/L ( 0.05-0.09)
+Urea              9.3     mmol/L ( 2.5-8.3  )
+ eGFR             41             ( SEE-BELOW)
+Albumin            38     g/L    ( 35-50    )
+AP                107     IU/L   ( 30-120   )
+GGT               187     IU/L   ( 10-65    )
+ALT                32     IU/L   ( <34      )
+AST                 *     IU/L   ( <31      )
+Bili Total          *     umol/L ( <19      )
+Protein Total      74     g/L    ( 65-85    )
+Troponin I       <0.02    ug/L   (See Below )
+CK                811     IU/L   ( <145     )
+
+Comment: Haemolysed. Some tests (*) unavailable.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z256564  Z368815  Z965898  Z936275  Z968804
+  Date:  24/03/12 25/03/12 26/03/12 27/03/12 05/04/12
+  Time:     10:45    10:15    08:15    09:10    19:40  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            116      119      117      106L       *  g/L       115-150
+WCC          11.7H    11.6H     9.5      9.9           x10^9/L   4.0-11.0
+PLT           578H     677H     674H     649H       *  x10^9/L   140-400
+RCC          3.99     4.18     4.04     3.69L          x10^12/L  3.80-5.10
+PCV          0.34L    0.36     0.34L    0.31L          L/L       0.35-0.45
+MCV          84.3     84.9     84.2     83.8           fL        80.0-96.0
+MCH          29.0     28.5     29.0     28.7           pg        27.0-33.0
+MCHC          343      336      344      343           g/L       320-360
+RDW          13.8     13.6     13.9     13.9           %         11.0-15.0
+White Cell Differential
+Neut         8.9H     8.9H     6.7      7.5            x10^9/L   2.0-8.0
+Lymph        1.5      1.4      1.8      1.3            x10^9/L   1.2-4.0
+Mono         0.9      1.0      0.8      0.9            x10^9/L   0.1-1.0
+Eos          0.3      0.2      0.2      0.1            x10^9/L   0.0-0.5
+Baso         0.1      0.1      0.0      0.0            x10^9/L   0.0-0.1
+
+12Z368815 25/03/12 10:15
+Comment: Note moderate thrombocytosis. ? reactive.
+         Instrument differential and parameters reported.
+
+12Z986804 05/04/12 19:40
+Comment: * Specimen clotted. ED informed.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516535  Z561588  Z561661  Z516761  Z561665
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    08:12    11:30    14:28    14:28    19:43  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.42     7.41        *        *        *          7.35-7.45
+pCO2              36       38       36       36           mmHg    35-45
+HCO3(Std)         24       24                             mmol/L  22.0-30.0
+Base Excess     -0.6     -0.4                             mmol/L  -3.0/3.0
+pO2               84       90       90       90           mmHg    75-100
+O2 Sat            98       98       98       98           %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.0      4.3      3.7      3.7           mmol/L  3.5-5.5
+Sodium           146H     147H     148H     148H          mmol/L  135-145
+Chloride         120H     119H     118H     118H          mmol/L  95-110
+iCa++           1.10L    1.10L    1.10L    1.10L          mmol/L  1.12-1.30
+Glucose          8.9H     8.5H     8.5H     8.5H          mmol/L  3.6-7.7
+Lactate          0.9      1.0      1.0      1.0           mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        94L      94L     101L     101L          g/L     130-170
+Reduced Hb       2.3      1.9      1.8      1.8           %       0-5
+CarbOxy Hb       1.9H     1.9H     1.8H     1.8H          %       0.5-1.5
+Meth    Hb       0.7      1.4      1.3      1.3           %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z860538
+SPECIMEN
+Specimen Type : Biopsy
+Description   : Left Lateral Foot
+
+
+
+
+MICROSCOPY
+
+
+GRAM STAIN
+Leucocytes                       +
+Epithelial Cells                 +
+No organisms seen
+
+
+
+CULTURE
+No Growth After 2 Days.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z768114  Z816561  Z968883
+      Date:  08/02/10 11/02/10 05/04/12
+      Time:     18:00    08:08    19:28                   Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0      1.1      1.0                          0.8-1.3
+APTT                        27       26                    secs  23-36
+Fibrinogen                 3.4      3.5                    g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          103     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         90     umol/L ( 64-104   )
+ (Creatinine)    0.090    mmol/L ( 0.05-0.11)
+Urea              4.3     mmol/L ( 2.5-8.3  )
+ eGFR             80             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z861419  Z863387  Z476650  Z269106  Z968883
+  Date:  12/02/10 25/02/10 15/04/10 29/07/10 05/04/12
+  Time:     08:13    15:24    14:38    14:25    19:28  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            144      137      130      150      146  g/L       130-170
+WCC          10.3      9.8      7.0      7.1     15.0H x10^9/L   4.0-11.0
+PLT           190      215      204      200      225  x10^9/L   140-400
+RCC          4.91     4.63     4.32L    5.02     4.81  x10^12/L  4.50-5.70
+PCV          0.43     0.41     0.38L    0.44     0.44  L/L       0.40-0.50
+MCV          88.0     87.5     87.7     88.3     90.4  fL        80.0-96.0
+MCH          29.3     29.6     30.0     29.9     30.3  pg        27.0-33.0
+MCHC          333      339      343      338      335  g/L       320-360
+RDW          13.5     13.8     14.6     14.0     15.2H %         11.0-15.0
+White Cell Differential
+Neut         2.8      6.3      3.8      4.6     12.7H  x10^9/L   2.0-8.0
+Lymph        6.3H     2.3      2.3      1.7      1.5   x10^9/L   1.2-4.0
+Mono         0.9      0.9      0.5      0.6      0.6   x10^9/L   0.1-1.0
+Eos          0.1      0.2      0.4      0.2      0.2   x10^9/L   0.0-0.5
+Baso         0.1      0.1      0.1      0.0      0.1   x10^9/L   0.0-0.1
+
+12Z986883 05/04/12 19:28
+Comment: Please note mild neutrophilia
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+HISTOPATHOLOGY
+Lab No: 2021X023532
+
+CLINICAL NOTES:
+
+?Viral (illegible) ?Early EM. Widespread erythematous plaque.
+
+MACROSCOPIC DESCRIPTION:
+
+"Biopsy back": Two punch biopsies each 3mm across and 3mm deep.  A1.
+(TJB)
+
+MICROSCOPIC DESCRIPTION:
+
+
+
+DIAGNOSIS:
+
+
+Pathologist: To Follow
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+HISTOPATHOLOGY
+Lab No: 2021X023531
+
+CLINICAL NOTES:
+
+Shave biopsy (L) nose ?BCC ?(illegible) papule of the nose.
+
+MACROSCOPIC DESCRIPTION:
+
+"Shave biopsy nose": A white shaving of skin with a raised white
+nodule and brown top all measuring 6x5x2mm.  Specimen bisected, A1.
+(TJB)
+
+MICROSCOPIC DESCRIPTION:
+
+
+
+DIAGNOSIS:
+
+
+Pathologist: To Follow
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z361399  Z968863
+      Date:  13/03/12 05/04/12
+      Time:     14:20    19:24                            Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.3      1.3                                   0.8-1.3
+APTT               28                                      secs  23-36
+Fibrinogen        4.8                                      g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            135     mmol/L ( 135-145  )
+Potassium         4.4     mmol/L ( 3.5-5.5  )
+Chloride          100     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine        104     umol/L ( 64-104   )
+ (Creatinine)    0.104    mmol/L ( 0.05-0.11)
+Urea              8.6     mmol/L ( 2.5-8.3  )
+ eGFR             58             ( SEE-BELOW)
+Albumin            24     g/L    ( 35-50    )
+AP                172     IU/L   ( 30-120   )
+GGT                59     IU/L   ( 10-65    )
+ALT                22     IU/L   ( <45      )
+AST                27     IU/L   ( <35      )
+Bili Total         84     umol/L ( <19      )
+Protein Total      62     g/L    ( 65-85    )
+C-React Prot      109     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z965662  Z361399  Z986863
+  Date:  28/04/11 13/03/12 05/04/12
+  Time:     12:30    14:20    19:24                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            148      116L     110L                   g/L       130-170
+WCC           7.4     10.1     14.0H                   x10^9/L   4.0-11.0
+PLT           223      274      305                    x10^9/L   140-400
+RCC          4.65     3.59L    3.39L                   x10^12/L  4.50-5.70
+PCV          0.42     0.33L    0.32L                   L/L       0.40-0.50
+MCV          91.6     90.9     93.3                    fL        80.0-96.0
+MCH          31.9     32.4     32.5                    pg        27.0-33.0
+MCHC          348      356      348                    g/L       320-360
+RDW          14.5     16.5H    15.4H                   %         11.0-15.0
+White Cell Differential
+Neut         5.5      7.8     11.4H                    x10^9/L   2.0-8.0
+Lymph        1.2      1.1L     1.2                     x10^9/L   1.2-4.0
+Mono         0.6      1.0      1.2H                    x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.0                     x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.1                     x10^9/L   0.0-0.1
+Bands                 0.2                              x10^9/L   0.0-0.5
+
+12Z361399 13/03/12 14:20
+Film Comment : Red cells show numerous target cells and moderate
+               anisocytosis. Manual differential. Platelets are
+               plentiful.
+Conclusion: Suggestive of liver dysfunction.
+
+12Z968863 05/04/12 19:24
+Comment: Please note mild neutrophilia and mild monocytosis
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+URINE
+Period                          ru.   Hrs
+Volume                           na   ml
+
+Urine Creatinine                3.0   mmol/L
+Urine Creatinine Excretion            mmol/D          ( 7-13     )
+Urine Protein                  0.57   g/L
+Urine Protein Excretion               g/D             ( <0.15    )
+Protein/Creat Ratio             190 H mg/mmol Creat   ( 15-35    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+HISTOPATHOLOGY
+Lab No: 2021X023528
+
+CLINICAL NOTES:
+
+2 x punch biopsy (L) lateral foot. ?Immune mediated vasculitis.
+Known endocarditis vasculitic rash post x 1.  ?Septic emboli.
+?Thrombotic vasculitis.
+
+MACROSCOPIC DESCRIPTION:
+
+"Biopsy left foot": A 3mm core of skin 3mm deep.  A1.  (TJB)
+
+MICROSCOPIC DESCRIPTION:
+
+
+
+DIAGNOSIS:
+
+
+Pathologist: To Follow
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+ISSUED PRODUCT REPORT
+
+
+Product Issued:   Intragam P 12g 200mL
+Product Batch:    4740600000
+Product Quantity: 3
+Date/Time Issued: 05/04/2010 19:28
+
+Product administered by: __________________________________________
+Date administered      : __________________________________________
+Time administered      : __________________________________________
+
+Product Issued:   Intragam P 3g 50mL
+Product Batch:    4740500001
+Product Quantity: 1
+Date/Time Issued: 05/04/2010 19:28
+
+Product administered by: __________________________________________
+Date administered      : __________________________________________
+Time administered      : __________________________________________
+
+Products must be administered immediately upon receipt, or returned to
+the Blood Bank.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516565
+      Date: 05/04/12                                              Arterial
+      Time:    19:20                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.32L                                             7.35-7.45
+pCO2              59H                                     mmHg    35-45
+Base Excess      4.1H                                     mmol/L  -3.0/3.0
+pO2               33L                                     mmHg    75-100
+O2 Sat            57L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.0                                      mmol/L  3.5-5.5
+Sodium           139                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       151                                      g/L     130-170
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Calcium          1.55     mmol/L ( 2.10-2.60)
+Phosphate        1.28     mmol/L ( 0.8-1.5  )
+Magnesium        0.95     mmol/L ( 0.7-1.1  )
+Albumin            22     g/L    ( 35-50    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763773
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              5.5
+Protein         NEGATIVE
+Specific Grav.  1.010
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    3          x10^6/L ( <2x10^6/L )
+Red Blood Cells               2          x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+Red blood cell count unreliable due to low specific gravity.
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+10^8 cfu/L Mixed organisms including: staphylococci, streptococci
+and diphtheroid bacilli.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968503  Z968694  Z986770  Z968745  Z968803
+      Date:  05/04/12 05/04/12 05/04/12 05/04/12 05/04/12
+      Time:     06:00    11:25    14:57    17:00    19:00 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1      1.1                                   0.8-1.3
+APTT              104H      55H      44H       *       67H secs  23-36
+Fibrinogen        4.3      4.3                             g/L   2.0-5.0
+
+12Z986803 05/04/12 19:00
+Comment: Further testing with a heparin resistant reagent confirmed
+         the presence of heparin. Please indicate anticoagulant
+         therapy on request form.
+
+12Z968745 05/04/12 17:00
+Comment: * Insufficient specimen to perform APTT. Ward informed.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+ISSUED PRODUCT REPORT
+
+
+Product Issued:   Kiovig 20g 200mL
+Product Batch:    LE12M354AC
+Product Quantity: 1
+Date/Time Issued: 05/04/2010 09:18
+
+Product administered by: __________________________________________
+Date administered      : __________________________________________
+Time administered      : __________________________________________
+
+Product Issued:   Kiovig 10g 100mL
+Product Batch:    LE12L001AC
+Product Quantity: 1
+Date/Time Issued: 05/04/2010 09:18
+
+Product administered by: __________________________________________
+Date administered      : __________________________________________
+Time administered      : __________________________________________
+
+Products must be administered immediately upon receipt, or returned to
+the Blood Bank.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z461110  Z516465
+      Date: 28/03/12 05/04/12                                     Arterial
+      Time:    19:21    19:11                             Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0                             Deg. C
+pH              7.42     7.38                                     7.35-7.45
+pCO2              36       33L                            mmHg    35-45
+Base Excess     -0.5     -5.1L                            mmol/L  -3.0/3.0
+pO2               80       86                             mmHg    75-100
+O2 Sat            96       96                             %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.2      6.0H                            mmol/L  3.5-5.5
+Sodium           138      132L                            mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       100L      93L                            g/L     115-150
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               28     mmol/L ( 22-30    )
+Creatinine         59     umol/L ( 64-104   )
+ (Creatinine)    0.059    mmol/L ( 0.05-0.11)
+Urea              3.5     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Calcium          2.09     mmol/L ( 2.10-2.60)
+Phosphate        1.62     mmol/L ( 0.8-1.5  )
+Magnesium        0.73     mmol/L ( 0.7-1.1  )
+Albumin            30     g/L    ( 35-50    )
+Troponin I        0.70    ug/L   (See Below )
+CK                247     IU/L   ( <175     )
+CKMB Mass            *    ug/L   ( <4       )
+C-React Prot      166     mg/L   ( <5       )
+
+Comment: The CKMB was not measured on this sample. It has
+         been  replaced by Troponin.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z860270  Z886554  Z968892
+  Date:  22/02/12 03/04/12 05/04/12
+  Time:     08:10    11:45    18:55                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            155      134       99L                   g/L       130-170
+WCC           9.8      7.5      8.9                    x10^9/L   4.0-11.0
+PLT           232      220      165                    x10^9/L   140-400
+RCC          5.39     4.53     3.44L                   x10^12/L  4.50-5.70
+PCV          0.46     0.40     0.30L                   L/L       0.40-0.50
+MCV          85.3     87.3     86.4                    fL        80.0-96.0
+MCH          28.7     29.5     28.8                    pg        27.0-33.0
+MCHC          336      337      333                    g/L       320-360
+RDW          14.1     14.6     14.8                    %         11.0-15.0
+White Cell Differential
+Neut         7.4      4.9      7.6                     x10^9/L   2.0-8.0
+Lymph        1.7      2.0      0.6L                    x10^9/L   1.2-4.0
+Mono         0.5      0.5      0.6                     x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.0                     x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0                     x10^9/L   0.0-0.1
+
+12Z968892 05/04/12 18:55
+Comment: Please note fall in haemoglobin and platelet count since
+         the previous examination. Post CAGS.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+FLT3 Mutation Analysis
+
+Internal Tandem Duplication (ITD):
+
+FLT3 ITD Allelic Ratio:
+
+Tyrosine Kinase Domain 2 (TK2) Result:
+
+Nucleophosmin (NPM1) Gene Mutation Analysis
+
+Exon 12 Indel Result:
+
+Comment
+
+CCAAT/Enhancer Binding Protein Alpha (C/EBPA) Gene Mutation Analysis
+
+CEBPA Result:
+
+Comment
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561564  Z516576  Z561361  Z561663  Z516365
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    06:54    09:27    14:18    17:00    19:04  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.48H    7.50H       *     7.51H       *          7.35-7.45
+pCO2              37       36       31L      34L      34L mmHg    35-45
+HCO3(Std)         28       29                28           mmol/L  22.0-30.0
+Base Excess      4.1H     4.5H              3.7H          mmol/L  -3.0/3.0
+pO2               76       90       86       89       86  mmHg    75-100
+O2 Sat            96       98       98       98       97  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        3.7      4.2      3.8      4.2      3.8  mmol/L  3.5-5.5
+Sodium           142      142      140      141      141  mmol/L  135-145
+Chloride         109      109      107      108      106  mmol/L  95-110
+iCa++           1.12     1.11L    1.09L    1.09L    1.12  mmol/L  1.12-1.30
+Glucose          7.1      5.9     13.0H    13.4H    12.6H mmol/L  3.6-7.7
+Lactate          0.9      1.0      1.0      1.5      1.4  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        90L      94L      92L      88L      88L g/L     130-170
+Reduced Hb       3.7      1.8      2.2      2.2      2.6  %       0-5
+CarbOxy Hb       1.2      1.1      1.3      1.3      1.3  %       0.5-1.5
+Meth    Hb       1.2      1.0      1.5      1.2      1.4  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z964790  Z665812  Z566826  Z467914  Z968872
+      Date:  02/10/05 09/10/05 16/10/05 19/10/05 05/04/12
+      Time:     19:00    18:50    17:28    05:15    18:50 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1      1.1      1.1      1.1      2.6H       0.8-1.3
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Troponin I           *    ug/L   (See Below )
+
+Comment: A troponin has been measured for this patient in
+         recent  hours. If chest pain is ongoing, a
+         repeat troponin  should not be done till at
+         least 4 hours after the  last one.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+  Request No:  Z868702  Z868897  Z986862
+        Date: 03/04/12 04/04/12 05/04/12                          Therapeut
+        Time:    18:40    02:10    18:45                   Units    Range
+              -------- -------- -------- -------- -------- ------ ---------
+PLASMA
+Carbamazepine       44                                     umol/L 20-50
+Hrs Since Dose No Info                                     HH:MM
+
+WHOLE BLOOD
+Cyclosporin                 113      384                   ng/mL  AS-BELOW
+Hrs Since Dose          No Info    02:00                   HH:MM
+
+* Note Cyclosporin Method Change. *
+  From 26/07/2010 Cyclosporin is measured on an ADVIA Centaur
+  Results will be approx 15% lower than previously
+        Tentative Pre-dose therapeutic range:
+           80-320 ng/ml
+        Trial 2hr Post-dose therapeutic range:
+          900-1400 ng/ml (Mth 0-1)
+          800-1200 ng/ml (Mth 1-6)
+          800-1000 ng/ml (Mth  >6)
+        Cyclosporin levels vary widely, depending on drug
+        therapy.  These ranges should be used as a guide only.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z360130  Z306741  Z564088  Z666062  Z986852
+      Date:  25/04/07 27/04/07 02/04/12 04/04/12 05/04/12
+      Time:     19:00    06:00    15:25    09:10    18:58 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1      1.1      1.0      1.0      1.2        0.8-1.3
+APTT                                 29       28       26  secs  23-36
+Fibrinogen                          4.0      3.9      2.4  g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.0     mmol/L ( 3.5-5.5  )
+Chloride          109     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine         64     umol/L ( 49-90    )
+ (Creatinine)    0.064    mmol/L ( 0.05-0.09)
+Urea              7.1     mmol/L ( 2.5-8.3  )
+ eGFR             81             ( SEE-BELOW)
+Calcium          1.88     mmol/L ( 2.10-2.60)
+Phosphate        0.77     mmol/L ( 0.8-1.5  )
+Magnesium        1.45     mmol/L ( 0.8-1.0  )
+Albumin            25     g/L    ( 35-50    )
+AP                 68     IU/L   ( 30-120   )
+GGT               119     IU/L   ( 10-65    )
+ALT                42     IU/L   ( <34      )
+AST                72     IU/L   ( <31      )
+Bili Total         18     umol/L ( <19      )
+Protein Total      47     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z360130  Z546088  Z666062  Z968852
+  Date:  25/04/07 02/04/12 04/04/12 05/04/12
+  Time:     19:00    15:25    09:10    18:58           Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            133      124      118      103L          g/L       115-150
+WCC           6.7      8.3      7.0     10.4           x10^9/L   4.0-11.0
+PLT           284      258      236      132L          x10^9/L   140-400
+RCC          4.22     3.91     3.71L    3.29L          x10^12/L  3.80-5.10
+PCV          0.38     0.36     0.34L    0.30L          L/L       0.35-0.45
+MCV          90.3     91.4     91.2     92.4           fL        80.0-96.0
+MCH          31.5     31.6     31.7     31.4           pg        27.0-33.0
+MCHC          349      346      348      340           g/L       320-360
+RDW          12.7     13.9     14.3     14.1           %         11.0-15.0
+White Cell Differential
+Neut         3.8      5.1      5.4      9.2H           x10^9/L   2.0-8.0
+Lymph        2.1      2.1      1.0L     0.6L           x10^9/L   1.2-4.0
+Mono         0.5      0.8      0.3      0.5            x10^9/L   0.1-1.0
+Eos          0.3      0.4      0.3      0.1            x10^9/L   0.0-0.5
+Baso         0.1      0.1      0.0      0.0            x10^9/L   0.0-0.1
+
+12Z986852 05/04/12 18:58
+Comment: Please note fall in haemoglobin and platelet count since
+         the previous examination. Post MVR.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+No Test Requested
+NTRC
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.4     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine         72     umol/L ( 49-90    )
+ (Creatinine)    0.072    mmol/L ( 0.05-0.09)
+Urea              8.4     mmol/L ( 2.5-8.3  )
+ eGFR             66             ( SEE-BELOW)
+Calcium          2.38     mmol/L ( 2.10-2.60)
+Phosphate        1.26     mmol/L ( 0.8-1.5  )
+Magnesium        0.84     mmol/L ( 0.8-1.0  )
+Albumin            34     g/L    ( 35-50    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z476146  Z968842
+  Date:  22/09/10 05/04/12
+  Time:     17:05    18:30                             Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            116      119                             g/L       115-150
+WCC           6.5      9.0                             x10^9/L   4.0-11.0
+PLT           229      235                             x10^9/L   140-400
+RCC          3.75L    3.84                             x10^12/L  3.80-5.10
+PCV          0.33L    0.34L                            L/L       0.35-0.45
+MCV          88.1     89.4                             fL        80.0-96.0
+MCH          31.0     31.0                             pg        27.0-33.0
+MCHC          352      347                             g/L       320-360
+RDW          13.2     13.6                             %         11.0-15.0
+White Cell Differential
+Neut         4.4      7.2                              x10^9/L   2.0-8.0
+Lymph        1.4      1.2                              x10^9/L   1.2-4.0
+Mono         0.5      0.6                              x10^9/L   0.1-1.0
+Eos          0.1      0.1                              x10^9/L   0.0-0.5
+Baso         0.0      0.0                              x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366391
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Drugs of Abuse Screen (Urine)
+
+Ampht-TypeSubst              Negative
+Benzodiazepines              Negative
+Cannabinoids                 Negative
+Opiates                      Negative
+Cocaine
+Barbiturates
+Methadone
+TCA
+
+
+General Comments:
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z996558
+SPECIMEN
+Specimen Type : Sputum
+
+
+MICROSCOPY
+
+GRAM STAIN
+Macroscopic Description                   Mucopurulent
+Pus:Epithelial Cell Ratio                 >25:10
+Pus Cells                                 +++
+Squamous Epithelial Cells                 Occasional
+Gram positive cocci                       +
+Gram positive bacilli                     Occasional
+
+
+
+
+
+CULTURE
+
+Standard culture:   +++  Mixed upper respiratory tract flora
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z886371  Z868965  Z968069  Z986477  Z968802
+  Date:  03/04/12 04/04/12 04/04/12 05/04/12 05/04/12
+  Time:     02:50    05:25    12:30    02:55    17:45  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             89L      96L     100L      83L      94L g/L       130-170
+WCC           2.4L     2.9L     2.6L     2.0L     3.1L x10^9/L   4.0-11.0
+PLT            21L       7L      32L      17L      41L x10^9/L   140-400
+RCC          2.71L    3.00L    3.07L    2.60L    2.90L x10^12/L  4.50-5.70
+PCV          0.25L    0.27L    0.28L    0.24L    0.27L L/L       0.40-0.50
+MCV          92.2     90.6     90.9     91.8     91.5  fL        80.0-96.0
+MCH          32.7     32.1     32.5     31.9     32.2  pg        27.0-33.0
+MCHC          355      354      358      347      352  g/L       320-360
+RDW          15.7H    15.2H    15.4H    15.3H    15.0  %         11.0-15.0
+White Cell Differential
+Neut         2.1      2.0      2.4      1.5L           x10^9/L   2.0-8.0
+Lymph        0.1L     0.1L     0.1L     0.0L           x10^9/L   1.2-4.0
+Mono         0.1      0.3      0.1      0.1            x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.0      0.0            x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0            x10^9/L   0.0-0.1
+Bands                 0.5               0.3            x10^9/L   0.0-0.5
+Meta                  0.1H                             x10^9/L   0.0
+Myelo                                   0.0            x10^9/L   0.0
+NRBC                                       2H          /100WBCs  0
+NRBC Abs                                0.0            x10^9/L   0
+
+12Z868965 04/04/12 05:25
+Film Comment : Marked thrombocytopenia. Neutrophils show a moderate left
+               shift and mild toxic changes. Manual differential.
+               Red cells show no significant changes - see previous
+               report.
+Conclusion: Known CMML -> AML. Please note fall in platelet count
+            since the last examination. ? Therapy related.
+
+12Z986477 05/04/12 02:55
+Film Comment : Moderate anaemia with red cells showing occasional target
+               cells and polychromatic macrocytes. Platelets are markedly
+               reduced in number. White cells show a mild neutropenia
+               with a mild left shift showing mild toxic changes.
+Conclusion: History of Bone Marrow Transplant for CMML -> AML. Please
+            note mild fall in haemoglobin since the last examination.
+            Manual differential.
+
+12Z968802 05/04/12 17:45
+Comment: Post platelet increment
+         Instrument parameters reported.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Amylase           527     IU/L   ( 22-100   )
+Lipase            741     IU/L   ( <60      )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         3.8     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               21     mmol/L ( 22-30    )
+Creatinine        110     umol/L ( 64-104   )
+ (Creatinine)    0.110    mmol/L ( 0.05-0.11)
+Urea             10.1     mmol/L ( 2.5-8.3  )
+ eGFR             57             ( SEE-BELOW)
+Calcium          2.16     mmol/L ( 2.10-2.60)
+Phosphate        1.31     mmol/L ( 0.8-1.5  )
+Magnesium        0.82     mmol/L ( 0.7-1.1  )
+Albumin            27     g/L    ( 35-50    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z167899  Z868451  Z586852  Z367717  Z968861
+  Date:  02/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     10:00    06:20    11:39    08:00    17:45  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             86L      85L      82L      87L      77L g/L       130-170
+WCC           6.4      5.9      6.0      6.0      4.9  x10^9/L   4.0-11.0
+PLT           101L     112L     131L     155      150  x10^9/L   140-400
+RCC          2.69L    2.73L    2.60L    2.89L    2.49L x10^12/L  4.50-5.70
+PCV          0.24L    0.25L    0.23L    0.26L    0.22L L/L       0.40-0.50
+MCV          90.0     90.5     90.1     89.9     90.4  fL        80.0-96.0
+MCH          32.0     31.1     31.5     30.0     30.8  pg        27.0-33.0
+MCHC          356      344      349      334      341  g/L       320-360
+RDW          14.9     14.8     14.8     14.6     14.3  %         11.0-15.0
+ESR                   >140H     135H                   mm in 1hr 2-14
+White Cell Differential
+Neut         4.7      4.8      5.0      5.2      3.7   x10^9/L   2.0-8.0
+Lymph        1.1L     0.8L     0.7L     0.6L     0.9L  x10^9/L   1.2-4.0
+Mono         0.4      0.3      0.2      0.2      0.3   x10^9/L   0.1-1.0
+Eos          0.1      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+12Z176899 02/04/12 10:00
+Comment: Please note mild fall in haemoglobin since the previous
+         examination. Please note: no clinical details given.
+
+12Z868451 03/04/12 06:20
+Comment: Instrument differential and parameters reported.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z868595  Z968157  Z986851
+  Date:  03/04/12 04/04/12 05/04/12
+  Time:     12:10    15:45    18:00                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            155      139      129L                   g/L       130-170
+WCC          10.3     11.5H    15.4H                   x10^9/L   4.0-11.0
+PLT           290      301      291                    x10^9/L   140-400
+RCC          4.85     4.29L    4.01L                   x10^12/L  4.50-5.70
+PCV          0.44     0.39L    0.37L                   L/L       0.40-0.50
+MCV          91.5     91.5     91.6                    fL        80.0-96.0
+MCH          32.0     32.5     32.1                    pg        27.0-33.0
+MCHC          349      355      351                    g/L       320-360
+RDW          12.5     13.1     12.9                    %         11.0-15.0
+White Cell Differential
+Neut         7.0      7.9     14.3H                    x10^9/L   2.0-8.0
+Lymph        2.1      2.6      0.3L                    x10^9/L   1.2-4.0
+Mono         0.8      0.7      0.2                     x10^9/L   0.1-1.0
+Eos          0.3      0.3      0.0                     x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.0                     x10^9/L   0.0-0.1
+Bands                          0.5                     x10^9/L   0.0-0.5
+Meta                           0.2H                    x10^9/L   0.0
+
+12Z968851 05/04/12 18:00
+Film Comment : Manual differential. Mild neutrophilia with slight left
+               shift. Red cells and platelets appear normal.
+Conclusion: ? Post-op.
+            No clinical information provided.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561531  Z561573  Z516506  Z561558  Z561265
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    02:06    05:48    08:52    11:25    18:54  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.38     7.38     7.40     7.32L    7.34L         7.35-7.45
+pCO2              39       40       35       42       41  mmHg    35-45
+HCO3(Std)         23       23       22       21L      22  mmol/L  22.0-30.0
+Base Excess     -1.7     -1.6     -2.9     -3.9L    -3.0  mmol/L  -3.0/3.0
+pO2              105H      92      124H     191H      78  mmHg    75-100
+O2 Sat            98       97       99       99       95  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.1      3.8      3.7      3.6      3.8  mmol/L  3.5-5.5
+Sodium           141      141      140      141      141  mmol/L  135-145
+Chloride         112H     114H     114H     113H     109  mmol/L  95-110
+iCa++           1.11L    1.07L    1.07L    1.08L    1.09L mmol/L  1.12-1.30
+Glucose          5.3      5.3      5.6      5.7      8.1H mmol/L  3.6-7.7
+Lactate          0.4      0.4      0.4      0.4      0.8  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       114L     115      117      119      124  g/L     115-150
+Reduced Hb       1.9      3.2      1.2      0.7      4.9  %       0-5
+CarbOxy Hb       0.9      0.8      0.9      0.8      1.0  %       0.5-1.5
+Meth    Hb       1.7H     1.8H     1.4      1.8H     2.0H %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+No Test Requested
+NTRS
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+  Request No:  Z168394  Z168607  Z866625  Z968841
+        Date: 17/03/12 17/03/12 19/03/12 05/04/12                 Therapeut
+        Time:    06:20    20:20    20:45    18:46          Units    Range
+              -------- -------- -------- -------- -------- ------ ---------
+PLASMA
+Phenytoin           60                37L      23L         umol/L 40-80
+Hrs Since Dose No Info           No Info  No Info          HH:MM
+Vancomycin                   11                            mg/L   AS-BELOW
+Hrs Since Dose          No Info                            HH:MM
+
+VANCOMYCIN THERAPEUTIC RANGE
+Pre Dose (Trough) level: 10 - 20 mg/L
+Post Dose (Peak) level : Not recommended
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         4.4     mmol/L ( 3.5-5.5  )
+Chloride          101     mmol/L ( 95-110   )
+HCO3               29     mmol/L ( 22-30    )
+Creatinine         57     umol/L ( 49-90    )
+ (Creatinine)    0.057    mmol/L ( 0.05-0.09)
+Urea              3.9     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            32     g/L    ( 35-50    )
+AP                129     IU/L   ( 30-120   )
+GGT               264     IU/L   ( 10-65    )
+ALT                55     IU/L   ( <34      )
+AST                30     IU/L   ( <31      )
+Bili Total         <5     umol/L ( <19      )
+Protein Total      69     g/L    ( 65-85    )
+C-React Prot       19     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z168607  Z186804  Z866625  Z866706  Z986841
+  Date:  17/03/12 18/03/12 19/03/12 20/03/12 05/04/12
+  Time:     20:20    06:40    20:45    01:30    18:46  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            114L     110L     112L     112L     118  g/L       115-150
+WCC          15.2H    13.7H    10.2     10.1      3.8L x10^9/L   4.0-11.0
+PLT           249      248      290      306      255  x10^9/L   140-400
+RCC          3.73L    3.65L    3.69L    3.67L    3.91  x10^12/L  3.80-5.10
+PCV          0.33L    0.33L    0.33L    0.33L    0.35  L/L       0.35-0.45
+MCV          89.6     90.5     88.9     89.4     88.7  fL        80.0-96.0
+MCH          30.6     30.2     30.4     30.5     30.2  pg        27.0-33.0
+MCHC          341      333      342      341      340  g/L       320-360
+RDW          12.6     12.4     12.6     12.2     13.0  %         11.0-15.0
+White Cell Differential
+Neut        13.5H    12.2H     7.5      8.4H     2.6   x10^9/L   2.0-8.0
+Lymph        0.7L     0.8L     1.8      1.1L     0.5L  x10^9/L   1.2-4.0
+Mono         1.0      0.7      0.8      0.5      0.6   x10^9/L   0.1-1.0
+Eos          0.0      0.0      0.0      0.0      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.1      0.0      0.0   x10^9/L   0.0-0.1
+
+12Z168607 17/03/12 20:20
+Comment: Note: mild neutrophilia. Instrument differential and
+         parameters reported.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z736763
+SPECIMEN
+Specimen Type : Urine Midstream
+
+
+CHEMISTRY
+pH              6.5
+Protein         NEGATIVE
+Specific Grav.  1.026
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      NEGATIVE
+
+
+MICROSCOPY
+Leucocytes                    1          x10^6/L ( <2x10^6/L )
+Red Blood Cells               Nil        x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+No Growth -Detection limit 10^7 CFU/L
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z686947  Z868416  Z968183  Z986440  Z968821
+      Date:  17/01/12 03/04/12 04/04/12 05/04/12 05/04/12
+      Time:     10:55    08:15    13:53    01:00    18:49 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.2      1.1      1.5H     1.3      1.4H       0.8-1.3
+APTT               30       27       33       35       35  secs  23-36
+Fibrinogen        6.4H     4.8      1.9L     2.3      4.2  g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         5.2     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               24     mmol/L ( 22-30    )
+Creatinine         93     umol/L ( 49-90    )
+ (Creatinine)    0.093    mmol/L ( 0.05-0.09)
+Urea              6.4     mmol/L ( 2.5-8.3  )
+ eGFR             53             ( SEE-BELOW)
+Calcium          1.94     mmol/L ( 2.10-2.60)
+Phosphate        1.44     mmol/L ( 0.8-1.5  )
+Magnesium        1.12     mmol/L ( 0.8-1.0  )
+Albumin            20     g/L    ( 35-50    )
+Troponin I        7.09    ug/L   (See Below )
+CKMB Mass            *    ug/L   ( <4       )
+
+Comment: The CKMB was not measured on this sample. It has
+         been  replaced by Troponin
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z086981  Z868416  Z968183  Z986440  Z968821
+  Date:  16/03/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     12:00    08:15    13:53    01:00    18:49  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            119      125       85L      74L      74L g/L       115-150
+WCC           6.4      5.9     10.9      9.7     14.1H x10^9/L   4.0-11.0
+PLT           227      253       92L     124L     130L x10^9/L   140-400
+RCC          3.88     4.09     2.75L    2.34L    2.43L x10^12/L  3.80-5.10
+PCV          0.35     0.37     0.24L    0.21L    0.22L L/L       0.35-0.45
+MCV          90.5     90.6     88.5     89.8     90.2  fL        80.0-96.0
+MCH          30.6     30.5     30.8     31.8     30.3  pg        27.0-33.0
+MCHC          338      337      348      354      336  g/L       320-360
+RDW          15.0     15.7H    15.0     15.5H    15.6H %         11.0-15.0
+White Cell Differential
+Neut         4.3      3.7      9.2H     8.7H    11.7H  x10^9/L   2.0-8.0
+Lymph        1.6      1.6      1.1L     0.5L     1.4   x10^9/L   1.2-4.0
+Mono         0.4      0.4      0.5      0.4      1.1H  x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.0      0.1      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+12Z968183 04/04/12 13:53
+Comment: Please note fall in haemoglobin and platelet count since
+         the previous examination. ?Post op. Suggest repeat.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Blank Report?
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type:  Serum
+
+Varicella zoster virus IgG Antibody (by EIA)            :
+
+EBV-VCA IgG Antibody by EIA                             :
+EBV-VCA IgM Antibody by EIA                             :
+
+Mycoplasma pneumoniae IgG Antibody by EIA               :
+
+GENERAL COMMENT:
+
+MYCOPLASMA SEROLOGY:
+Recommend repeat mycoplasma serology in 2-3 weeks if clinically
+indicated.
+
+Other atypical pneumonia serology will only be performed on paired
+sera. This serum sample has been stored for 3 months.
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type          : Serum
+
+HIV 1/2 SEROLOGY
+HIV-1/2 Ag/Ab Combo by Architect:
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type : Serum
+         Request No: Z968811
+               Date: 05/04/12
+               Time: 17:50                                 Units  RefRange
+                    ------------ ------------ ------------ ------ --------
+Specimen            Serum
+
+Antinuclear Antibodies
+Antinuclear abs     TF
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z968811
+      Date: 05/04/12
+      Time:    17:50                                      Units   Ref Range
+             -------- -------- -------- -------- -------- ------- ---------
+Serum Vitamin B12 and Folate Studies
+Vit B12          395                                      pmol/L  150-600
+Ser Fol         29.6                                      nmol/L  >12.2
+
+NOTE NEW REFERENCE RANGES FOR FOLATE
+From 27th April 2004, B12 and Folate will be performed on the Bayer Centaur
+Serum Folate Deficient -           <7.63 nmol/L
+Serum Folate Indeterminate - 7.64 to 12.2 nmol/L
+Old Ref Ranges prior to 27th April 2004
+   Serum Folate    - 6.0 to 38.0 nmol/L
+   Red Cell Folate - 350 to 1350 nmol/L
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968365  Z968811
+  Date:  04/04/12 05/04/12
+  Time:     21:25    17:50                             Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            142                                      g/L       115-150
+WCC           9.1                                      x10^9/L   4.0-11.0
+PLT           273                                      x10^9/L   140-400
+RCC          4.43                                      x10^12/L  3.80-5.10
+PCV          0.41                                      L/L       0.35-0.45
+MCV          93.0                                      fL        80.0-96.0
+MCH          31.9                                      pg        27.0-33.0
+MCHC          343                                      g/L       320-360
+RDW          13.0                                      %         11.0-15.0
+ESR                     22H                            mm in 1hr 2-12
+White Cell Differential
+Neut         5.8                                       x10^9/L   2.0-8.0
+Lymph        2.4                                       x10^9/L   1.2-4.0
+Mono         0.7                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.1                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+No Test Requested
+NTRESR
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+No Test Requested
+NTRESR
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z564933
+      Date:  05/04/12
+      Time:     18:30                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0                                            0.8-1.3
+APTT               25                                      secs  23-36
+Fibrinogen        3.7                                      g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.2     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               28     mmol/L ( 22-30    )
+Creatinine         91     umol/L ( 64-104   )
+ (Creatinine)    0.091    mmol/L ( 0.05-0.11)
+Urea              6.8     mmol/L ( 2.5-8.3  )
+ eGFR             72             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z546933
+  Date:  05/04/12
+  Time:     18:30                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            135                                      g/L       130-170
+WCC          10.6                                      x10^9/L   4.0-11.0
+PLT           365                                      x10^9/L   140-400
+RCC          4.42L                                     x10^12/L  4.50-5.70
+PCV          0.40                                      L/L       0.40-0.50
+MCV          90.5                                      fL        80.0-96.0
+MCH          30.5                                      pg        27.0-33.0
+MCHC          337                                      g/L       320-360
+RDW          14.6                                      %         11.0-15.0
+White Cell Differential
+Neut         5.6                                       x10^9/L   2.0-8.0
+Lymph        3.8                                       x10^9/L   1.2-4.0
+Mono         0.8                                       x10^9/L   0.1-1.0
+Eos          0.4                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366381
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+No Test Requested
+NTRS
+NTRF
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366371
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z760824  Z269341  Z516888  Z968890
+      Date:  20/03/06 10/03/10 07/03/12 05/04/12
+      Time:     00:50    14:45    19:46    18:40          Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.1      1.1      1.0      1.2                 0.8-1.3
+APTT               29       29       26       27           secs  23-36
+Fibrinogen        7.2H     6.0H     6.3H     7.6H          g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         4.0     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine        158     umol/L ( 64-104   )
+ (Creatinine)    0.158    mmol/L ( 0.05-0.11)
+Urea              8.8     mmol/L ( 2.5-8.3  )
+ eGFR             37             ( SEE-BELOW)
+Calcium          2.48     mmol/L ( 2.10-2.60)
+Phosphate        0.85     mmol/L ( 0.8-1.5  )
+Magnesium        0.72     mmol/L ( 0.7-1.1  )
+Albumin            25     g/L    ( 35-50    )
+AP                 75     IU/L   ( 30-120   )
+GGT                40     IU/L   ( 10-65    )
+ALT                11     IU/L   ( <45      )
+AST                15     IU/L   ( <35      )
+Bili Total         20     umol/L ( <19      )
+Protein Total      64     g/L    ( 65-85    )
+LD                438     IU/L   ( 210-420  )
+Uric Acid        0.42     mmol/L ( 0.2-0.47 )
+C-React Prot      184     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z561888  Z956556  Z767991  Z968706  Z986890
+  Date:  07/03/12 14/03/12 16/03/12 05/04/12 05/04/12
+  Time:     19:46    10:50    10:20    17:15    18:40  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb              *      101L     106L      87L      83L g/L       130-170
+WCC                    9.7      8.8      7.9      7.3  x10^9/L   4.0-11.0
+PLT             *      228      221      344      330  x10^9/L   140-400
+RCC                   3.69L    3.86L    3.14L    2.95L x10^12/L  4.50-5.70
+PCV                   0.30L    0.32L    0.26L    0.25L L/L       0.40-0.50
+MCV                   82.2     83.7     83.7     84.2  fL        80.0-96.0
+MCH                   27.5     27.6     27.8     28.2  pg        27.0-33.0
+MCHC                   334      330      332      335  g/L       320-360
+RDW                   17.3H    17.0H    19.0H    19.3H %         11.0-15.0
+White Cell Differential
+Neut                  8.7H     7.0      5.3      5.0   x10^9/L   2.0-8.0
+Lymph                 0.6L     1.3      1.6      1.3   x10^9/L   1.2-4.0
+Mono                  0.3      0.4      0.9      0.8   x10^9/L   0.1-1.0
+Eos                   0.1      0.1      0.0      0.0   x10^9/L   0.0-0.5
+Baso                  0.0      0.1      0.1      0.1   x10^9/L   0.0-0.1
+
+12Z561888 07/03/12 19:46
+Comment: Note: No sample collected. Transit lounge closed at 1800.
+         CSR: Pls ring tomorrow for fbe recollection.
+
+12Z968706 05/04/12 17:15
+Film Comment : Red cells show moderate anisocytosis, some stomatocytes
+               and increased rouleaux. Unremarkable leucocytes and
+               platelets.
+Conclusion: Please note fall in haemoglobin since the previous
+            examination. Suggest repeat FBE to confirm results.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         5.0     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine        100     umol/L ( 49-90    )
+ (Creatinine)    0.100    mmol/L ( 0.05-0.09)
+Urea             11.7     mmol/L ( 2.5-8.3  )
+ eGFR             47             ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z336811  Z867542  Z963499  Z096739  Z968880
+  Date:  12/02/12 14/02/12 15/02/12 16/02/12 05/04/12
+  Time:     11:10    08:25    09:15    07:25    18:30  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            105L     112L     113L     114L     114L g/L       115-150
+WCC           8.7      4.6      3.8L     4.6      5.9  x10^9/L   4.0-11.0
+PLT           161      181      166      208      222  x10^9/L   140-400
+RCC          3.40L    3.67L    3.63L    3.70L    3.59L x10^12/L  3.80-5.10
+PCV          0.30L    0.32L    0.32L    0.33L    0.32L L/L       0.35-0.45
+MCV          89.6     87.5     87.5     88.1     89.9  fL        80.0-96.0
+MCH          30.9     30.5     31.1     30.8     31.7  pg        27.0-33.0
+MCHC          345      349      356      349      352  g/L       320-360
+RDW          14.7     14.8     14.2     14.8     15.0  %         11.0-15.0
+White Cell Differential
+Neut         7.2      3.2      2.3      2.6      4.1   x10^9/L   2.0-8.0
+Lymph        0.1L     0.9L     1.1L     1.5      1.2   x10^9/L   1.2-4.0
+Mono         0.1      0.4      0.3      0.4      0.4   x10^9/L   0.1-1.0
+Eos          0.0      0.1      0.1      0.1      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+Bands        1.3H     0.0                              x10^9/L   0.0-0.5
+
+12Z363811 12/02/12 11:10
+Film Comment : Mild neutrophilia with a left shift and toxic changes.
+               Manual differential. Mild rouleaux, otherwise red cells
+               and platelets show no significant changes - see previous
+               report.
+Conclusion: Film may be suggestive of infection / inflammation. Repeat
+            FBE may be of value.
+
+12Z876542 14/02/12 08:25
+Film Comment : Neutrophils show mild toxic changes. Manual differential.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         4.1     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         64     umol/L ( 64-104   )
+ (Creatinine)    0.064    mmol/L ( 0.05-0.11)
+Urea              3.5     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            40     g/L    ( 35-50    )
+AP                 96     IU/L   ( 30-120   )
+GGT                40     IU/L   ( 10-65    )
+ALT                22     IU/L   ( <45      )
+AST                23     IU/L   ( <35      )
+Bili Total          5     umol/L ( <19      )
+Protein Total      71     g/L    ( 65-85    )
+Troponin I       <0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968870
+  Date:  05/04/12
+  Time:     18:35                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            145                                      g/L       130-170
+WCC          12.3H                                     x10^9/L   4.0-11.0
+PLT           298                                      x10^9/L   140-400
+RCC          4.92                                      x10^12/L  4.50-5.70
+PCV          0.42                                      L/L       0.40-0.50
+MCV          85.5                                      fL        80.0-96.0
+MCH          29.5                                      pg        27.0-33.0
+MCHC          345                                      g/L       320-360
+RDW          13.4                                      %         11.0-15.0
+White Cell Differential
+Neut         8.9H                                      x10^9/L   2.0-8.0
+Lymph        2.3                                       x10^9/L   1.2-4.0
+Mono         0.8                                       x10^9/L   0.1-1.0
+Eos          0.3                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366361
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            136     mmol/L ( 135-145  )
+Potassium         3.4     mmol/L ( 3.5-5.5  )
+Chloride           95     mmol/L ( 95-110   )
+HCO3               28     mmol/L ( 22-30    )
+Creatinine         90     umol/L ( 64-104   )
+ (Creatinine)    0.090    mmol/L ( 0.05-0.11)
+Urea              8.2     mmol/L ( 2.5-8.3  )
+ eGFR             70             ( SEE-BELOW)
+Albumin            38     g/L    ( 35-50    )
+AP                133     IU/L   ( 30-120   )
+GGT               332     IU/L   ( 10-65    )
+ALT                62     IU/L   ( <45      )
+AST                52     IU/L   ( <35      )
+Bili Total         16     umol/L ( <19      )
+Protein Total      79     g/L    ( 65-85    )
+C-React Prot       54     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z164731  Z556133  Z868834  Z968397  Z986850
+  Date:  11/05/11 13/05/11 03/04/12 04/04/12 05/04/12
+  Time:     00:45    04:55    23:30    20:30    18:10  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            102L     108L     110L     108L     113L g/L       130-170
+WCC           7.5      6.0      8.0      5.9      6.0  x10^9/L   4.0-11.0
+PLT           101L     100L     106L      97L      97L x10^9/L   140-400
+RCC          3.18L    3.35L    3.47L    3.42L    3.56L x10^12/L  4.50-5.70
+PCV          0.29L    0.32L    0.32L    0.32L    0.33L L/L       0.40-0.50
+MCV          92.7     94.3     92.3     93.4     93.5  fL        80.0-96.0
+MCH          32.0     32.3     31.7     31.7     31.9  pg        27.0-33.0
+MCHC          345      343      344      340      341  g/L       320-360
+RDW          14.6     14.0     14.8     15.4H    15.5H %         11.0-15.0
+White Cell Differential
+Neut         5.8      4.2      6.7      4.6      4.2   x10^9/L   2.0-8.0
+Lymph        1.0L     1.0L     0.6L     0.7L     0.9L  x10^9/L   1.2-4.0
+Mono         0.5      0.7      0.7      0.7      0.8   x10^9/L   0.1-1.0
+Eos          0.1      0.1      0.0      0.0      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+11Z164731 11/05/11 00:45
+Film Comment : Platelets are mildly reduced in number.
+               Red cells show slight polychromasia.
+               Leucocytes are unremarkable.
+Conclusion: ? Cause of persistent mild thrombocytopenia.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z546768  Z666092  Z564961  Z986693  Z564923
+      Date:  03/04/12 04/04/12 05/04/12 05/04/12 05/04/12
+      Time:     07:20    09:35    08:45    10:50    18:15 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               4.3H     4.0H     6.2H     6.6H     6.9H       0.8-1.3
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.7     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         55     umol/L ( 49-90    )
+ (Creatinine)    0.055    mmol/L ( 0.05-0.09)
+Urea              4.0     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            40     g/L    ( 35-50    )
+AP                111     IU/L   ( 30-120   )
+GGT                16     IU/L   ( 10-65    )
+ALT                18     IU/L   ( <34      )
+AST                23     IU/L   ( <31      )
+Bili Total          9     umol/L ( <19      )
+Protein Total      80     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986840
+  Date:  05/04/12
+  Time:     18:18                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            132                                      g/L       115-150
+WCC           5.9                                      x10^9/L   4.0-11.0
+PLT           245                                      x10^9/L   140-400
+RCC          4.23                                      x10^12/L  3.80-5.10
+PCV          0.38                                      L/L       0.35-0.45
+MCV          90.8                                      fL        80.0-96.0
+MCH          31.1                                      pg        27.0-33.0
+MCHC          342                                      g/L       320-360
+RDW          12.7                                      %         11.0-15.0
+White Cell Differential
+Neut         4.1                                       x10^9/L   2.0-8.0
+Lymph        1.3                                       x10^9/L   1.2-4.0
+Mono         0.4                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986840
+  Date:  05/04/12
+  Time:     18:18                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            132                                      g/L       115-150
+WCC           5.9                                      x10^9/L   4.0-11.0
+PLT           245                                      x10^9/L   140-400
+RCC          4.23                                      x10^12/L  3.80-5.10
+PCV          0.38                                      L/L       0.35-0.45
+MCV          90.8                                      fL        80.0-96.0
+MCH          31.1                                      pg        27.0-33.0
+MCHC          342                                      g/L       320-360
+RDW          12.7                                      %         11.0-15.0
+White Cell Differential
+Neut         4.1                                       x10^9/L   2.0-8.0
+Lymph        1.3                                       x10^9/L   1.2-4.0
+Mono         0.4                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.8     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               26     mmol/L ( 22-30    )
+Creatinine         80     umol/L ( 64-104   )
+ (Creatinine)    0.080    mmol/L ( 0.05-0.11)
+Urea              5.3     mmol/L ( 2.5-8.3  )
+ eGFR             81             ( SEE-BELOW)
+Troponin I        1.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366351
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Venous/peripheral
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968860
+      Date:  05/04/12
+      Time:     18:15                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.0                                            0.8-1.3
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+REPRODUCTIVE HORMONES/ANDROGENS
+Quant Pregnancy (hCG) <2           IU/L    ( <5       )
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968860
+  Date:  05/04/12
+  Time:     18:15                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            136                                      g/L       115-150
+WCC          16.5H                                     x10^9/L   4.0-11.0
+PLT           291                                      x10^9/L   140-400
+RCC          4.38                                      x10^12/L  3.80-5.10
+PCV          0.39                                      L/L       0.35-0.45
+MCV          89.8                                      fL        80.0-96.0
+MCH          31.1                                      pg        27.0-33.0
+MCHC          347                                      g/L       320-360
+RDW          12.2                                      %         11.0-15.0
+White Cell Differential
+Neut        14.1H                                      x10^9/L   2.0-8.0
+Lymph        1.4                                       x10^9/L   1.2-4.0
+Mono         0.9                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+12Z986860 05/04/12 18:15
+Comment: Please note mild neutrophilia
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         4.2     mmol/L ( 3.5-5.5  )
+Chloride          111     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine         81     umol/L ( 49-90    )
+ (Creatinine)    0.081    mmol/L ( 0.05-0.09)
+Urea              6.0     mmol/L ( 2.5-8.3  )
+ eGFR             68             ( SEE-BELOW)
+Albumin            34     g/L    ( 35-50    )
+AP                 51     IU/L   ( 30-120   )
+GGT                31     IU/L   ( 10-65    )
+ALT                47     IU/L   ( <34      )
+AST                51     IU/L   ( <31      )
+Bili Total          6     umol/L ( <19      )
+Protein Total      67     g/L    ( 65-85    )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Blood Bank Request Received - Specimen NOT Processed
+
+
+Sample Error
+
+    Date of Birth incorrect / missmatch
+
+Comments / Steps Taken
+
+    DOB on specimen "02/03/1975". Ward informed new specimen
+    and request form required for GS.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z516065
+      Date: 05/04/12                                              Arterial
+      Time:    18:24                                      Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0                                      Deg. C
+pH              7.32L                                             7.35-7.45
+pCO2              52H                                     mmHg    35-45
+Base Excess      0.4                                      mmol/L  -3.0/3.0
+pO2               24L                                     mmHg    75-100
+O2 Sat            40L                                     %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        5.6H                                     mmol/L  3.5-5.5
+Sodium           141                                      mmol/L  135-145
+
+BLOOD CO-OXIMETRY
+Total   Hb       140                                      g/L     115-150
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z986663  Z968744  Z968810
+  Date:  05/04/12 05/04/12 05/04/12
+  Time:     11:00    16:55    18:05                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            188H     189H     185H                   g/L       130-170
+WCC           9.6     10.2      9.4                    x10^9/L   4.0-11.0
+PLT           143        *      153                    x10^9/L   140-400
+RCC          6.09H    6.14H    6.03H                   x10^12/L  4.50-5.70
+PCV          0.55H    0.55H    0.55H                   L/L       0.40-0.50
+MCV          90.1     89.8     91.0                    fL        80.0-96.0
+MCH          30.9     30.8     30.6                    pg        27.0-33.0
+MCHC          343      343      337                    g/L       320-360
+RDW          13.3     13.1     13.3                    %         11.0-15.0
+White Cell Differential
+Neut         6.2      5.5      6.3                     x10^9/L   2.0-8.0
+Lymph        2.4      3.5      2.0                     x10^9/L   1.2-4.0
+Mono         0.8      0.8      0.9                     x10^9/L   0.1-1.0
+Eos          0.1      0.4      0.1                     x10^9/L   0.0-0.5
+Baso         0.1      0.0      0.1                     x10^9/L   0.0-0.1
+
+12Z986663 05/04/12 11:00
+Film Comment : Red cells are normocytic normochromic. White cells are
+               unremarkable. Platelets appear normal.
+Comment: Please note mildly raised haemoglobin.
+
+12Z968744 05/04/12 16:55
+Film Comment : Film scanned. Manual differential.
+Conclusion: * Film shows fibrin strands suggestive of a partially
+            clotted specimen. Accurate platelet count unavailable.
+            Please repeat FBE.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            139     mmol/L ( 135-145  )
+Potassium         3.5     mmol/L ( 3.5-5.5  )
+Chloride          102     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         59     umol/L ( 49-90    )
+ (Creatinine)    0.059    mmol/L ( 0.05-0.09)
+Urea              4.2     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z646826  Z968800
+  Date:  20/10/06 05/04/12
+  Time:     15:45    18:10                             Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            130      130                             g/L       115-150
+WCC           6.0     11.6H                            x10^9/L   4.0-11.0
+PLT           283      280                             x10^9/L   140-400
+RCC          4.26     4.14                             x10^12/L  3.80-5.10
+PCV          0.37     0.37                             L/L       0.35-0.45
+MCV          87.4     89.0                             fL        80.0-96.0
+MCH          30.5     31.4                             pg        27.0-33.0
+MCHC          349      353                             g/L       320-360
+RDW          13.7     13.1                             %         11.0-15.0
+White Cell Differential
+Neut         3.2      7.5                              x10^9/L   2.0-8.0
+Lymph        2.1      2.6                              x10^9/L   1.2-4.0
+Mono         0.5      1.2H                             x10^9/L   0.1-1.0
+Eos          0.2      0.2                              x10^9/L   0.0-0.5
+Baso         0.0      0.1                              x10^9/L   0.0-0.1
+
+12Z968800 05/04/12 18:10
+Comment: Please note mild monocytosis
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968800
+      Date:  05/04/12
+      Time:     18:10                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+D-Dimer        <220                                        ug/L  <500
+Effective from 1st July 2009, the methodology of D-Dimer will be changed
+to STAGO D-Dimer reagents (LIATEST). NB the reference range is unchanged
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+REPRODUCTIVE HORMONES/ANDROGENS
+Quant Pregnancy (hCG) <2           IU/L    ( <5       )
+
+MISCELLANEOUS
+HbA1c(HPLC)       TF  mmol/molHb
+HbA1c(HPLC)               %      (See Below)
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z167743  Z886298  Z868818  Z968482  Z986799
+  Date:  02/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+  Time:     02:00    01:31    02:15    01:40    18:10  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             94L      88L      80L      83L      76L g/L       115-150
+WCC          18.5H     7.2      4.4      5.2      8.4  x10^9/L   4.0-11.0
+PLT           175      154      127L     165      164  x10^9/L   140-400
+RCC          2.81L    2.67L    2.42L    2.51L    2.37L x10^12/L  3.80-5.10
+PCV          0.28L    0.26L    0.23L    0.24L    0.22L L/L       0.35-0.45
+MCV          98.1H    96.2H    96.7H    96.3H    95.0  fL        80.0-96.0
+MCH          33.7H    33.1H    33.1H    33.1H    32.0  pg        27.0-33.0
+MCHC          343      344      342      344      338  g/L       320-360
+RDW          13.6     13.8     14.1     14.3     13.3  %         11.0-15.0
+White Cell Differential
+Neut        12.9H     6.4      3.0      3.9      6.7   x10^9/L   2.0-8.0
+Lymph        0.7L     0.6L     0.7L     1.1L     0.4L  x10^9/L   1.2-4.0
+Mono         0.2      0.1      0.0L     0.0L     0.3   x10^9/L   0.1-1.0
+Eos          0.0      0.1      0.2      0.2      0.0   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+Bands        4.4H              0.6H              0.9H  x10^9/L   0.0-0.5
+Meta         0.2H                                      x10^9/L   0.0
+NRBC                              2H                   /100WBCs  0
+NRBC Abs                       0.1H                    x10^9/L   0
+
+12Z167743 02/04/12 02:00
+Film Comment : White cells show mild neutrophilia with mild left shift
+               and mild toxic changes. Manual differential.
+               Red cells show mild macrocytosis.
+               Platelets appear normal.
+Conclusion: Recent trauma.
+
+12Z868298 03/04/12 01:31
+Comment: Instrument differential and parameters reported.
+
+12Z886818 04/04/12 02:15
+Film Comment : Moderate anaemia with mild polychromasia. Occasional
+               nucleated red blood cells. Mild left shift in the
+               neutrophils. Manual differential. Mild thrombocytopenia.
+Conclusion: Consistent with infection / inflammation.
+
+12Z968482 05/04/12 01:40
+Comment: Instrument differential and parameters reported.
+
+12Z968799 05/04/12 18:10
+Film Comment : Manual differential. Neutrophils show left shift with mild
+               toxic granulation. Red cells are normocytic normochromic
+               with increased rouleaux. Platelets appear normal.
+Conclusion: Recent tissue damage/trauma.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z167743  Z886298  Z868818  Z968482  Z986799
+      Date:  02/04/12 03/04/12 04/04/12 05/04/12 05/04/12
+      Time:     02:00    01:31    02:15    01:40    18:10 Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.6H     1.2      1.1      1.3      1.3        0.8-1.3
+APTT               35       36       37H      34       34  secs  23-36
+Fibrinogen        5.2H     5.9H     6.2H     7.1H     8.0H g/L   2.0-5.0
+PT               17.3                                      secs
+PT mix           14.3                                      secs
+
+12Z167743 02/04/12 02:00
+PT Mix  : 50/50 mixture of the patient's plasma with normal plasma -
+          CORRECTED.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         5.2     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               24     mmol/L ( 22-30    )
+Creatinine         50     umol/L ( 49-90    )
+ (Creatinine)    0.050    mmol/L ( 0.05-0.09)
+Urea              4.0     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            21     g/L    ( 35-50    )
+AP                 75     IU/L   ( 30-120   )
+GGT                19     IU/L   ( 10-65    )
+ALT                40     IU/L   ( <34      )
+AST                46     IU/L   ( <31      )
+Bili Total          8     umol/L ( <19      )
+Protein Total      55     g/L    ( 65-85    )
+Troponin I        0.42    ug/L   (See Below )
+CK                295     IU/L   ( <145     )
+Amylase            51     IU/L   ( 22-100   )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z969548
+SPECIMEN
+Specimen Type : Sputum
+
+
+MICROSCOPY
+
+GRAM STAIN
+Macroscopic Description                   Mucoid
+Pus:Epithelial Cell Ratio                 >25:10
+Pus Cells                                 ++
+Squamous Epithelial Cells                 Occasional
+Gram positive cocci                       Occasional
+Gram positive bacilli                     Occasional
+Gram negative bacilli                     Occasional
+
+
+
+
+
+CULTURE
+
+Standard culture:   +  Mixed upper respiratory tract flora
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561543  Z561546  Z516519  Z561561  Z561964
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    05:39    09:19    12:19    14:24    18:18  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.49H    7.46H    7.43     7.42     7.48H         7.35-7.45
+pCO2              44       44       52H      53H      45  mmHg    35-45
+HCO3(Std)         32H      30       32H      32H      33H mmol/L  22.0-30.0
+Base Excess      8.7H     6.9H     9.1H     8.6H     9.2H mmol/L  -3.0/3.0
+pO2               70L      62L      86      131H      81  mmHg    75-100
+O2 Sat            94L      92L      96       98       96  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        4.2      4.1      3.8      4.4      4.1  mmol/L  3.5-5.5
+Sodium           143      144      143      144      145  mmol/L  135-145
+Chloride         106      110      106      107      109  mmol/L  95-110
+iCa++           1.15     1.11L    1.11L    1.09L    1.11L mmol/L  1.12-1.30
+Glucose          7.4      7.7      7.6      7.5      7.8H mmol/L  3.6-7.7
+Lactate          1.1      1.0      0.7      0.5      0.6  mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb        99L     102L     115      111L     104L g/L     115-150
+Reduced Hb       5.5H     7.6H     3.6      1.6      3.6  %       0-5
+CarbOxy Hb       1.2      1.3      1.0      1.1      1.2  %       0.5-1.5
+Meth    Hb       1.6H     1.6H     1.7H     1.9H     1.4  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Miscellaneous Fluid
+Fluid Type:   Drainage
+LD              4303  IU/L
+Amylase           390 IU/L
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z763753
+SPECIMEN
+Specimen Type : Urine Type Not Stated
+
+
+CHEMISTRY
+pH              5.5
+Protein         TRACE
+Specific Grav.  1.018
+Blood           NEGATIVE
+Glucose         NEGATIVE
+Leucocytes      TRACE
+
+
+MICROSCOPY
+Leucocytes                    17         x10^6/L ( <2x10^6/L )
+Red Blood Cells               1          x10^6/L ( <13x10^6/L )
+Squamous Epithelial Cells     Nil
+
+
+
+
+
+
+
+
+STANDARD BACTERIAL CULTURE
+>10^9 cfu/L Mixed organisms including: staphylococci,
+streptococci, diphtheroid bacilli \T\ gram negative bacilli.
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No      : Z860589
+SPECIMEN
+Specimen Type : Swab
+Description   : Throat
+
+
+
+CULTURE
++++ Mixed upper respiratory tract flora
+
+
+No Beta haemolytic streptococci isolated.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type:  Throat Swab
+
+RESPIRATORY VIRUS PCR
+Influenza A PCR (ABI Taqman)  : Not Detected
+Influenza B PCR (ABI Taqman)  : Not Detected
+RSV PCR (ABI Taqman)          : Not Detected
+Rhinovirus PCR (ABI Taqman)   : Not Detected
+
+
+
+GENERAL COMMENT:
+
+Please note: Expired swab recieved (March 12).
+A negative result may not be a true indicator of patient status.
+Any further swabs recieved past their use-by date will not
+be processed.
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type:  Serum
+
+EBV-VCA IgG Antibody by EIA                             :
+EBV-VCA IgM Antibody by EIA                             :
+
+Mycoplasma pneumoniae IgG Antibody by EIA               :
+
+GENERAL COMMENT:
+
+Recommend repeat mycoplasma serology in 2-3 weeks if clinically
+indicated.
+
+Other atypical pneumonia serology will only be performed on paired
+sera. This serum sample has been stored for 3 months.
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Lab No : Z366341
+SPECIMENS
+Specimen Type : Blood Cultures
+Description   : Not-stated
+
+Aerobic bottle               4   days                 Negative
+Anaerobic bottle             4   days                 Negative
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.4     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               27     mmol/L ( 22-30    )
+Creatinine         74     umol/L ( 64-104   )
+ (Creatinine)    0.074    mmol/L ( 0.05-0.11)
+Urea              5.1     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            38     g/L    ( 35-50    )
+AP                 68     IU/L   ( 30-120   )
+GGT                20     IU/L   ( 10-65    )
+ALT                31     IU/L   ( <45      )
+AST                36     IU/L   ( <35      )
+Bili Total         12     umol/L ( <19      )
+Protein Total      75     g/L    ( 65-85    )
+C-React Prot       44     mg/L   ( <5       )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968749
+  Date:  05/04/12
+  Time:     18:00                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            139                                      g/L       130-170
+WCC           4.6                                      x10^9/L   4.0-11.0
+PLT           119L                                     x10^9/L   140-400
+RCC          4.18L                                     x10^12/L  4.50-5.70
+PCV          0.40                                      L/L       0.40-0.50
+MCV          95.8                                      fL        80.0-96.0
+MCH          33.3H                                     pg        27.0-33.0
+MCHC          348                                      g/L       320-360
+RDW          13.8                                      %         11.0-15.0
+White Cell Differential
+Neut         3.1                                       x10^9/L   2.0-8.0
+Lymph        0.8L                                      x10^9/L   1.2-4.0
+Mono         0.4                                       x10^9/L   0.1-1.0
+Eos          0.3                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+12Z968749 05/04/12 18:00
+Film Comment : Red cells show occasional macrocytes. Mild
+               thrombocytopenia. Unremarkable leucocytes.
+Conclusion: Suggest repeat FBE to confirm platelet count.
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         3.9     mmol/L ( 3.5-5.5  )
+Chloride          104     mmol/L ( 95-110   )
+HCO3               24     mmol/L ( 22-30    )
+Creatinine         90     umol/L ( 64-104   )
+ (Creatinine)    0.090    mmol/L ( 0.05-0.11)
+Urea              7.5     mmol/L ( 2.5-8.3  )
+ eGFR             75             ( SEE-BELOW)
+Troponin I       <0.02    ug/L   (See Below )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968739
+  Date:  05/04/12
+  Time:     18:02                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            136                                      g/L       130-170
+WCC           8.0                                      x10^9/L   4.0-11.0
+PLT           222                                      x10^9/L   140-400
+RCC          4.32L                                     x10^12/L  4.50-5.70
+PCV          0.39L                                     L/L       0.40-0.50
+MCV          89.5                                      fL        80.0-96.0
+MCH          31.6                                      pg        27.0-33.0
+MCHC          353                                      g/L       320-360
+RDW          13.1                                      %         11.0-15.0
+White Cell Differential
+Neut         5.5                                       x10^9/L   2.0-8.0
+Lymph        1.6                                       x10^9/L   1.2-4.0
+Mono         0.7                                       x10^9/L   0.1-1.0
+Eos          0.2                                       x10^9/L   0.0-0.5
+Baso         0.0                                       x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  Z561578  Z561579  Z516261  Z561463  Z561864
+      Date: 05/04/12 05/04/12 05/04/12 05/04/12 05/04/12          Arterial
+      Time:    11:28    12:36    14:13    16:46    18:10  Units   Ref Range
+            -------- -------- -------- -------- --------  ------  ---------
+BLOOD GASES
+Temperature     37.0     37.0     37.0     37.0     37.0  Deg. C
+pH              7.18L    7.17L    7.26L    7.36     7.40          7.35-7.45
+pCO2              19L      28L      26L      23L      21L mmHg    35-45
+HCO3(Std)         10L      11L      14L      16L      17L mmol/L  22.0-30.0
+Base Excess    -20.1L   -17.1L   -14.4L   -11.8L   -10.8L mmol/L  -3.0/3.0
+pO2              516H     161H     142H     138H     136H mmHg    75-100
+O2 Sat           100       98       99       99      100  %       95-100
+
+ELECTROLYTES (Whole Blood)
+Potassium        6.8H     6.2H     5.0      5.7H     6.0H mmol/L  3.5-5.5
+Sodium           135      139      142      140      141  mmol/L  135-145
+Chloride         109      110      109      107      106  mmol/L  95-110
+iCa++           1.09L    1.02L    0.98L    0.99L    0.98L mmol/L  1.12-1.30
+Glucose          6.9      6.9      5.2      5.3      4.4  mmol/L  3.6-7.7
+Lactate         12.4H    13.9H    15.0H    12.3H    11.7H mmol/L  0.2-1.8
+
+BLOOD CO-OXIMETRY
+Total   Hb       103L     101L      99L     106L     109L g/L     130-170
+Reduced Hb      -0.1L     1.6      1.2      0.6      0.5  %       0-5
+CarbOxy Hb       1.3      1.1      1.4      1.7H     1.8H %       0.5-1.5
+Meth    Hb       1.1      1.3      1.2      1.0      1.2  %       0-1.5
+
+Note: Reference Ranges shown are for arterial blood only.
+      Venous blood ranges for pH pCO2 pO2 are:
+      pH     7.31 - 7.41
+      pCO2    40  -  50  mmHg
+      pO2     30  -  50  mmHg
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Prothrombin Gene Mutation Analysis
+
+G20210A Substitution Result:
+
+Factor V Gene Mutation Analysis
+
+G1691A Substitution Result:
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            138     mmol/L ( 135-145  )
+Potassium         3.6     mmol/L ( 3.5-5.5  )
+Chloride          105     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine         65     umol/L ( 64-104   )
+ (Creatinine)    0.065    mmol/L ( 0.05-0.11)
+Urea              1.9     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Lactate           1.2     mmol/L ( 0.2-1.8  )
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z968709
+      Date:  05/04/12
+      Time:     18:02                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               3.3H                                           0.8-1.3
+APTT               51H                                     secs  23-36
+Fibrinogen        3.8                                      g/L   2.0-5.0
+APTT mix         30.9                                      secs
+
+12Z986709 05/04/12 18:02
+APTT Mix: 50/50 mixture of the patient's plasma with normal plasma -
+          CORRECTED.
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z968709
+  Date:  05/04/12
+  Time:     18:02                                      Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            150                                      g/L       130-170
+WCC           8.0                                      x10^9/L   4.0-11.0
+PLT           189                                      x10^9/L   140-400
+RCC          4.24L                                     x10^12/L  4.50-5.70
+PCV          0.43                                      L/L       0.40-0.50
+MCV         100.3H                                     fL        80.0-96.0
+MCH          35.2H                                     pg        27.0-33.0
+MCHC          351                                      g/L       320-360
+RDW          13.3                                      %         11.0-15.0
+White Cell Differential
+Neut         5.1                                       x10^9/L   2.0-8.0
+Lymph        2.0                                       x10^9/L   1.2-4.0
+Mono         0.8                                       x10^9/L   0.1-1.0
+Eos          0.1                                       x10^9/L   0.0-0.5
+Baso         0.1                                       x10^9/L   0.0-0.1
+
+12Z968709 05/04/12 18:02
+Film Comment : Red cells are mildly macrocytic with some target cells.
+               Unremarkable leucocytes and platelets
+Conclusion: Common causes of macrocytosis include liver disease,
+            B12/folate deficiency, hypothyroidism, alcohol, smoking,
+            and certain drugs including chemotherapy. Suggest liver
+            function tests, serum B12/folate levels, and review drug
+            history if cause not already known.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Specimen Type : Serum
+         Request No: Z986709
+               Date: 05/04/12
+               Time: 18:02                                 Units  RefRange
+                    ------------ ------------ ------------ ------ --------
+Specimen            Serum
+
+Anti-Cardiolipin
+Anti-Cardio.IgG        TF                                  GPL U  0-20.0
+
+ACL COMMENT
+ACL-IgM is not performed routinely on requests of ACL antibodies. Some
+patients with anti-phospholipid antibody syndrome have undetectable IgG
+anti-cardiolipin antibodies.
+Further testing for IgM ACL may also be indicated.
+Please contact the immunopathology registrar for further advice on 9342 8023.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Tests of Hypercoagulability (Plasma)
+
+
+Tests for APC Resistance (Plasma)
+  n-APC Ratio
+
+  n-APC Ratio Reference Ranges : > 0.86    : Normal
+                                 0.80-0.86 : Borderline
+                                 < 0.80    : Abnormal
+Tests for Lupus Inhibitor (Plasma)
+APTT (Filtered)                    T/F   sec  (25.0-37.0)
+LAS Ratio/LAC Ratio                           (  <1.20  )
+
+
+Lupus Inhibitor Comment:
+     T/F
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Blank Report?
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            141     mmol/L ( 135-145  )
+Potassium         3.2     mmol/L ( 3.5-5.5  )
+Chloride          111     mmol/L ( 95-110   )
+HCO3               23     mmol/L ( 22-30    )
+Creatinine         63     umol/L ( 64-104   )
+ (Creatinine)    0.063    mmol/L ( 0.05-0.11)
+Urea              4.6     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Calcium          2.12     mmol/L ( 2.10-2.60)
+Phosphate        0.83     mmol/L ( 0.8-1.5  )
+Magnesium        0.69     mmol/L ( 0.7-1.1  )
+Albumin            23     g/L    ( 35-50    )
+
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   Z246532  Z968160  Z968308  Z986534  Z968788
+  Date:  18/02/12 04/04/12 04/04/12 05/04/12 05/04/12
+  Time:     09:45    12:40    22:56    06:45    18:00  Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb             95L      65L      76L      79L      88L g/L       130-170
+WCC           7.3      6.4      8.0      5.7      5.9  x10^9/L   4.0-11.0
+PLT           278      335      327      318      323  x10^9/L   140-400
+RCC          4.40L    3.48L    3.82L    3.92L    4.20L x10^12/L  4.50-5.70
+PCV          0.30L    0.21L    0.25L    0.26L    0.28L L/L       0.40-0.50
+MCV          67.3L    60.4L    65.1L    66.2L    67.1L fL        80.0-96.0
+MCH          21.6L    18.5L    19.9L    20.3L    20.8L pg        27.0-33.0
+MCHC          321      307L     306L     307L     310L g/L       320-360
+RDW          17.1H    19.0H    23.3H    22.6H    25.8H %         11.0-15.0
+White Cell Differential
+Neut         5.3      4.4      5.2      3.8      3.6   x10^9/L   2.0-8.0
+Lymph        1.4      1.4      1.9      1.3      1.4   x10^9/L   1.2-4.0
+Mono         0.5      0.5      0.7      0.5      0.7   x10^9/L   0.1-1.0
+Eos          0.1      0.0      0.1      0.1      0.1   x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0      0.0      0.0   x10^9/L   0.0-0.1
+
+12Z968160 04/04/12 12:40
+Film Comment : Marked hypochromic, microcytic anaemia with some elongated
+               cells and occasional acanthocytes. Occasional
+               hypersegmented neutrophils seen. Platelets appear normal.
+Conclusion: Suggestive of iron deficiency anaemia. Suggest correlation
+            with iron studies.
+
+            Film reviewed by Dr Radio Xray - Haematology
+            Registrar
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Req No:   R017388  Z767169  Z968719
+  Date:  20/03/08 30/09/10 05/04/12
+  Time:     02:37    22:50    18:00                    Units    Ref Range
+         ________ ________ ________ ________ ________  ________ _________
+Full Blood Count (Whole Blood)
+Hb            148      146      153                    g/L       130-170
+WCC           7.9     11.4H     7.3                    x10^9/L   4.0-11.0
+PLT           239      176      167                    x10^9/L   140-400
+RCC          5.16     5.09     5.32                    x10^12/L  4.50-5.70
+PCV          0.43     0.42     0.44                    L/L       0.40-0.50
+MCV          83.0     81.9     82.9                    fL        80.0-96.0
+MCH          28.6     28.6     28.7                    pg        27.0-33.0
+MCHC          345      349      346                    g/L       320-360
+RDW          12.0     12.4     12.7                    %         11.0-15.0
+White Cell Differential
+Neut         3.2      8.2H     5.3                     x10^9/L   2.0-8.0
+Lymph        3.5      2.1      1.5                     x10^9/L   1.2-4.0
+Mono         0.5      0.9      0.4                     x10^9/L   0.1-1.0
+Eos          0.6H     0.2      0.0                     x10^9/L   0.0-0.5
+Baso         0.0      0.0      0.0                     x10^9/L   0.0-0.1
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+CUMULATIVE REPORT
+Request No:   Z986719
+      Date:  05/04/12
+      Time:     18:00                                     Units   Ref.
+             -------- -------- -------- -------- -------- ------ -----
+Coagulation (Plasma)
+INR               1.2                                            0.8-1.3
+APTT               28                                      secs  23-36
+Fibrinogen        2.4                                      g/L   2.0-5.0
+
+APTT Therapeutic range for IV Heparin therapy = 60-85 seconds
+From 9.12.2010 APTT normal range 23 - 36 seconds.
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            140     mmol/L ( 135-145  )
+Potassium         4.2     mmol/L ( 3.5-5.5  )
+Chloride          106     mmol/L ( 95-110   )
+HCO3               28     mmol/L ( 22-30    )
+Creatinine         77     umol/L ( 64-104   )
+ (Creatinine)    0.077    mmol/L ( 0.05-0.11)
+Urea              6.1     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Albumin            44     g/L    ( 35-50    )
+AP                 98     IU/L   ( 30-120   )
+GGT                29     IU/L   ( 10-65    )
+ALT                26     IU/L   ( <45      )
+AST                24     IU/L   ( <35      )
+Bili Total         12     umol/L ( <19      )
+Protein Total      76     g/L    ( 65-85    )
+Lipase            154     IU/L   ( <60      )
+Lactate           0.6     mmol/L ( 0.2-1.8  )
+EtOH              4.7     mmol/L (See Below )
+EtOH              0.02    gm%
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+Request No:  R008346  Z986797
+      Date: 26/10/10 05/04/12
+      Time:    22:23    17:39                             Units   Ref Range
+             -------- -------- -------- -------- -------- ------- ---------
+Serum Vitamin B12 and Folate Studies
+Vit B12        >1476H     295                             pmol/L  150-600
+Ser Fol        >54.0    >54.0                             nmol/L  >12.2
+Iron Studies (Plasma/serum)
+Ferritin       388.0H                                     ug/L    15-200
+Iron               7L                                     umol/L  10-30
+Transferrin     2.18                                      g/L     1.9-3.2
+Transf'n IBC    54.6                                      umol/L  47.6-80.2
+Transf'n Sat      13L                                     %       14.7-37.4
+
+NOTE NEW REFERENCE RANGES FOR FOLATE
+From 27th April 2004, B12 and Folate will be performed on the Bayer Centaur
+Serum Folate Deficient -           <7.63 nmol/L
+Serum Folate Indeterminate - 7.64 to 12.2 nmol/L
+Old Ref Ranges prior to 27th April 2004
+   Serum Folate    - 6.0 to 38.0 nmol/L
+   Red Cell Folate - 350 to 1350 nmol/L
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+THYROID FUNCTION
+TSH                       1.09       mIU/L   ( 0.1-4.0  )
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + +
+
+SERUM/PLASMA
+Sodium            137     mmol/L ( 135-145  )
+Potassium         3.4     mmol/L ( 3.5-5.5  )
+Chloride          101     mmol/L ( 95-110   )
+HCO3               25     mmol/L ( 22-30    )
+Creatinine         48     umol/L ( 49-90    )
+ (Creatinine)    0.048    mmol/L ( 0.05-0.09)
+Urea              6.8     mmol/L ( 2.5-8.3  )
+ eGFR             >90            ( SEE-BELOW)
+Glucose           4.6     mmol/L ( 3.3-7.7  )
+ (fasting)      NoInfo
+Calcium          2.42     mmol/L ( 2.10-2.60)
+Phosphate        1.37     mmol/L ( 0.8-1.5  )
+Magnesium        0.81     mmol/L ( 0.8-1.0  )
+Albumin            29     g/L    ( 35-50    )
+AP                166     IU/L   ( 30-120   )
+GGT               222     IU/L   ( 10-65    )
+ALT               134     IU/L   ( <4      )
+AST                56     IU/L   ( <1      )
+Bili Total          6     umol/L ( <19      )
+Protein Total      77     g/L    ( 65-85    )
+C-React Prot       23     mg/L   ( <5       )
+LIPIDS
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
diff --git a/hapi-fhir-structures-dstu2/src/test/resources/examples-json.zip b/hapi-fhir-structures-dstu2/src/test/resources/examples-json.zip new file mode 100644 index 00000000000..8b2e1e40412 Binary files /dev/null and b/hapi-fhir-structures-dstu2/src/test/resources/examples-json.zip differ diff --git a/hapi-fhir-structures-dstu2/src/test/resources/examples.zip b/hapi-fhir-structures-dstu2/src/test/resources/examples.zip new file mode 100644 index 00000000000..940578cec75 Binary files /dev/null and b/hapi-fhir-structures-dstu2/src/test/resources/examples.zip differ diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java new file mode 100644 index 00000000000..058c49ed5ff --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java @@ -0,0 +1,406 @@ +package ca.uhn.fhir.rest.server.provider.dstu2hl7org; + +/* + * #%L + * HAPI FHIR Structures - DSTU2 (FHIR v0.4.0) + * %% + * Copyright (C) 2014 - 2015 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import org.apache.commons.lang3.Validate; +import org.hl7.fhir.instance.model.Bundle; +import org.hl7.fhir.instance.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.instance.model.Bundle.BundleLinkComponent; +import org.hl7.fhir.instance.model.Bundle.HttpVerb; +import org.hl7.fhir.instance.model.Bundle.SearchEntryMode; +import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.IdType; +import org.hl7.fhir.instance.model.InstantType; +import org.hl7.fhir.instance.model.OperationOutcome; +import org.hl7.fhir.instance.model.Resource; +import org.hl7.fhir.instance.model.api.IAnyResource; +import org.hl7.fhir.instance.model.api.IDomainResource; +import org.hl7.fhir.instance.model.api.IIdType; +import org.hl7.fhir.instance.model.api.IReference; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.context.RuntimeResourceDefinition; +import ca.uhn.fhir.model.api.Include; +import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.model.valueset.BundleTypeEnum; +import ca.uhn.fhir.rest.server.AddProfileTagEnum; +import ca.uhn.fhir.rest.server.BundleInclusionRule; +import ca.uhn.fhir.rest.server.Constants; +import ca.uhn.fhir.rest.server.EncodingEnum; +import ca.uhn.fhir.rest.server.IBundleProvider; +import ca.uhn.fhir.rest.server.IPagingProvider; +import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory; +import ca.uhn.fhir.rest.server.RestfulServer; +import ca.uhn.fhir.rest.server.RestfulServerUtils; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.util.ResourceReferenceInfo; + +public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory { + + private Bundle myBundle; + private FhirContext myContext; + + public Dstu2Hl7OrgBundleFactory(FhirContext theContext) { + myContext = theContext; + } + + @Override + public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { + if (myBundle == null) { + myBundle = new Bundle(); + } + + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); + + for (IBaseResource next : theResult) { + if (next.getId().isEmpty() == false) { + addedResourceIds.add(next.getId()); + } + } + + for (IBaseResource nextBaseRes : theResult) { + if (!(nextBaseRes instanceof IDomainResource)) { + continue; + } + IDomainResource next = (IDomainResource) nextBaseRes; + + Set containedIds = new HashSet(); + for (IAnyResource nextContained : next.getContained()) { + if (nextContained.getId().isEmpty() == false) { + containedIds.add(nextContained.getId().getValue()); + } + } + + List references = myContext.newTerser().getAllResourceReferences(next); + do { + List addedResourcesThisPass = new ArrayList(); + + for (ResourceReferenceInfo nextRefInfo : references) { + if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) + continue; + + IBaseResource nextRes = (IBaseResource) nextRefInfo.getResourceReference().getResource(); + if (nextRes != null) { + if (nextRes.getId().hasIdPart()) { + if (containedIds.contains(nextRes.getId().getValue())) { + // Don't add contained IDs as top level resources + continue; + } + + IdType id = (IdType) nextRes.getId(); + if (id.hasResourceType() == false) { + String resName = myContext.getResourceDefinition(nextRes).getName(); + id = id.withResourceType(resName); + } + + if (!addedResourceIds.contains(id)) { + addedResourceIds.add(id); + addedResourcesThisPass.add(nextRes); + } + + } + } + } + + includedResources.addAll(addedResourcesThisPass); + + // Linked resources may themselves have linked resources + references = new ArrayList(); + for (IBaseResource iResource : addedResourcesThisPass) { + List newReferences = myContext.newTerser().getAllResourceReferences(iResource); + references.addAll(newReferences); + } + } while (references.isEmpty() == false); + + BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); + +// BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(next); +// if (searchMode != null) { +// entry.getSearch().getModeElement().setValue(searchMode.getCode()); +// } + } + + /* + * Actually add the resources to the bundle + */ + for (IBaseResource next : includedResources) { + myBundle.addEntry().setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); + } + + } + + @Override + public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType) { + + if (myBundle.getId().isEmpty()) { + myBundle.setId(UUID.randomUUID().toString()); + } + + InstantDt published = new InstantDt(); + published.setToCurrentTimeInLocalTimeZone(); + + if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theCompleteUrl)) { + myBundle.addLink().setRelation("self").setUrl(theCompleteUrl); + } + + if (isBlank(myBundle.getBase()) && isNotBlank(theServerBase)) { + myBundle.setBase(theServerBase); + } + + if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { + myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); + } + + if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { + myBundle.getTotalElement().setValue(theTotalResults); + } + } + + private boolean hasLink(String theLinkType, Bundle theBundle) { + for (BundleLinkComponent next : theBundle.getLink()) { + if (theLinkType.equals(next.getRelation())) { + return true; + } + } + return false; + } + + @Override + public void initializeBundleFromBundleProvider(RestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { + int numToReturn; + String searchId = null; + List resourceList; + if (theServer.getPagingProvider() == null) { + numToReturn = theResult.size(); + resourceList = theResult.getResources(0, numToReturn); + RestfulServerUtils.validateResourceListNotNull(resourceList); + + } else { + IPagingProvider pagingProvider = theServer.getPagingProvider(); + if (theLimit == null) { + numToReturn = pagingProvider.getDefaultPageSize(); + } else { + numToReturn = Math.min(pagingProvider.getMaximumPageSize(), theLimit); + } + + numToReturn = Math.min(numToReturn, theResult.size() - theOffset); + resourceList = theResult.getResources(theOffset, numToReturn + theOffset); + RestfulServerUtils.validateResourceListNotNull(resourceList); + + if (theSearchId != null) { + searchId = theSearchId; + } else { + if (theResult.size() > numToReturn) { + searchId = pagingProvider.storeResultList(theResult); + Validate.notNull(searchId, "Paging provider returned null searchId"); + } + } + } + + for (IBaseResource next : resourceList) { + if (next.getId() == null || next.getId().isEmpty()) { + if (!(next instanceof OperationOutcome)) { + throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IBaseResource#setId(IdDt) must be called)"); + } + } + } + + if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { + for (IBaseResource nextRes : resourceList) { + RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); + if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { + RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); + } + } + } + + addResourcesToBundle(resourceList, theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); + addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType); + + if (theServer.getPagingProvider() != null) { + int limit; + limit = theLimit != null ? theLimit : theServer.getPagingProvider().getDefaultPageSize(); + limit = Math.min(limit, theServer.getPagingProvider().getMaximumPageSize()); + + if (searchId != null) { + if (theOffset + numToReturn < theResult.size()) { + myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(RestfulServerUtils.createPagingLink(theIncludes, theServerBase, searchId, theOffset + numToReturn, numToReturn, theResponseEncoding, thePrettyPrint)); + } + if (theOffset > 0) { + int start = Math.max(0, theOffset - limit); + myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(RestfulServerUtils.createPagingLink(theIncludes, theServerBase, searchId, start, limit, theResponseEncoding, thePrettyPrint)); + } + } + } + } + + @Override + public ca.uhn.fhir.model.api.Bundle getDstu1Bundle() { + return null; + } + + @Override + public IBaseResource getResourceBundle() { + return myBundle; + } + + @Override + public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { + myBundle = new Bundle(); + + myBundle.setId(UUID.randomUUID().toString()); + + myBundle.getMeta().setLastUpdatedElement(InstantType.withCurrentTime()); + + myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase); + myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl); + myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); + + if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) { + for (IBaseResource nextBaseRes : theResources) { + IBaseResource next = (IBaseResource)nextBaseRes; + BundleEntryComponent nextEntry = myBundle.addEntry(); + + nextEntry.setResource((Resource) next); + if (next.getId().isEmpty()) { + nextEntry.getTransaction().setMethod(HttpVerb.POST); + } else { + nextEntry.getTransaction().setMethod(HttpVerb.PUT); + if (next.getId().isAbsolute()) { + nextEntry.getTransaction().setUrl(next.getId().getValue()); + } else { + String resourceType = myContext.getResourceDefinition(next).getName(); + nextEntry.getTransaction().setUrl(new IdType(theServerBase, resourceType, next.getId().getIdPart(), next.getId().getVersionIdPart()).getValue()); + } + } + } + } else { + addResourcesForSearch(theResources); + } + + myBundle.getTotalElement().setValue(theTotalResults); + } + + private void addResourcesForSearch(List theResult) { + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); + + for (IBaseResource next : theResult) { + if (next.getId().isEmpty() == false) { + addedResourceIds.add(next.getId()); + } + } + + for (IBaseResource nextBaseRes : theResult) { + IDomainResource next = (IDomainResource)nextBaseRes; + Set containedIds = new HashSet(); + for (IBaseResource nextContained : next.getContained()) { + if (nextContained.getId().isEmpty() == false) { + containedIds.add(nextContained.getId().getValue()); + } + } + + List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IReference.class); + do { + List addedResourcesThisPass = new ArrayList(); + + for (IReference nextRef : references) { + IBaseResource nextRes = (IBaseResource) nextRef.getResource(); + if (nextRes != null) { + if (nextRes.getId().hasIdPart()) { + if (containedIds.contains(nextRes.getId().getValue())) { + // Don't add contained IDs as top level resources + continue; + } + + IIdType id = nextRes.getId(); + if (id.hasResourceType() == false) { + String resName = myContext.getResourceDefinition(nextRes).getName(); + id = id.withResourceType(resName); + } + + if (!addedResourceIds.contains(id)) { + addedResourceIds.add(id); + addedResourcesThisPass.add(nextRes); + } + + } + } + } + + // Linked resources may themselves have linked resources + references = new ArrayList(); + for (IBaseResource iResource : addedResourcesThisPass) { + List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IReference.class); + references.addAll(newReferences); + } + + includedResources.addAll(addedResourcesThisPass); + + } while (references.isEmpty() == false); + + myBundle.addEntry().setResource((Resource) next); + + } + + /* + * Actually add the resources to the bundle + */ + for (IBaseResource next : includedResources) { + myBundle.addEntry().setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); + } + } + + @Override + public void initializeWithBundleResource(IBaseResource theBundle) { + myBundle = (Bundle) theBundle; + } + + @Override + public List toListOfResources() { + ArrayList retVal = new ArrayList(); + for (BundleEntryComponent next : myBundle.getEntry()) { + if (next.getResource()!=null) { + retVal.add(next.getResource()); + } else if (next.getTransactionResponse().getLocationElement().isEmpty() == false) { + IdType id = new IdType(next.getTransactionResponse().getLocation()); + String resourceType = id.getResourceType(); + if (isNotBlank(resourceType)) { + IBaseResource res = (IBaseResource) myContext.getResourceDefinition(resourceType).newInstance(); + res.setId(id); + retVal.add(res); + } + } + } + return retVal; + } + +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/FhirDstu2Hl7Org.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/FhirDstu2Hl7Org.java index e8d9761dc73..ddf941441c7 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/FhirDstu2Hl7Org.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/FhirDstu2Hl7Org.java @@ -38,6 +38,7 @@ import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory; import ca.uhn.fhir.rest.server.RestfulServer; +import ca.uhn.fhir.rest.server.provider.dstu2hl7org.Dstu2Hl7OrgBundleFactory; public class FhirDstu2Hl7Org implements IFhirVersion { @@ -109,7 +110,7 @@ public class FhirDstu2Hl7Org implements IFhirVersion { @Override public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) { - throw new UnsupportedOperationException(); + return new Dstu2Hl7OrgBundleFactory(theContext); } } diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/conf/ServerConformanceProvider.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/conf/ServerConformanceProvider.java index 263779768c2..e454cdce48f 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/conf/ServerConformanceProvider.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/conf/ServerConformanceProvider.java @@ -97,7 +97,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider extends Type implements IPrimitiveType @Override public boolean isEmpty() { - return super.isEmpty() && getValue() == null; + return super.isEmpty() && StringUtils.isBlank(getValueAsString()); } public PrimitiveType setValue(T theValue) { diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Resource.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Resource.java index ac592f2fbcd..e33672ac713 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Resource.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Resource.java @@ -132,7 +132,13 @@ public abstract class Resource extends Base implements IAnyResource { * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. */ public Resource setId(IIdType value) { - this.id = (IdType) value; + if (value == null) { + this.id = null; + } else if (value instanceof IdType) { + this.id = (IdType) value; + } else { + this.id = new IdType(value.getValue()); + } return this; } diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/StringType.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/StringType.java index a38c7c8e839..80fb4ade02f 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/StringType.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/StringType.java @@ -72,15 +72,6 @@ public class StringType extends PrimitiveType { return getValue(); } - /** - * Returns true if this datatype has no extensions, and has either a null value or an empty ("") value. - */ - @Override - public boolean isEmpty() { - boolean retVal = super.isEmpty() && StringUtils.isBlank(getValue()); - return retVal; - } - @Override protected String parse(String theValue) { return theValue; diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java index e528b9ba835..7c939e2f81f 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.hl7.fhir.instance.model.IPrimitiveType; import org.hl7.fhir.instance.model.annotations.DatatypeDef; import org.hl7.fhir.instance.model.api.IBaseXhtml; @@ -285,6 +286,9 @@ public class XhtmlNode implements IBaseXhtml { } public String getValueAsString() { + if (isEmpty()) { + return null; + } try { return new XhtmlComposer().compose(this); } catch (Exception e) { @@ -295,9 +299,30 @@ public class XhtmlNode implements IBaseXhtml { @Override public void setValueAsString(String theValue) throws IllegalArgumentException { + this.Attributes = null; + this.childNodes = null; + this.content = null; + this.name = null; + this.nodeType= null; + if (theValue == null) { + return; + } + + String val = theValue.trim(); + if (StringUtils.isBlank(theValue)) { + return; + } + + if (!val.startsWith("<")) { + val = "
" + val + "
"; + } + if (val.startsWith("")) { + return; + } + try { // TODO: this is ugly - XhtmlNode fragment = new XhtmlParser().parseFragment(theValue); + XhtmlNode fragment = new XhtmlParser().parseFragment(val); this.Attributes = fragment.Attributes; this.childNodes = fragment.childNodes; this.content = fragment.content; diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlParser.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlParser.java index a972ff7e459..f6f651d1c03 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlParser.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlParser.java @@ -919,9 +919,10 @@ private boolean elementIsOk(String name) throws Exception { throw new Exception("Unable to Parse HTML - does not start with tag. Found "+peekChar()+descLoc()); readChar(); String n = readName().toLowerCase(); - readToTagEnd(); XhtmlNode result = new XhtmlNode(NodeType.Element); result.setName(n); + parseAttributes(result); + readToTagEnd(); unwindPoint = null; List p = new ArrayList(); parseElementInner(result, p); diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/resources/org/hl7/fhir/instance/model/fhirversion.properties b/hapi-fhir-structures-hl7org-dstu2/src/main/resources/org/hl7/fhir/instance/model/fhirversion.properties index 5e70c0d9b0f..9bf9713e1c6 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/resources/org/hl7/fhir/instance/model/fhirversion.properties +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/resources/org/hl7/fhir/instance/model/fhirversion.properties @@ -1,15 +1,18 @@ # This file contains version definitions -resource.Alert=org.hl7.fhir.instance.model.Alert resource.AllergyIntolerance=org.hl7.fhir.instance.model.AllergyIntolerance resource.Appointment=org.hl7.fhir.instance.model.Appointment resource.AppointmentResponse=org.hl7.fhir.instance.model.AppointmentResponse +resource.AuditEvent=org.hl7.fhir.instance.model.AuditEvent resource.Basic=org.hl7.fhir.instance.model.Basic resource.Binary=org.hl7.fhir.instance.model.Binary +resource.BodySite=org.hl7.fhir.instance.model.BodySite +resource.Bundle=org.hl7.fhir.instance.model.Bundle resource.CarePlan=org.hl7.fhir.instance.model.CarePlan resource.CarePlan2=org.hl7.fhir.instance.model.CarePlan2 +resource.Claim=org.hl7.fhir.instance.model.Claim resource.ClaimResponse=org.hl7.fhir.instance.model.ClaimResponse -resource.ClinicalAssessment=org.hl7.fhir.instance.model.ClinicalAssessment +resource.ClinicalImpression=org.hl7.fhir.instance.model.ClinicalImpression resource.Communication=org.hl7.fhir.instance.model.Communication resource.CommunicationRequest=org.hl7.fhir.instance.model.CommunicationRequest resource.Composition=org.hl7.fhir.instance.model.Composition @@ -36,8 +39,8 @@ resource.EnrollmentRequest=org.hl7.fhir.instance.model.EnrollmentRequest resource.EnrollmentResponse=org.hl7.fhir.instance.model.EnrollmentResponse resource.EpisodeOfCare=org.hl7.fhir.instance.model.EpisodeOfCare resource.ExplanationOfBenefit=org.hl7.fhir.instance.model.ExplanationOfBenefit -resource.ExtensionDefinition=org.hl7.fhir.instance.model.ExtensionDefinition -resource.FamilyHistory=org.hl7.fhir.instance.model.FamilyHistory +resource.FamilyMemberHistory=org.hl7.fhir.instance.model.FamilyMemberHistory +resource.Flag=org.hl7.fhir.instance.model.Flag resource.Goal=org.hl7.fhir.instance.model.Goal resource.Group=org.hl7.fhir.instance.model.Group resource.HealthcareService=org.hl7.fhir.instance.model.HealthcareService @@ -45,8 +48,7 @@ resource.ImagingObjectSelection=org.hl7.fhir.instance.model.ImagingObjectSelecti resource.ImagingStudy=org.hl7.fhir.instance.model.ImagingStudy resource.Immunization=org.hl7.fhir.instance.model.Immunization resource.ImmunizationRecommendation=org.hl7.fhir.instance.model.ImmunizationRecommendation -resource.InstitutionalClaim=org.hl7.fhir.instance.model.InstitutionalClaim -resource.List=org.hl7.fhir.instance.model.List_ +resource.List=org.hl7.fhir.instance.model.ListResource resource.Location=org.hl7.fhir.instance.model.Location resource.Media=org.hl7.fhir.instance.model.Media resource.Medication=org.hl7.fhir.instance.model.Medication @@ -60,61 +62,52 @@ resource.NutritionOrder=org.hl7.fhir.instance.model.NutritionOrder resource.Observation=org.hl7.fhir.instance.model.Observation resource.OperationDefinition=org.hl7.fhir.instance.model.OperationDefinition resource.OperationOutcome=org.hl7.fhir.instance.model.OperationOutcome -resource.OralHealthClaim=org.hl7.fhir.instance.model.OralHealthClaim resource.Order=org.hl7.fhir.instance.model.Order resource.OrderResponse=org.hl7.fhir.instance.model.OrderResponse resource.Organization=org.hl7.fhir.instance.model.Organization -resource.Other=org.hl7.fhir.instance.model.Other +resource.Parameters=org.hl7.fhir.instance.model.Parameters resource.Patient=org.hl7.fhir.instance.model.Patient resource.PaymentNotice=org.hl7.fhir.instance.model.PaymentNotice resource.PaymentReconciliation=org.hl7.fhir.instance.model.PaymentReconciliation -resource.PendedRequest=org.hl7.fhir.instance.model.PendedRequest resource.Person=org.hl7.fhir.instance.model.Person -resource.PharmacyClaim=org.hl7.fhir.instance.model.PharmacyClaim resource.Practitioner=org.hl7.fhir.instance.model.Practitioner resource.Procedure=org.hl7.fhir.instance.model.Procedure resource.ProcedureRequest=org.hl7.fhir.instance.model.ProcedureRequest -resource.ProfessionalClaim=org.hl7.fhir.instance.model.ProfessionalClaim -resource.Profile=org.hl7.fhir.instance.model.Profile +resource.ProcessRequest=org.hl7.fhir.instance.model.ProcessRequest +resource.ProcessResponse=org.hl7.fhir.instance.model.ProcessResponse resource.Provenance=org.hl7.fhir.instance.model.Provenance resource.Questionnaire=org.hl7.fhir.instance.model.Questionnaire resource.QuestionnaireAnswers=org.hl7.fhir.instance.model.QuestionnaireAnswers -resource.Readjudicate=org.hl7.fhir.instance.model.Readjudicate resource.ReferralRequest=org.hl7.fhir.instance.model.ReferralRequest resource.RelatedPerson=org.hl7.fhir.instance.model.RelatedPerson -resource.Reversal=org.hl7.fhir.instance.model.Reversal resource.RiskAssessment=org.hl7.fhir.instance.model.RiskAssessment resource.Schedule=org.hl7.fhir.instance.model.Schedule resource.SearchParameter=org.hl7.fhir.instance.model.SearchParameter -resource.SecurityEvent=org.hl7.fhir.instance.model.SecurityEvent resource.Slot=org.hl7.fhir.instance.model.Slot resource.Specimen=org.hl7.fhir.instance.model.Specimen -resource.StatusRequest=org.hl7.fhir.instance.model.StatusRequest -resource.StatusResponse=org.hl7.fhir.instance.model.StatusResponse +resource.StructureDefinition=org.hl7.fhir.instance.model.StructureDefinition resource.Subscription=org.hl7.fhir.instance.model.Subscription resource.Substance=org.hl7.fhir.instance.model.Substance resource.Supply=org.hl7.fhir.instance.model.Supply -resource.SupportingDocumentation=org.hl7.fhir.instance.model.SupportingDocumentation resource.ValueSet=org.hl7.fhir.instance.model.ValueSet -resource.VisionClaim=org.hl7.fhir.instance.model.VisionClaim resource.VisionPrescription=org.hl7.fhir.instance.model.VisionPrescription -datatype.Address=org.hl7.fhir.instance.model.Address -datatype.Attachment=org.hl7.fhir.instance.model.Attachment -datatype.CodeableConcept=org.hl7.fhir.instance.model.CodeableConcept -datatype.Coding=org.hl7.fhir.instance.model.Coding -datatype.ContactPoint=org.hl7.fhir.instance.model.ContactPoint -datatype.ElementDefinition=org.hl7.fhir.instance.model.ElementDefinition -datatype.HumanName=org.hl7.fhir.instance.model.HumanName -datatype.Identifier=org.hl7.fhir.instance.model.Identifier -datatype.Meta=org.hl7.fhir.instance.model.Meta -datatype.Period=org.hl7.fhir.instance.model.Period -datatype.Quantity=org.hl7.fhir.instance.model.Quantity -datatype.Range=org.hl7.fhir.instance.model.Range -datatype.Ratio=org.hl7.fhir.instance.model.Ratio -datatype.Reference=org.hl7.fhir.instance.model.Reference -datatype.SampledData=org.hl7.fhir.instance.model.SampledData -datatype.Timing=org.hl7.fhir.instance.model.Timing +datatype.Address=org.hl7.fhir.instance.model.AddressType +datatype.Attachment=org.hl7.fhir.instance.model.AttachmentType +datatype.CodeableConcept=org.hl7.fhir.instance.model.CodeableConceptType +datatype.Coding=org.hl7.fhir.instance.model.CodingType +datatype.ContactPoint=org.hl7.fhir.instance.model.ContactPointType +datatype.ElementDefinition=org.hl7.fhir.instance.model.ElementDefinitionType +datatype.HumanName=org.hl7.fhir.instance.model.HumanNameType +datatype.Identifier=org.hl7.fhir.instance.model.IdentifierType +datatype.Meta=org.hl7.fhir.instance.model.MetaType +datatype.Period=org.hl7.fhir.instance.model.PeriodType +datatype.Quantity=org.hl7.fhir.instance.model.QuantityType +datatype.Range=org.hl7.fhir.instance.model.RangeType +datatype.Ratio=org.hl7.fhir.instance.model.RatioType +datatype.SampledData=org.hl7.fhir.instance.model.SampledDataType +datatype.Signature=org.hl7.fhir.instance.model.SignatureType +datatype.Timing=org.hl7.fhir.instance.model.TimingType datatype.base64Binary=org.hl7.fhir.instance.model.Base64BinaryType datatype.boolean=org.hl7.fhir.instance.model.BooleanType datatype.code=org.hl7.fhir.instance.model.CodeType @@ -122,9 +115,13 @@ datatype.date=org.hl7.fhir.instance.model.DateType datatype.dateTime=org.hl7.fhir.instance.model.DateTimeType datatype.decimal=org.hl7.fhir.instance.model.DecimalType datatype.id=org.hl7.fhir.instance.model.IdType +datatype.idref=org.hl7.fhir.instance.model.IdrefType datatype.instant=org.hl7.fhir.instance.model.InstantType datatype.integer=org.hl7.fhir.instance.model.IntegerType datatype.oid=org.hl7.fhir.instance.model.OidType +datatype.positiveInt=org.hl7.fhir.instance.model.PositiveIntType datatype.string=org.hl7.fhir.instance.model.StringType datatype.time=org.hl7.fhir.instance.model.TimeType +datatype.unsignedInt=org.hl7.fhir.instance.model.UnsignedIntType datatype.uri=org.hl7.fhir.instance.model.UriType +datatype.xhtml=org.hl7.fhir.instance.model.XhtmlType diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java index 2d474427989..2010cd05fce 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java @@ -24,6 +24,7 @@ import org.hl7.fhir.instance.model.IntegerType; import org.hl7.fhir.instance.model.List_; import org.hl7.fhir.instance.model.Meta; import org.hl7.fhir.instance.model.Narrative; +import org.hl7.fhir.instance.model.Parameters; import org.hl7.fhir.instance.model.PrimitiveType; import org.hl7.fhir.instance.model.Reference; import org.hl7.fhir.instance.model.Resource; @@ -43,6 +44,7 @@ import org.hl7.fhir.instance.model.api.IBaseExtension; import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions; import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype; +import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IBaseXhtml; import org.hl7.fhir.instance.model.api.ICoding; import org.hl7.fhir.instance.model.api.IDatatypeElement; @@ -199,6 +201,11 @@ public class ModelInheritanceTest { assertTrue(IReference.class.isAssignableFrom(Reference.class)); } + @Test + public void testParameters() { + assertTrue(IBaseParameters.class.isAssignableFrom(Parameters.class)); + } + @Test public void testResource() { assertTrue(IAnyResource.class.isAssignableFrom(Resource.class)); diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java new file mode 100644 index 00000000000..36b77c32d08 --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/XhtmlNodeTest.java @@ -0,0 +1,22 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.*; + +import org.hl7.fhir.instance.model.Narrative; +import org.hl7.fhir.utilities.xhtml.XhtmlNode; +import org.junit.Test; + +public class XhtmlNodeTest { + + @Test + public void testNamespaces() { + + Narrative type = new Narrative(); + XhtmlNode div = type.getDiv(); + div.setValue("hello"); + + assertEquals("hello", div.getValue()); + + } + +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgTest.java similarity index 83% rename from hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java rename to hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgTest.java index ded9fe12665..6f9539ba901 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgTest.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringReader; import java.nio.charset.Charset; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -49,7 +48,6 @@ import org.hl7.fhir.instance.model.Narrative.NarrativeStatus; import org.hl7.fhir.instance.model.Observation; import org.hl7.fhir.instance.model.Organization; import org.hl7.fhir.instance.model.Patient; -import org.hl7.fhir.instance.model.Profile; import org.hl7.fhir.instance.model.Reference; import org.hl7.fhir.instance.model.Specimen; import org.hl7.fhir.instance.model.StringType; @@ -68,68 +66,12 @@ import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.narrative.INarrativeGenerator; -public class JsonParserTest { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserTest.class); +public class JsonParserHl7OrgTest { private static FhirContext ourCtx; + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserHl7OrgTest.class); - @Test - public void testEncodeNarrativeBlockInBundle() throws Exception { - Patient p = new Patient(); - p.addIdentifier().setSystem("foo").setValue("bar"); - p.getText().setStatus(NarrativeStatus.GENERATED); - p.getText().setDivAsString("
hello
"); - - Bundle b = new Bundle(); - b.setTotal(123); - b.addEntry().setResource(p); - - String out = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); - ourLog.info(out); - assertThat(out, containsString("
hello
")); - - // TODO: what's the right thing to do here? -// p.getText().setDivAsString("hello"); -// out = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); -// ourLog.info(out); -// // Backslashes need to be escaped because they are in a JSON value -// assertThat(out, containsString("
hello
")); - - } - @Test - public void testSimpleResourceEncodeWithCustomType() throws IOException, SAXException { - - FhirContext fhirCtx = new FhirContext(MyObservationWithExtensions.class); - String xmlString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"), Charset.forName("UTF-8")); - MyObservationWithExtensions obs = fhirCtx.newJsonParser().parseResource(MyObservationWithExtensions.class, xmlString); - - assertEquals(0, obs.getExtension().size()); - assertEquals("aaaa", obs.getExtAtt().getContentType()); - assertEquals("str1", obs.getMoreExt().getStr1().getValue()); - assertEquals("2011-01-02", obs.getModExt().getValueAsString()); - - List undeclaredExtensions = obs.getContact().get(0).getName().getFamily().get(0).getExtension(); - org.hl7.fhir.instance.model.Extension undeclaredExtension = undeclaredExtensions.get(0); - assertEquals("http://hl7.org/fhir/Profile/iso-21090#qualifier", undeclaredExtension.getUrl()); - - fhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToWriter(obs, new OutputStreamWriter(System.out)); - - IParser jsonParser = fhirCtx.newXmlParser(); - String encoded = jsonParser.encodeResourceToString(obs); - ourLog.info(encoded); - - String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.xml"), Charset.forName("UTF-8")); - - String expected = (jsonString); - String actual = (encoded.trim()); - - Diff d = new Diff(new StringReader(expected), new StringReader(actual)); - assertTrue(d.toString(), d.identical()); - - } - - @Test public void testEncodeAndParseExtensions() throws Exception { @@ -242,146 +184,6 @@ public class JsonParserTest { } - @Test - public void testEncodeNonContained() { - Organization org = new Organization(); - org.setId("Organization/65546"); - org.getNameElement().setValue("Contained Test Organization"); - - Patient patient = new Patient(); - patient.setId("Patient/1333"); - patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); - patient.getManagingOrganization().setResource(org); - - Bundle b = new Bundle(); - b.addEntry().setResource(patient); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); - ourLog.info(encoded); - assertThat(encoded, not(containsString("contained"))); - assertThat(encoded, containsString("\"reference\":\"Organization/65546\"")); - - encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); - ourLog.info(encoded); - assertThat(encoded, not(containsString("contained"))); - assertThat(encoded, containsString("\"reference\":\"Organization/65546\"")); - } - - - @Test - public void testEncodeIds() { - Patient pt = new Patient(); - pt.addIdentifier().setSystem("sys").setValue( "val"); - - List_ list = new List_(); - list.setId("listId"); - list.addEntry().setItem(new Reference(pt)).setDeleted(true); - - String enc = ourCtx.newJsonParser().encodeResourceToString(list); - ourLog.info(enc); - - assertThat(enc, containsString("\"id\":\"1\"")); - - List_ parsed = ourCtx.newJsonParser().parseResource(List_.class,enc); - assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass()); - - enc = enc.replace("\"id\"", "\"_id\""); - parsed = ourCtx.newJsonParser().parseResource(List_.class,enc); - assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass()); -} - - @Test - public void testEncodingNullExtension() { - Patient p = new Patient(); - Extension extension = new Extension().setUrl("http://foo#bar"); - p.getExtension().add(extension); - String str = ourCtx.newJsonParser().encodeResourceToString(p); - - assertEquals("{\"resourceType\":\"Patient\"}", str); - - extension.setValue(new StringType()); - - str = ourCtx.newJsonParser().encodeResourceToString(p); - assertEquals("{\"resourceType\":\"Patient\"}", str); - - extension.setValue(new StringType("")); - - str = ourCtx.newJsonParser().encodeResourceToString(p); - assertEquals("{\"resourceType\":\"Patient\"}", str); - - } - - @Test - public void testParseSingleQuotes() { - try { - ourCtx.newJsonParser().parseResource(Bundle.class, "{ 'resourceType': 'Bundle' }"); - fail(); - } catch (DataFormatException e) { - // Should be an error message about how single quotes aren't valid JSON - assertThat(e.getMessage(), containsString("double quote")); - } - } - - @Test - public void testEncodeExtensionInCompositeElement() { - - Conformance c = new Conformance(); - c.addRest().getSecurity().addExtension().setUrl("http://foo").setValue(new StringType("AAA")); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); - ourLog.info(encoded); - - encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); - ourLog.info(encoded); - assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"rest\":[{\"security\":{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}}]}"); - - } - - @Test - public void testEncodeExtensionInPrimitiveElement() { - - Conformance c = new Conformance(); - c.getAcceptUnknownElement().addExtension().setUrl( "http://foo").setValue( new StringType("AAA")); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); - ourLog.info(encoded); - - encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); - ourLog.info(encoded); - assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"_acceptUnknown\":[{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}]}"); - - // Now with a value - ourLog.info("---------------"); - - c = new Conformance(); - c.getAcceptUnknownElement().setValue(true); - c.getAcceptUnknownElement().addExtension().setUrl("http://foo").setValue( new StringType("AAA")); - - encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); - ourLog.info(encoded); - - encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); - ourLog.info(encoded); - assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"acceptUnknown\":true,\"_acceptUnknown\":[{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}]}"); - - } - - @Test - public void testEncodeExtensionInResourceElement() { - - Conformance c = new Conformance(); - // c.addRest().getSecurity().addUndeclaredExtension(false, "http://foo", new StringType("AAA")); - c.addExtension().setUrl("http://foo").setValue( new StringType("AAA")); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); - ourLog.info(encoded); - - encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); - ourLog.info(encoded); - assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}"); - - } - @Test public void testEncodeBinaryResource() { @@ -394,154 +196,67 @@ public class JsonParserTest { } - @Test - public void testParseEmptyNarrative() throws Exception { - //@formatter:off - String text = "{\n" + - " \"resourceType\" : \"Patient\",\n" + - " \"extension\" : [\n" + - " {\n" + - " \"url\" : \"http://clairol.org/colour\",\n" + - " \"valueCode\" : \"B\"\n" + - " }\n" + - " ],\n" + - " \"text\" : {\n" + - " \"div\" : \"\"\n" + - " }" + - "}"; - //@formatter:on - - Patient res = (Patient) ourCtx.newJsonParser().parseResource(text); - XhtmlNode div = res.getText().getDiv(); - String value = div.getValueAsString(); - - assertEquals("", value); - assertTrue(div.getChildNodes().isEmpty()); - } @Test - public void testNestedContainedResources() { + public void testEncodeBundle() throws InterruptedException { + Bundle b = new Bundle(); - Observation A = new Observation(); - A.getCode().setText("A"); + InstantType pub = InstantType.now(); + b.getMeta().setLastUpdatedElement(pub); + Thread.sleep(2); - Observation B = new Observation(); - B.getCode().setText("B"); - A.addRelated().setTarget(new Reference(B)); + Patient p1 = new Patient(); + p1.addName().addFamily("Family1"); + p1.setId("1"); + BundleEntryComponent entry = b.addEntry(); + entry.setResource(p1); - Observation C = new Observation(); - C.getCode().setText("C"); - B.addRelated().setTarget(new Reference(C)); + Patient p2 = new Patient(); + p2.setId("Patient/2"); + p2.addName().addFamily("Family2"); + entry = b.addEntry(); + entry.setResource(p2); - String str = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(A); - ourLog.info(str); - - assertThat(str, stringContainsInOrder(Arrays.asList("\"text\":\"B\"", "\"text\":\"C\"", "\"text\":\"A\""))); - - // Only one (outer) contained block - int idx0 = str.indexOf("\"contained\""); - int idx1 = str.indexOf("\"contained\"", idx0 + 1); - - assertNotEquals(-1, idx0); - assertEquals(-1, idx1); - - Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, str); - assertEquals("A", obs.getCode().getTextElement().getValue()); - - Observation obsB = (Observation) obs.getRelated().get(0).getTarget().getResource(); - assertEquals("B", obsB.getCode().getTextElement().getValue()); - - Observation obsC = (Observation) obsB.getRelated().get(0).getTarget().getResource(); - assertEquals("C", obsC.getCode().getTextElement().getValue()); - - } - - - - @Test - public void testParseBinaryResource() { - - Binary val = ourCtx.newJsonParser().parseResource(Binary.class, "{\"resourceType\":\"Binary\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}"); - assertEquals("foo", val.getContentType()); - assertArrayEquals(new byte[] { 1, 2, 3, 4 }, val.getContent()); - - } - - @Test - public void testTagList() { - - //@formatter:off - String tagListStr = "{\n" + - " \"resourceType\" : \"TagList\", " + - " \"category\" : [" + - " { " + - " \"term\" : \"term0\", " + - " \"label\" : \"label0\", " + - " \"scheme\" : \"scheme0\" " + - " }," + - " { " + - " \"term\" : \"term1\", " + - " \"label\" : \"label1\", " + - " \"scheme\" : null " + - " }," + - " { " + - " \"term\" : \"term2\", " + - " \"label\" : \"label2\" " + - " }" + - " ] " + - "}"; - //@formatter:on - - TagList tagList = new FhirContext().newJsonParser().parseTagList(tagListStr); - assertEquals(3, tagList.size()); - assertEquals("term0", tagList.get(0).getTerm()); - assertEquals("label0", tagList.get(0).getLabel()); - assertEquals("scheme0", tagList.get(0).getScheme()); - assertEquals("term1", tagList.get(1).getTerm()); - assertEquals("label1", tagList.get(1).getLabel()); - assertEquals(null, tagList.get(1).getScheme()); - assertEquals("term2", tagList.get(2).getTerm()); - assertEquals("label2", tagList.get(2).getLabel()); - assertEquals(null, tagList.get(2).getScheme()); - - /* - * Encode - */ - - //@formatter:off - String expected = "{" + - "\"resourceType\":\"TagList\"," + - "\"category\":[" + - "{" + - "\"term\":\"term0\"," + - "\"label\":\"label0\"," + - "\"scheme\":\"scheme0\"" + - "}," + - "{" + - "\"term\":\"term1\"," + - "\"label\":\"label1\"" + - "}," + - "{" + - "\"term\":\"term2\"," + - "\"label\":\"label2\"" + - "}" + - "]" + - "}"; - //@formatter:on - - String encoded = new FhirContext().newJsonParser().encodeTagListToString(tagList); - assertEquals(expected, encoded); - - } - - @Test - public void testParseSimpleBundle() { - String bundle = "{\"resourceType\":\"Bundle\",\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"identifier\":[{\"system\":\"idsystem\"}]}}]}"; - Bundle b = ourCtx.newJsonParser().parseResource(Bundle.class, bundle); + BundleEntryComponent deletedEntry = b.addEntry(); + Patient dp = new Patient(); + deletedEntry.setResource(dp); - assertNotNull(b.getEntry().get(0).getResource()); - Patient p = (Patient) b.getEntry().get(0).getResource(); - assertEquals("idsystem", p.getIdentifier().get(0).getSystem()); + dp.setId(("3")); + InstantType nowDt = InstantType.withCurrentTime(); + dp.getMeta().setDeleted(true); + dp.getMeta().setLastUpdatedElement(nowDt); + + String bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); + ourLog.info(bundleString); + +// List strings = new ArrayList(); +// strings.addAll(Arrays.asList("\"published\":\"" + pub.getValueAsString() + "\"")); +// strings.addAll(Arrays.asList("\"id\":\"1\"")); +// strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\"")); +// strings.addAll(Arrays.asList("\"deleted\":\"" + nowDt.getValueAsString() + "\"", "\"id\":\"Patient/3\"")); + + //@formatter:off + String[] strings = new String[] { + "\"resourceType\":\"Bundle\",", + "\"lastUpdated\":\"" + pub.getValueAsString() + "\"", + "\"entry\":[", + "\"resource\":{", + "\"id\":\"1\"", + "\"resource\":{", + "\"id\":\"2\"", + "\"resource\":{", + "\"id\":\"3\"", + "\"meta\":{", + "\"lastUpdated\":\"" + nowDt.getValueAsString() + "\"", + "\"deleted\":true" + }; + //@formatter:off + assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings)); + + b.getEntry().remove(2); + bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); + assertThat(bundleString, not(containsString("deleted"))); + } @@ -572,7 +287,7 @@ public class JsonParserTest { assertEquals("idsystem", p.getIdentifier().get(0).getSystem()); } - + @Test public void testEncodeBundleEntryCategory() { @@ -584,7 +299,7 @@ public class JsonParserTest { String val = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(b); ourLog.info(val); - assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]")); + assertThat(val, StringContains.containsString("{\"resourceType\":\"Bundle\",\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"meta\":{\"tag\":[{\"system\":\"scheme\",\"code\":\"term\",\"display\":\"label\"}]}}}]}")); b = ourCtx.newJsonParser().parseResource(Bundle.class, val); assertEquals(1, b.getEntry().size()); @@ -592,10 +307,72 @@ public class JsonParserTest { assertEquals("scheme", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getSystem()); assertEquals("term", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getCode()); assertEquals("label", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getDisplay()); - assertNull(b.getEntry().get(0).getResource()); } + @Test + public void testEncodeContained() { + IParser jsonParser = ourCtx.newJsonParser().setPrettyPrint(true); + + // Create an organization, note that the organization does not have an ID + Organization org = new Organization(); + org.getNameElement().setValue("Contained Test Organization"); + + // Create a patient + Patient patient = new Patient(); + patient.setId("Patient/1333"); + patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); + + // Put the organization as a reference in the patient resource + patient.getManagingOrganization().setResource(org); + + String encoded = jsonParser.encodeResourceToString(patient); + ourLog.info(encoded); + assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); + + // Create a bundle with just the patient resource + Bundle b = new Bundle(); + b.addEntry().setResource(patient); + + // Encode the bundle + encoded = jsonParser.encodeResourceToString(b); + ourLog.info(encoded); + assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); + + // Re-parse the bundle + patient = (Patient) jsonParser.parseResource(jsonParser.encodeResourceToString(patient)); + assertEquals("#1", patient.getManagingOrganization().getReference().getValue()); + + assertNotNull(patient.getManagingOrganization().getResource()); + org = (Organization) patient.getManagingOrganization().getResource(); + assertEquals("#1", org.getId().getValue()); + assertEquals("Contained Test Organization", org.getName()); + + // And re-encode a second time + encoded = jsonParser.encodeResourceToString(patient); + ourLog.info(encoded); + assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); + assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":")))); + + // And re-encode once more, with the references cleared + patient.getContained().clear(); + patient.getManagingOrganization().setReference(null); + encoded = jsonParser.encodeResourceToString(patient); + ourLog.info(encoded); + assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); + assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":")))); + + // And re-encode once more, with the references cleared and a manually set local ID + patient.getContained().clear(); + patient.getManagingOrganization().setReference(null); + patient.getManagingOrganization().getResource().setId(("#333")); + encoded = jsonParser.encodeResourceToString(patient); + ourLog.info(encoded); + assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"333\"", "\"identifier\"", "\"reference\":\"#333\""))); + assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":")))); + + } + @Test public void testEncodeContained__() { // Create an organization @@ -623,135 +400,8 @@ public class JsonParserTest { assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\"", "resourceType\":\"Organization", "id\":\"1\""))); assertThat(encoded, containsString("reference\":\"#1\"")); } - - @Test - public void testEncodeContainedWithNarrativeIsSuppresed() throws Exception { - IParser parser = ourCtx.newJsonParser().setPrettyPrint(true); - - // Create an organization, note that the organization does not have an ID - Organization org = new Organization(); - org.getNameElement().setValue("Contained Test Organization"); - org.getText().setDivAsString("
FOOBAR
"); - - // Create a patient - Patient patient = new Patient(); - patient.setId("Patient/1333"); - patient.addIdentifier().setSystem("urn:mrns").setValue( "253345"); - patient.getText().setDivAsString("
BARFOO
"); - patient.getManagingOrganization().setResource(org); - - String encoded = parser.encodeResourceToString(patient); - ourLog.info(encoded); - assertThat(encoded, not(containsString("FOOBAR"))); - assertThat(encoded, (containsString("BARFOO"))); - - } - - @Test - public void testEncodeContained() { - IParser xmlParser = ourCtx.newJsonParser().setPrettyPrint(true); - - // Create an organization, note that the organization does not have an ID - Organization org = new Organization(); - org.getNameElement().setValue("Contained Test Organization"); - - // Create a patient - Patient patient = new Patient(); - patient.setId("Patient/1333"); - patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); - - // Put the organization as a reference in the patient resource - patient.getManagingOrganization().setResource(org); - - String encoded = xmlParser.encodeResourceToString(patient); - ourLog.info(encoded); - assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); - - // Create a bundle with just the patient resource - Bundle b = new Bundle(); - b.addEntry().setResource(patient); - - // Encode the bundle - encoded = xmlParser.encodeResourceToString(b); - ourLog.info(encoded); - assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); - - // Re-parse the bundle - patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient)); - assertEquals("#1", patient.getManagingOrganization().getReference()); - - assertNotNull(patient.getManagingOrganization().getResource()); - org = (Organization) patient.getManagingOrganization().getResource(); - assertEquals("#1", org.getId()); - assertEquals("Contained Test Organization", org.getName()); - - // And re-encode a second time - encoded = xmlParser.encodeResourceToString(patient); - ourLog.info(encoded); - assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); - assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":")))); - - // And re-encode once more, with the references cleared - patient.getContained().clear(); - patient.getManagingOrganization().setReference(null); - encoded = xmlParser.encodeResourceToString(patient); - ourLog.info(encoded); - assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\""))); - assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":")))); - - // And re-encode once more, with the references cleared and a manually set local ID - patient.getContained().clear(); - patient.getManagingOrganization().setReference(null); - patient.getManagingOrganization().getResource().setId(("#333")); - encoded = xmlParser.encodeResourceToString(patient); - ourLog.info(encoded); - assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"333\"", "\"identifier\"", "\"reference\":\"#333\""))); - assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":")))); - - } - - - @Test - public void testEncodeContainedResources() throws IOException { - - String msg = IOUtils.toString(XmlParser.class.getResourceAsStream("/contained-diagnosticreport.xml")); - IParser p = ourCtx.newXmlParser(); - DiagnosticReport res = p.parseResource(DiagnosticReport.class, msg); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(res); - ourLog.info(encoded); - - } - - @Test - public void testParseJsonProfile() throws IOException { - parseAndEncode("/patient.profile.json"); - parseAndEncode("/alert.profile.json"); - } - - private void parseAndEncode(String name) throws IOException { - String msg = IOUtils.toString(XmlParser.class.getResourceAsStream(name)); - ourLog.info(msg); - - IParser p = ourCtx.newJsonParser(); - Profile res = p.parseResource(Profile.class, msg); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(res); - ourLog.info(encoded); - - JSON expected = JSONSerializer.toJSON(msg.trim()); - JSON actual = JSONSerializer.toJSON(encoded.trim()); - - String exp = expected.toString().replace("\\r\\n", "\\n"); // .replace("§", "§"); - String act = actual.toString().replace("\\r\\n", "\\n"); - - ourLog.info("Expected: {}", exp); - ourLog.info("Actual : {}", act); - - assertEquals(exp, act); - } @Test public void testEncodeContainedResourcesMore() throws Exception { @@ -777,6 +427,29 @@ public class JsonParserTest { } + @Test + public void testEncodeContainedWithNarrativeIsSuppresed() throws Exception { + IParser parser = ourCtx.newJsonParser().setPrettyPrint(true); + + // Create an organization, note that the organization does not have an ID + Organization org = new Organization(); + org.getNameElement().setValue("Contained Test Organization"); + org.getText().setDivAsString("
FOOBAR
"); + + // Create a patient + Patient patient = new Patient(); + patient.setId("Patient/1333"); + patient.addIdentifier().setSystem("urn:mrns").setValue( "253345"); + patient.getText().setDivAsString("
BARFOO
"); + patient.getManagingOrganization().setResource(org); + + String encoded = parser.encodeResourceToString(patient); + ourLog.info(encoded); + assertThat(encoded, not(containsString("FOOBAR"))); + assertThat(encoded, (containsString("BARFOO"))); + + } + @Test public void testEncodeDeclaredExtensionWithAddressContent() { IParser parser = new FhirContext().newJsonParser(); @@ -806,25 +479,16 @@ public class JsonParserTest { String val = parser.encodeResourceToString(patient); ourLog.info(val); - assertThat(val, StringContains.containsString("\"extension\":[{\"url\":\"urn:foo\",\"valueResource\":{\"reference\":\"Organization/123\"}}]")); + assertThat(val, StringContains.containsString("\"extension\":[{\"url\":\"urn:foo\",\"valueReference\":{\"reference\":\"Organization/123\"}}]")); MyPatientWithOneDeclaredExtension actual = parser.parseResource(MyPatientWithOneDeclaredExtension.class, val); assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse()); Reference ref = actual.getFoo(); - assertEquals("Organization/123", ref.getReference()); + assertEquals("Organization/123", ref.getReference().getValue()); } - @Test - public void testEncodeExtensionOnEmptyElement() throws Exception { - ValueSet valueSet = new ValueSet(); - valueSet.addTelecom().addExtension().setUrl("http://foo").setValue( new StringType("AAA")); - - String encoded = ourCtx.newJsonParser().encodeResourceToString(valueSet); - assertThat(encoded, containsString("\"telecom\":[{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}")); - - } @Test public void testEncodeExt() throws Exception { @@ -849,59 +513,77 @@ public class JsonParserTest { } - @Test - public void testMoreExtensions() throws Exception { + public void testEncodeExtensionInCompositeElement() { - Patient patient = new Patient(); - patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135"); + Conformance c = new Conformance(); + c.addRest().getSecurity().addExtension().setUrl("http://foo").setValue(new StringType("AAA")); - Extension ext = new Extension(); - ext.setUrl("http://example.com/extensions#someext"); - ext.setValue(new DateTimeType("2011-01-02T11:13:15")); + String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); + ourLog.info(encoded); - // Add the extension to the resource - patient.getExtension().add(ext); - // END SNIPPET: resourceExtension + encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); + ourLog.info(encoded); + assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"rest\":[{\"security\":{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}}]}"); - // START SNIPPET: resourceStringExtension - HumanName name = patient.addName(); - name.addFamily("Shmoe"); - StringType given = name.addGivenElement(); - given.setValue("Joe"); - Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("given")); - given.getExtension().add(ext2); - - StringType given2 = name.addGivenElement(); - given2.setValue("Shmoe"); - Extension given2ext = new Extension().setUrl("http://examples.com#givenext_parent"); - given2.getExtension().add(given2ext); - given2ext.addExtension().setUrl("http://examples.com#givenext_child").setValue(new StringType("CHILD")); - // END SNIPPET: resourceStringExtension - - // START SNIPPET: subExtension - Extension parent = new Extension().setUrl("http://example.com#parent"); - patient.getExtension().add(parent); - - Extension child1 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1")); - parent.getExtension().add(child1); - - Extension child2 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1")); - parent.getExtension().add(child2); - // END SNIPPET: subExtension - - String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); - ourLog.info(output); - - String enc = ourCtx.newXmlParser().encodeResourceToString(patient); - assertThat(enc, containsString("")); - assertThat( - enc, - containsString("")); - assertThat(enc, containsString("")); - assertThat(enc, containsString("")); } + @Test + public void testEncodeExtensionInPrimitiveElement() { + + Conformance c = new Conformance(); + c.getAcceptUnknownElement().addExtension().setUrl( "http://foo").setValue( new StringType("AAA")); + + String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); + ourLog.info(encoded); + + encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); + ourLog.info(encoded); + assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"_acceptUnknown\":{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}}"); + + // Now with a value + ourLog.info("---------------"); + + c = new Conformance(); + c.getAcceptUnknownElement().setValue(true); + c.getAcceptUnknownElement().addExtension().setUrl("http://foo").setValue( new StringType("AAA")); + + encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); + ourLog.info(encoded); + + encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); + ourLog.info(encoded); + assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"acceptUnknown\":true,\"_acceptUnknown\":{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}}"); + + } + + + @Test + public void testEncodeExtensionInResourceElement() { + + Conformance c = new Conformance(); + // c.addRest().getSecurity().addUndeclaredExtension(false, "http://foo", new StringType("AAA")); + c.addExtension().setUrl("http://foo").setValue( new StringType("AAA")); + + String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c); + ourLog.info(encoded); + + encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c); + ourLog.info(encoded); + assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}"); + + } + + @Test + public void testEncodeExtensionOnEmptyElement() throws Exception { + + ValueSet valueSet = new ValueSet(); + valueSet.addTelecom().addExtension().setUrl("http://foo").setValue( new StringType("AAA")); + + String encoded = ourCtx.newJsonParser().encodeResourceToString(valueSet); + assertThat(encoded, containsString("\"telecom\":[{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}")); + + } @Test public void testEncodeExtensionWithResourceContent() { @@ -920,10 +602,32 @@ public class JsonParserTest { List ext = actual.getExtension(); assertEquals(1, ext.size()); Reference ref = (Reference) ext.get(0).getValue(); - assertEquals("Organization/123", ref.getReference()); + assertEquals("Organization/123", ref.getReference().getValue()); } + + @Test + public void testEncodeIds() { + Patient pt = new Patient(); + pt.addIdentifier().setSystem("sys").setValue( "val"); + + List_ list = new List_(); + list.setId("listId"); + list.addEntry().setItem(new Reference(pt)).setDeleted(true); + + String enc = ourCtx.newJsonParser().encodeResourceToString(list); + ourLog.info(enc); + + assertThat(enc, containsString("\"id\":\"1\"")); + + List_ parsed = ourCtx.newJsonParser().parseResource(List_.class,enc); + assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass()); + enc = enc.replace("\"id\"", "\"_id\""); + parsed = ourCtx.newJsonParser().parseResource(List_.class,enc); + assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass()); +} + @Test public void testEncodeInvalidChildGoodException() { Observation obs = new Observation(); @@ -937,6 +641,57 @@ public class JsonParserTest { assertThat(e.getMessage(), StringContains.containsString("DecimalType")); } } + + + + + @Test + public void testEncodeNarrativeBlockInBundle() throws Exception { + Patient p = new Patient(); + p.addIdentifier().setSystem("foo").setValue("bar"); + p.getText().setStatus(NarrativeStatus.GENERATED); + p.getText().setDivAsString("
hello
"); + + Bundle b = new Bundle(); + b.setTotal(123); + b.addEntry().setResource(p); + + String out = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); + ourLog.info(out); + assertThat(out, containsString("
hello
")); + + p.getText().setDivAsString("hello"); + out = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); + ourLog.info(out); + // Backslashes need to be escaped because they are in a JSON value + assertThat(out, containsString("
hello
")); + + } + + @Test + public void testEncodeNonContained() { + Organization org = new Organization(); + org.setId("Organization/65546"); + org.getNameElement().setValue("Contained Test Organization"); + + Patient patient = new Patient(); + patient.setId("Patient/1333"); + patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); + patient.getManagingOrganization().setResource(org); + + Bundle b = new Bundle(); + b.addEntry().setResource(patient); + + String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); + ourLog.info(encoded); + assertThat(encoded, not(containsString("contained"))); + assertThat(encoded, containsString("\"reference\":\"Organization/65546\"")); + + encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); + ourLog.info(encoded); + assertThat(encoded, not(containsString("contained"))); + assertThat(encoded, containsString("\"reference\":\"Organization/65546\"")); + } @Test public void testEncodeResourceRef() throws DataFormatException { @@ -979,6 +734,27 @@ public class JsonParserTest { } + @Test + public void testEncodingNullExtension() { + Patient p = new Patient(); + Extension extension = new Extension().setUrl("http://foo#bar"); + p.getExtension().add(extension); + String str = ourCtx.newJsonParser().encodeResourceToString(p); + + assertEquals("{\"resourceType\":\"Patient\"}", str); + + extension.setValue(new StringType()); + + str = ourCtx.newJsonParser().encodeResourceToString(p); + assertEquals("{\"resourceType\":\"Patient\"}", str); + + extension.setValue(new StringType("")); + + str = ourCtx.newJsonParser().encodeResourceToString(p); + assertEquals("{\"resourceType\":\"Patient\"}", str); + + } + @Test public void testExtensionOnComposite() throws Exception { @@ -1048,6 +824,110 @@ public class JsonParserTest { } @Test + public void testMoreExtensions() throws Exception { + + Patient patient = new Patient(); + patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135"); + + Extension ext = new Extension(); + ext.setUrl("http://example.com/extensions#someext"); + ext.setValue(new DateTimeType("2011-01-02T11:13:15")); + + // Add the extension to the resource + patient.getExtension().add(ext); + // END SNIPPET: resourceExtension + + // START SNIPPET: resourceStringExtension + HumanName name = patient.addName(); + name.addFamily("Shmoe"); + StringType given = name.addGivenElement(); + given.setValue("Joe"); + Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("given")); + given.getExtension().add(ext2); + + StringType given2 = name.addGivenElement(); + given2.setValue("Shmoe"); + Extension given2ext = new Extension().setUrl("http://examples.com#givenext_parent"); + given2.getExtension().add(given2ext); + given2ext.addExtension().setUrl("http://examples.com#givenext_child").setValue(new StringType("CHILD")); + // END SNIPPET: resourceStringExtension + + // START SNIPPET: subExtension + Extension parent = new Extension().setUrl("http://example.com#parent"); + patient.getExtension().add(parent); + + Extension child1 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1")); + parent.getExtension().add(child1); + + Extension child2 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1")); + parent.getExtension().add(child2); + // END SNIPPET: subExtension + + String output = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); + ourLog.info(output); + + String enc = ourCtx.newJsonParser().encodeResourceToString(patient); + //@formatter:off + assertThat(enc, containsString(("{" + + "\"resourceType\":\"Patient\"," + + " \"extension\":[" + + " {" + + " \"url\":\"http://example.com/extensions#someext\"," + + " \"valueDateTime\":\"2011-01-02T11:13:15\"" + + " }," + + " {" + + " \"url\":\"http://example.com#parent\"," + + " \"extension\":[" + + " {" + + " \"url\":\"http://example.com#child\"," + + " \"valueString\":\"value1\"" + + " }," + + " {" + + " \"url\":\"http://example.com#child\"," + + " \"valueString\":\"value1\"" + + " }" + + " ]" + + " }" + + " ]").replace(" ", ""))); + //@formatter:on + + //@formatter:off + assertThat(enc, containsString(( + " \"given\":[" + + " \"Joe\"," + + " \"Shmoe\"" + + " ]," + + " \"_given\":[" + + " {" + + " \"extension\":[" + + " {" + + " \"url\":\"http://examples.com#givenext\"," + + " \"valueString\":\"given\"" + + " }" + + " ]" + + " }," + + " {" + + " \"extension\":[" + + " {" + + " \"url\":\"http://examples.com#givenext_parent\"," + + " \"extension\":[" + + " {" + + " \"url\":\"http://examples.com#givenext_child\"," + + " \"valueString\":\"CHILD\"" + + " }" + + " ]" + + " }" + + " ]" + + " }" + + "").replace(" ", ""))); + //@formatter:on + } + + + /* + * Narrative generation is disabled for HL7org structs for now + */ +// @Test public void testNarrativeGeneration() throws DataFormatException, IOException { Patient patient = new Patient(); @@ -1058,14 +938,14 @@ public class JsonParserTest { INarrativeGenerator gen = new INarrativeGenerator() { @Override - public void generateNarrative(String theProfile, IBaseResource theResource, BaseNarrativeDt theNarrative) throws DataFormatException { - theNarrative.getDiv().setValueAsString("
help
"); - theNarrative.getStatus().setValueAsString("generated"); + public void generateNarrative(IBaseResource theResource, BaseNarrativeDt theNarrative) { + throw new UnsupportedOperationException(); } @Override - public void generateNarrative(IBaseResource theResource, BaseNarrativeDt theNarrative) { - throw new UnsupportedOperationException(); + public void generateNarrative(String theProfile, IBaseResource theResource, BaseNarrativeDt theNarrative) throws DataFormatException { + theNarrative.getDiv().setValueAsString("
help
"); + theNarrative.getStatus().setValueAsString("generated"); } @Override @@ -1094,131 +974,110 @@ public class JsonParserTest { assertThat(str, StringContains.containsString(",\"text\":{\"status\":\"generated\",\"div\":\"
help
\"},")); } + @Test - public void testParseBundle() throws DataFormatException, IOException { + public void testNestedContainedResources() { - String msg = IOUtils.toString(XmlParser.class.getResourceAsStream("/atom-document-large.json")); - IParser p = ourCtx.newJsonParser(); - Bundle bundle = p.parseResource(Bundle.class, msg); + Observation A = new Observation(); + A.getCode().setText("A"); - assertEquals(1, bundle.getMeta().getTag().size()); - assertEquals("http://scheme", bundle.getMeta().getTag().get(0).getSystem()); - assertEquals("http://term", bundle.getMeta().getTag().get(0).getCode()); - assertEquals("label", bundle.getMeta().getTag().get(0).getDisplay()); + Observation B = new Observation(); + B.getCode().setText("B"); + A.addRelated().setTarget(new Reference(B)); - String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(bundle); - ourLog.info(encoded); + Observation C = new Observation(); + C.getCode().setText("C"); + B.addRelated().setTarget(new Reference(C)); - assertEquals("http://fhir.healthintersections.com.au/open/DiagnosticReport/_search?_format=application/json+fhir&search-id=46d5f0e7-9240-4d4f-9f51-f8ac975c65&search-sort=_id", bundle - .getLink().get(0).getUrl()); - assertEquals("urn:uuid:0b754ff9-03cf-4322-a119-15019af8a3", bundle.getId()); + String str = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(A); + ourLog.info(str); - BundleEntryComponent entry = bundle.getEntry().get(0); + assertThat(str, stringContainsInOrder(Arrays.asList("\"text\":\"B\"", "\"text\":\"C\"", "\"text\":\"A\""))); - DiagnosticReport res = (DiagnosticReport) entry.getResource(); - assertEquals("Complete Blood Count", res.getName().getText()); + // Only one (outer) contained block + int idx0 = str.indexOf("\"contained\""); + int idx1 = str.indexOf("\"contained\"", idx0 + 1); + + assertNotEquals(-1, idx0); + assertEquals(-1, idx1); + + Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, str); + assertEquals("A", obs.getCode().getTextElement().getValue()); + + Observation obsB = (Observation) obs.getRelated().get(0).getTarget().getResource(); + assertEquals("B", obsB.getCode().getTextElement().getValue()); + + Observation obsC = (Observation) obsB.getRelated().get(0).getTarget().getResource(); + assertEquals("C", obsC.getCode().getTextElement().getValue()); } @Test - public void testParseBundleFromHI() throws DataFormatException, IOException { + public void testParseBinaryResource() { - String msg = IOUtils.toString(XmlParser.class.getResourceAsStream("/bundle.json")); - IParser p = ourCtx.newJsonParser(); - Bundle bundle = p.parseResource(Bundle.class, msg); + Binary val = ourCtx.newJsonParser().parseResource(Binary.class, "{\"resourceType\":\"Binary\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}"); + assertEquals("foo", val.getContentType()); + assertArrayEquals(new byte[] { 1, 2, 3, 4 }, val.getContent()); - String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(bundle); - ourLog.info(encoded); + } - BundleEntryComponent entry = bundle.getEntry().get(0); + @Test + public void testParseEmptyNarrative() throws Exception { + //@formatter:off + String text = "{\n" + + " \"resourceType\" : \"Patient\",\n" + + " \"extension\" : [\n" + + " {\n" + + " \"url\" : \"http://clairol.org/colour\",\n" + + " \"valueCode\" : \"B\"\n" + + " }\n" + + " ],\n" + + " \"text\" : {\n" + + " \"div\" : \"\"\n" + + " }" + + "}"; + //@formatter:on - Patient res = (Patient) entry.getResource(); - assertEquals("444111234", res.getIdentifier().get(0).getValue()); - - BundleEntryComponent deletedEntry = bundle.getEntry().get(3); - assertEquals(true, deletedEntry.getResource().getMeta().getDeleted()); - assertEquals("2014-06-20T20:15:49Z", deletedEntry.getResource().getMeta().getLastUpdatedElement().getValueAsString()); + Patient res = (Patient) ourCtx.newJsonParser().parseResource(text); + XhtmlNode div = res.getText().getDiv(); + String value = div.getValueAsString(); + assertNull(value); + assertTrue(div.getChildNodes().isEmpty()); } @Test - public void testParseWithContained() throws DataFormatException, IOException { - - String msg = IOUtils.toString(XmlParser.class.getResourceAsStream("/diagnostic-report.json")); - IParser p = ourCtx.newJsonParser(); - // ourLog.info("Reading in message: {}", msg); - DiagnosticReport res = p.parseResource(DiagnosticReport.class, msg); - - String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(res); - ourLog.info(encoded); - - Reference reference = res.getResult().get(1); - Observation obs = (Observation) reference.getResource(); - - assertEquals("789-8", obs.getCode().getCoding().get(0).getCode()); - } - - @BeforeClass - public static void beforeClass() { - ourCtx = FhirContext.forDstu2Hl7Org(); - } - - - @Test - public void testEncodeBundle() throws InterruptedException { - Bundle b = new Bundle(); - - InstantType pub = InstantType.now(); - b.getMeta().setLastUpdatedElement(pub); - Thread.sleep(2); - - Patient p1 = new Patient(); - p1.addName().addFamily("Family1"); - BundleEntryComponent entry = b.addEntry(); - entry.getIdElement().setValue("1"); - entry.setResource(p1); - - Patient p2 = new Patient(); - p2.addName().addFamily("Family2"); - entry = b.addEntry(); - entry.getIdElement().setValue("2"); - entry.setResource(p2); - - BundleEntryComponent deletedEntry = b.addEntry(); - Patient dp = new Patient(); - deletedEntry.setResource(dp); + public void testParseSimpleBundle() { + String bundle = "{\"resourceType\":\"Bundle\",\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"identifier\":[{\"system\":\"idsystem\"}]}}]}"; + Bundle b = ourCtx.newJsonParser().parseResource(Bundle.class, bundle); - dp.setId(("3")); - InstantType nowDt = InstantType.withCurrentTime(); - dp.getMeta().setDeleted(true); - dp.getMeta().setLastUpdatedElement(nowDt); - - String bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); - ourLog.info(bundleString); - - List strings = new ArrayList(); - strings.addAll(Arrays.asList("\"published\":\"" + pub.getValueAsString() + "\"")); - strings.addAll(Arrays.asList("\"id\":\"1\"")); - strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\"")); - strings.addAll(Arrays.asList("\"deleted\":\"" + nowDt.getValueAsString() + "\"", "\"id\":\"Patient/3\"")); - assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings)); - - b.getEntry().remove(2); - bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); - assertThat(bundleString, not(containsString("deleted"))); - + assertNotNull(b.getEntry().get(0).getResource()); + Patient p = (Patient) b.getEntry().get(0).getResource(); + assertEquals("idsystem", p.getIdentifier().get(0).getSystem()); } @Test - public void testSimpleBundleEncode() throws IOException { + public void testParseSingleQuotes() { + ourCtx.newJsonParser().parseResource(Bundle.class, "{ \"resourceType\": \"Bundle\" }"); - String xmlString = IOUtils.toString(JsonParser.class.getResourceAsStream("/atom-document-large.xml"), Charset.forName("UTF-8")); - Bundle obs = ourCtx.newXmlParser().parseResource(Bundle.class, xmlString); - - String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(obs); - ourLog.info(encoded); + try { + ourCtx.newJsonParser().parseResource(Bundle.class, "{ 'resourceType': 'Bundle' }"); + fail(); + } catch (DataFormatException e) { + // good + } + } + /** + * HAPI FHIR < 0.6 incorrectly used "resource" instead of "reference" + */ + @Test + public void testParseWithIncorrectReference() throws IOException { + String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json")); + jsonString = jsonString.replace("\"reference\"", "\"resource\""); + Patient parsed = ourCtx.newJsonParser().parseResource(Patient.class, jsonString); + assertEquals("Organization/1", parsed.getManagingOrganization().getReference().getValue()); } @Test @@ -1237,6 +1096,7 @@ public class JsonParserTest { } + @Test public void testSimpleResourceEncode() throws IOException { @@ -1260,7 +1120,9 @@ public class JsonParserTest { // The encoded escapes quote marks using XML escaping instead of JSON escaping, which is probably nicer anyhow... String exp = expected.toString().replace("\\\"Jim\\\"", ""Jim""); - String act = actual.toString(); + + // This shows up when we parse XML + String act = actual.toString().replace(" xmlns=\\\"http://www.w3.org/1999/xhtml\\\"", ""); ourLog.info("Expected: {}", exp); ourLog.info("Actual : {}", act); @@ -1268,15 +1130,111 @@ public class JsonParserTest { } - /** - * HAPI FHIR < 0.6 incorrectly used "resource" instead of "reference" - */ + @Test - public void testParseWithIncorrectReference() throws IOException { - String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json")); - jsonString = jsonString.replace("\"reference\"", "\"resource\""); - Patient parsed = ourCtx.newJsonParser().parseResource(Patient.class, jsonString); - assertEquals("Organization/1", parsed.getManagingOrganization().getReference()); + public void testSimpleResourceEncodeWithCustomType() throws IOException, SAXException { + + FhirContext fhirCtx = new FhirContext(MyObservationWithExtensions.class); + String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"), Charset.forName("UTF-8")); + MyObservationWithExtensions obs = fhirCtx.newJsonParser().parseResource(MyObservationWithExtensions.class, jsonString); + + assertEquals(0, obs.getExtension().size()); + assertEquals("aaaa", obs.getExtAtt().getContentType()); + assertEquals("str1", obs.getMoreExt().getStr1().getValue()); + assertEquals("2011-01-02", obs.getModExt().getValueAsString()); + + List undeclaredExtensions = obs.getContact().get(0).getName().getFamily().get(0).getExtension(); + org.hl7.fhir.instance.model.Extension undeclaredExtension = undeclaredExtensions.get(0); + assertEquals("http://hl7.org/fhir/Profile/iso-21090#qualifier", undeclaredExtension.getUrl()); + + IParser xmlParser = fhirCtx.newXmlParser(); + String encoded = xmlParser.encodeResourceToString(obs); + encoded = encoded.replaceAll("", "").replace("\n", "").replace("\r", "").replaceAll(">\\s+<", "><"); + + String xmlString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.xml"), Charset.forName("UTF-8")); + xmlString = xmlString.replaceAll("", "").replace("\n", "").replace("\r", "").replaceAll(">\\s+<", "><"); + + ourLog.info("Expected: " + xmlString); + ourLog.info("Actual : " + encoded); + + String expected = (xmlString); + String actual = (encoded.trim()); + + Diff d = new Diff(new StringReader(expected), new StringReader(actual)); + assertTrue(d.toString(), d.identical()); + + } + + @Test + public void testTagList() { + + //@formatter:off + String tagListStr = "{\n" + + " \"resourceType\" : \"TagList\", " + + " \"category\" : [" + + " { " + + " \"term\" : \"term0\", " + + " \"label\" : \"label0\", " + + " \"scheme\" : \"scheme0\" " + + " }," + + " { " + + " \"term\" : \"term1\", " + + " \"label\" : \"label1\", " + + " \"scheme\" : null " + + " }," + + " { " + + " \"term\" : \"term2\", " + + " \"label\" : \"label2\" " + + " }" + + " ] " + + "}"; + //@formatter:on + + TagList tagList = new FhirContext().newJsonParser().parseTagList(tagListStr); + assertEquals(3, tagList.size()); + assertEquals("term0", tagList.get(0).getTerm()); + assertEquals("label0", tagList.get(0).getLabel()); + assertEquals("scheme0", tagList.get(0).getScheme()); + assertEquals("term1", tagList.get(1).getTerm()); + assertEquals("label1", tagList.get(1).getLabel()); + assertEquals(null, tagList.get(1).getScheme()); + assertEquals("term2", tagList.get(2).getTerm()); + assertEquals("label2", tagList.get(2).getLabel()); + assertEquals(null, tagList.get(2).getScheme()); + + /* + * Encode + */ + + //@formatter:off + String expected = "{" + + "\"resourceType\":\"TagList\"," + + "\"category\":[" + + "{" + + "\"term\":\"term0\"," + + "\"label\":\"label0\"," + + "\"scheme\":\"scheme0\"" + + "}," + + "{" + + "\"term\":\"term1\"," + + "\"label\":\"label1\"" + + "}," + + "{" + + "\"term\":\"term2\"," + + "\"label\":\"label2\"" + + "}" + + "]" + + "}"; + //@formatter:on + + String encoded = new FhirContext().newJsonParser().encodeTagListToString(tagList); + assertEquals(expected, encoded); + + } + + @BeforeClass + public static void beforeClass() { + ourCtx = FhirContext.forDstu2Hl7Org(); } diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java similarity index 77% rename from hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java rename to hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java index 869c413b9b9..c991ce59458 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java @@ -5,14 +5,12 @@ import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.stringContainsInOrder; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.IOException; -import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.StringReader; import java.nio.charset.Charset; @@ -37,8 +35,6 @@ import org.hl7.fhir.instance.model.Bundle; import org.hl7.fhir.instance.model.Bundle.BundleEntryComponent; import org.hl7.fhir.instance.model.CodeableConcept; import org.hl7.fhir.instance.model.Composition; -import org.hl7.fhir.instance.model.Conformance; -import org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent; import org.hl7.fhir.instance.model.DateTimeType; import org.hl7.fhir.instance.model.DateType; import org.hl7.fhir.instance.model.DecimalType; @@ -56,12 +52,10 @@ import org.hl7.fhir.instance.model.Narrative.NarrativeStatus; import org.hl7.fhir.instance.model.Observation; import org.hl7.fhir.instance.model.Organization; import org.hl7.fhir.instance.model.Patient; -import org.hl7.fhir.instance.model.Profile; import org.hl7.fhir.instance.model.Reference; import org.hl7.fhir.instance.model.Resource; import org.hl7.fhir.instance.model.Specimen; import org.hl7.fhir.instance.model.StringType; -import org.hl7.fhir.instance.model.ValueSet; import org.junit.BeforeClass; import org.junit.Test; import org.xml.sax.SAXException; @@ -70,19 +64,298 @@ import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.narrative.INarrativeGenerator; -import ca.uhn.fhir.parser.JsonParserTest.MyPatientWithOneDeclaredAddressExtension; -import ca.uhn.fhir.parser.JsonParserTest.MyPatientWithOneDeclaredExtension; +import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredAddressExtension; +import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredExtension; -public class XmlParserTest { +public class XmlParserHl7OrgDstu2Test { private static FhirContext ourCtx; - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserTest.class); + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserHl7OrgDstu2Test.class); @BeforeClass public static void beforeClass2() { System.setProperty("file.encoding", "ISO-8859-1"); } + @Test + public void testContainedResourceInExtensionUndeclared() { + Patient p = new Patient(); + p.addName().addFamily("PATIENT"); + + Organization o = new Organization(); + o.setName("ORG"); + p.addExtension().setUrl("urn:foo").setValue(new Reference(o)); + + String str = ourCtx.newXmlParser().encodeResourceToString(p); + ourLog.info(str); + + p = ourCtx.newXmlParser().parseResource(Patient.class, str); + assertEquals("PATIENT", p.getName().get(0).getFamily().get(0).getValue()); + + List exts = p.getExtension(); + assertEquals(1, exts.size()); + Reference rr = (Reference)exts.get(0).getValue(); + o = (Organization) rr.getResource(); + assertEquals("ORG", o.getName()); + } + + // TODO: uncomment with new model updates +// @Test +// public void testEncodeAndParseExtensionOnResourceReference() { +// DataElement de = new DataElement(); +// Binding b = de.addElement().getBinding(); +// b.setName("BINDING"); +// +// Organization o = new Organization(); +// o.setName("ORG"); +// b.addUndeclaredExtension(new ExtensionDt(false, "urn:foo", new ResourceReferenceDt(o))); +// +// String str = ourCtx.newXmlParser().encodeResourceToString(de); +// ourLog.info(str); +// +// de = ourCtx.newXmlParser().parseResource(DataElement.class, str); +// b = de.getElement().get(0).getBinding(); +// assertEquals("BINDING", b.getName()); +// +// List exts = b.getUndeclaredExtensionsByUrl("urn:foo"); +// assertEquals(1, exts.size()); +// ResourceReferenceDt rr = (ResourceReferenceDt)exts.get(0).getValue(); +// o = (Organization) rr.getResource(); +// assertEquals("ORG", o.getName()); +// +// } +// +// @Test +// public void testParseAndEncodeExtensionOnResourceReference() { +// //@formatter:off +// String input = "" + +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""+ +// ""; +// //@formatter:on +// DataElement de = ourCtx.newXmlParser().parseResource(DataElement.class, input); +// String output = ourCtx.newXmlParser().encodeResourceToString(de).replace(" xmlns=\"http://hl7.org/fhir\"", ""); +// +// ElementDefinitionDt elem = de.getElement().get(0); +// Binding b = elem.getBinding(); +// assertEquals("Gender", b.getName()); +// +// ResourceReferenceDt ref = (ResourceReferenceDt) b.getValueSet(); +// assertEquals("#2179414", ref.getReference().getValue()); +// +// assertEquals(2, ref.getUndeclaredExtensions().size()); +// ExtensionDt ext = ref.getUndeclaredExtensions().get(0); +// assertEquals("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset", ext.getUrl()); +// assertEquals(ResourceReferenceDt.class, ext.getValue().getClass()); +// assertEquals("#2179414-permitted", ((ResourceReferenceDt)ext.getValue()).getReference().getValue()); +// +// ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(de)); +// +// assertThat(output, containsString("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset")); +// +// ourLog.info("Expected: {}", input); +// ourLog.info("Actual : {}", output); +// assertEquals(input, output); +// } + + + @Test public void testEncodeBinaryWithNoContentType() { Binary b = new Binary(); @@ -94,6 +367,80 @@ public class XmlParserTest { assertEquals("", output); } + @Test + public void testMoreExtensions() throws Exception { + + Patient patient = new Patient(); + patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135"); + + Extension ext = new Extension(); + ext.setUrl("http://example.com/extensions#someext"); + ext.setValue(new DateTimeType("2011-01-02T11:13:15")); + + // Add the extension to the resource + patient.getExtension().add(ext); + // END SNIPPET: resourceExtension + + // START SNIPPET: resourceStringExtension + HumanName name = patient.addName(); + name.addFamily("Shmoe"); + StringType given = name.addGivenElement(); + given.setValue("Joe"); + Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("given")); + given.getExtension().add(ext2); + + StringType given2 = name.addGivenElement(); + given2.setValue("Shmoe"); + Extension given2ext = new Extension().setUrl("http://examples.com#givenext_parent"); + given2.getExtension().add(given2ext); + given2ext.addExtension().setUrl("http://examples.com#givenext_child").setValue(new StringType("CHILD")); + // END SNIPPET: resourceStringExtension + + // START SNIPPET: subExtension + Extension parent = new Extension().setUrl("http://example.com#parent"); + patient.getExtension().add(parent); + + Extension child1 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1")); + parent.getExtension().add(child1); + + Extension child2 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1")); + parent.getExtension().add(child2); + // END SNIPPET: subExtension + + String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); + ourLog.info(output); + + String enc = ourCtx.newXmlParser().encodeResourceToString(patient); + assertThat(enc, containsString("")); + assertThat( + enc, + containsString("")); + assertThat(enc, containsString("")); + assertThat(enc, containsString("")); + } + + @Test + public void testEncodingNullExtension() { + Patient p = new Patient(); + Extension extension = new Extension().setUrl("http://foo#bar"); + p.getExtension().add(extension); + String str = ourCtx.newXmlParser().encodeResourceToString(p); + + assertEquals("", str); + + extension.setValue(new StringType()); + + str = ourCtx.newXmlParser().encodeResourceToString(p); + assertEquals("", str); + + extension.setValue(new StringType("")); + + str = ourCtx.newXmlParser().encodeResourceToString(p); + assertEquals("", str); + + } + + @Test public void testEncodeNonContained() { // Create an organization @@ -341,14 +688,18 @@ public class XmlParserTest { String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b); ourLog.info(bundleString); - List strings = new ArrayList(); - strings.addAll(Arrays.asList("", pub.getValueAsString(), "")); - strings.add(""); - strings.addAll(Arrays.asList("", "1", "", "", "")); - strings.addAll(Arrays.asList("", "2", "", "", "")); + //@formatter:on + String[] strings = { + "", + "", + "", + "", + "", + "" + }; + //@formatter:off + assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings)); - assertThat(bundleString, not(containsString("at:by"))); - } @Test @@ -362,7 +713,13 @@ public class XmlParserTest { String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b); ourLog.info(val); - assertThat(val, StringContains.containsString("")); + //@formatter:off + assertThat(val, stringContainsInOrder("", + "", + "", + "", + "")); + //@formatter:on b = ourCtx.newXmlParser().parseResource(Bundle.class, val); assertEquals(1, b.getEntry().size()); @@ -370,8 +727,6 @@ public class XmlParserTest { assertEquals("scheme", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getSystem()); assertEquals("term", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getCode()); assertEquals("label", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getDisplay()); - assertNull(b.getEntry().get(0).getResource()); - } @Test @@ -433,7 +788,7 @@ public class XmlParserTest { int idx = str.indexOf("reference value=\"#") + "reference value=\"#".length(); int idx2 = str.indexOf('"', idx + 1); String id = str.substring(idx, idx2); - assertThat(str, StringContains.containsString("")); + assertThat(str, stringContainsInOrder("", "")); assertThat(str, IsNot.not(StringContains.containsString(""))); } @@ -467,12 +822,12 @@ public class XmlParserTest { String val = parser.encodeResourceToString(patient); ourLog.info(val); - assertThat(val, StringContains.containsString("")); + assertThat(val, StringContains.containsString("")); MyPatientWithOneDeclaredExtension actual = parser.parseResource(MyPatientWithOneDeclaredExtension.class, val); assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse()); Reference ref = actual.getFoo(); - assertEquals("Organization/123", ref.getReference()); + assertEquals("Organization/123", ref.getReference().getValue()); } @@ -1016,13 +1371,7 @@ public class XmlParserTest { ourLog.info(str); assertThat(str, stringContainsInOrder(Arrays.asList("", "", ""))); - assertThat(str, stringContainsInOrder(Arrays.asList("", ""))); - - // Only one (outer) contained block - int idx0 = str.indexOf(""); - int idx1 = str.indexOf("", idx0 + 1); - assertNotEquals(-1, idx0); - assertEquals(-1, idx1); + assertThat(str, stringContainsInOrder(Arrays.asList("", "", "", ""))); Observation obs = ourCtx.newXmlParser().parseResource(Observation.class, str); assertEquals("A", obs.getCode().getText()); @@ -1038,35 +1387,12 @@ public class XmlParserTest { @Test public void testParseBinaryResource() { - Binary val = ourCtx.newXmlParser().parseResource(Binary.class, "AQIDBA=="); + Binary val = ourCtx.newXmlParser().parseResource(Binary.class, ""); assertEquals("foo", val.getContentType()); assertArrayEquals(new byte[] { 1, 2, 3, 4 }, val.getContent()); } - @Test - public void testParseBundleWithMixedReturnTypes() { - InputStreamReader str = new InputStreamReader(getClass().getResourceAsStream("/mixed-return-bundle.xml")); - Bundle b = ourCtx.newXmlParser().parseResource(Bundle.class, str); - assertEquals(Patient.class, b.getEntry().get(0).getResource().getClass()); - assertEquals(Patient.class, b.getEntry().get(1).getResource().getClass()); - assertEquals(Organization.class, b.getEntry().get(2).getResource().getClass()); - } - - @Test - public void testParseContainedResources() throws IOException { - - String msg = IOUtils.toString(XmlParser.class.getResourceAsStream("/contained-diagnosticreport.xml")); - IParser p = ourCtx.newXmlParser(); - DiagnosticReport bundle = p.parseResource(DiagnosticReport.class, msg); - - Reference result0 = bundle.getResult().get(0); - Observation obs = (Observation) result0.getResource(); - - assertNotNull(obs); - assertEquals("718-7", obs.getCode().getCoding().get(0).getCode()); - - } @Test public void testParseEncodeNarrative() { @@ -1088,18 +1414,6 @@ public class XmlParserTest { } - /** - * This sample has extra elements in that are not actually a part of the spec any more.. - */ - @Test - public void testParseFuroreMetadataWithExtraElements() throws IOException { - String msg = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/furore-conformance.xml")); - - IParser p = new FhirContext(ValueSet.class).newXmlParser(); - Conformance conf = p.parseResource(Conformance.class, msg); - ConformanceRestResourceComponent res = conf.getRest().get(0).getResource().get(0); - assertEquals("_id", res.getSearchParam().get(1).getName()); - } @Test public void testParseLanguage() { diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java new file mode 100644 index 00000000000..24514893dc2 --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeTest.java @@ -0,0 +1,79 @@ +package ca.uhn.fhir.rest.client; + +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.StringReader; +import java.nio.charset.Charset; +import java.util.Arrays; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hamcrest.Matchers; +import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.Patient; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.Bundle; +import ca.uhn.fhir.model.valueset.BundleTypeEnum; +import ca.uhn.fhir.rest.server.Constants; + +public class BundleTypeTest { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BundleTypeTest.class); + private FhirContext ourCtx; + private HttpClient ourHttpClient; + + private HttpResponse ourHttpResponse; + + @Before + public void before() { + ourCtx = FhirContext.forDstu2Hl7Org(); + + ourHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + ourCtx.getRestfulClientFactory().setHttpClient(ourHttpClient); + ourCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.NEVER); + + ourHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + } + + @Test + public void testTransaction() throws Exception { + String retVal = ourCtx.newXmlParser().encodeBundleToString(new Bundle()); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse); + when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8")); + when(ourHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8"))); + + Patient p1 = new Patient(); + p1.addIdentifier().setSystem("urn:system").setValue("value"); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); + client.transaction().withResources(Arrays.asList((IBaseResource) p1)).execute(); + + HttpUriRequest value = capt.getValue(); + + assertTrue("Expected request of type POST on long params list", value instanceof HttpPost); + HttpPost post = (HttpPost) value; + String body = IOUtils.toString(post.getEntity().getContent()); + IOUtils.closeQuietly(post.getEntity().getContent()); + ourLog.info(body); + + assertThat(body, Matchers.containsString(" capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + if (myFirstResponse) { + myFirstResponse=false; + return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8")); + } else { + return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8")); + } + }}); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.ONCE); + IGenericClient client = myCtx.newRestfulGenericClient("http://foo"); + + // don't load the conformance until the first time the client is actually used + assertTrue(myFirstResponse); + client.read(new UriDt("http://foo/Patient/123")); + assertFalse(myFirstResponse); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + + // Conformance only loaded once, then 3 reads + verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class)); + } + + @Test + public void testServerReturnsAppropriateVersionForDstu2_050() throws Exception { + Conformance conf = new Conformance(); + conf.setFhirVersion("0.5.0"); + final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + if (myFirstResponse) { + myFirstResponse=false; + return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8")); + } else { + return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8")); + } + }}); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.ONCE); + IGenericClient client = myCtx.newRestfulGenericClient("http://foo"); + + // don't load the conformance until the first time the client is actually used + assertTrue(myFirstResponse); + client.read(new UriDt("http://foo/Patient/123")); + assertFalse(myFirstResponse); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + + // Conformance only loaded once, then 3 reads + verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class)); + } + + @Test + public void testServerReturnsWrongVersionForDstu2() throws Exception { + Conformance conf = new Conformance(); + conf.setFhirVersion("0.80"); + String msg = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.ONCE); + try { + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + fail(); + } catch (FhirClientConnectionException e) { + String out = e.toString(); + String want = "The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"0.80\" which corresponds to DSTU1, but this client is configured to use DSTU2_HL7ORG (via the FhirContext)"; + ourLog.info(out); + ourLog.info(want); + assertThat(out, containsString(want)); + } + } +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientTest.java new file mode 100644 index 00000000000..6e972656d43 --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ETagClientTest.java @@ -0,0 +1,280 @@ +package ca.uhn.fhir.rest.client; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.StringReader; +import java.nio.charset.Charset; + +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hamcrest.core.StringContains; +import org.hl7.fhir.instance.model.Patient; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; +import ca.uhn.fhir.model.api.TagList; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.rest.server.Constants; +import ca.uhn.fhir.rest.server.exceptions.NotModifiedException; +import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; + +/** + * Created by dsotnikov on 2/25/2014. + */ +public class ETagClientTest { + + private static FhirContext ourCtx; + private HttpClient myHttpClient; + + private HttpResponse myHttpResponse; + + @Before + public void before() { + + myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient); + ourCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.NEVER); + + myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + } + + private String getResourceResult() { + //@formatter:off + String msg = + "" + + "" + + "" + + "" + + "" + + "
John Cardinal: 444333333
" + + "" + + "" + + "" + + "" + + "" + + "
" + + "
"; + //@formatter:on + return msg; + } + + private Patient getResource() { + return ourCtx.newXmlParser().parseResource(Patient.class, getResourceResult()); + } + + @Test + public void testReadWithContentLocationInResponse() throws Exception { + + String msg = getResourceResult(); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + //@formatter:off + Header[] headers = new Header[] { + new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + new BasicHeader(Constants.HEADER_ETAG, "\"9999\"") + }; + //@formatter:on + when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Patient response = client.read(Patient.class, new IdDt("Patient/1234")); + + assertEquals("http://foo.com/Patient/123/_history/2333", response.getId().getValue()); + } + + @Test + public void testReadWithIfNoneMatch() throws Exception { + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_304_NOT_MODIFIED, "Not modified")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + + //@formatter:off + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""))); + try { + client + .read() + .resource(Patient.class) + .withId(new IdDt("Patient/1234")) + .execute(); + fail(); + } catch (NotModifiedException e) { + // good! + } + //@formatter:on + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count).getURI().toString()); + count++; + + //@formatter:off + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""))); + Patient expected = new Patient(); + Patient response = client + .read() + .resource(Patient.class) + .withId(new IdDt("Patient/1234")) + .ifVersionMatches("9876").returnResource(expected) + .execute(); + //@formatter:on + assertSame(expected, response); + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count).getURI().toString()); + assertEquals("\"9876\"", capt.getAllValues().get(count).getHeaders(Constants.HEADER_IF_NONE_MATCH_LC)[0].getValue()); + count++; + + } + + @Test + public void testUpdateWithIfMatch() throws Exception { + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_200_OK, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + + //@formatter:off + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""))); + client + .update() + .resource(getResource()) + .withId(new IdDt("Patient/1234")) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count).getURI().toString()); + assertEquals(0, capt.getAllValues().get(count).getHeaders(Constants.HEADER_IF_MATCH_LC).length); + count++; + + //@formatter:off + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""))); + client + .update() + .resource(getResource()) + .withId(new IdDt("Patient/1234/_history/9876")) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count).getURI().toString()); + assertEquals("\"9876\"", capt.getAllValues().get(count).getHeaders(Constants.HEADER_IF_MATCH_LC)[0].getValue()); + count++; + + } + + @Test + public void testUpdateWithIfMatchWithPreconditionFailed() throws Exception { + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_412_PRECONDITION_FAILED, "Precondition Failed")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + + //@formatter:off + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""))); + try { + client + .update() + .resource(getResource()) + .withId(new IdDt("Patient/1234/_history/9876")) + .execute(); + fail(); + } catch (PreconditionFailedException e) { + // good + } + //@formatter:on + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count).getURI().toString()); + assertEquals("\"9876\"", capt.getAllValues().get(count).getHeaders(Constants.HEADER_IF_MATCH_LC)[0].getValue()); + count++; + + //@formatter:off + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""))); + try { + Patient resource = getResource(); + resource.setId(new IdDt("Patient/1234/_history/9876")); + client + .update() + .resource(resource) + .execute(); + fail(); + } catch (PreconditionFailedException e) { + // good + } + //@formatter:on + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count).getURI().toString()); + assertEquals("\"9876\"", capt.getAllValues().get(count).getHeaders(Constants.HEADER_IF_MATCH_LC)[0].getValue()); + count++; + } + + @Test + public void testReadWithETag() throws Exception { + + String msg = getResourceResult(); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + Header[] headers = new Header[] { new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + new BasicHeader(Constants.HEADER_CATEGORY, "http://foo/tagdefinition.html; scheme=\"http://hl7.org/fhir/tag\"; label=\"Some tag\"") }; + when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + + Patient response = client.read().resource(Patient.class).withId(new IdDt("Patient/1234")).execute(); + assertThat(response.getName().get(0).getFamily().get(0).getValue(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = (Patient) client.read().resource("Patient").withId("1234").execute(); + assertThat(response.getName().get(0).getFamily().get(0).getValue(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.read().resource(Patient.class).withIdAndVersion("1234", "22").execute(); + assertThat(response.getName().get(0).getFamily().get(0).getValue(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/1234/_history/22", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.read().resource(Patient.class).withUrl("http://foo/Patient/22").execute(); + assertThat(response.getName().get(0).getFamily().get(0).getValue(), StringContains.containsString("Cardinal")); + assertEquals("http://foo/Patient/22", capt.getAllValues().get(count++).getURI().toString()); + + } + + @BeforeClass + public static void beforeClass() { + ourCtx = new FhirContext(); + } + +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Hl7OrgTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Hl7OrgTest.java new file mode 100644 index 00000000000..fc0cb8a8deb --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Hl7OrgTest.java @@ -0,0 +1,813 @@ +package ca.uhn.fhir.rest.client; + +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpEntityEnclosingRequest; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.IdType; +import org.hl7.fhir.instance.model.Parameters; +import org.hl7.fhir.instance.model.Patient; +import org.hl7.fhir.instance.model.StringType; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.Bundle; +import ca.uhn.fhir.model.api.Include; +import ca.uhn.fhir.parser.IParser; +import ca.uhn.fhir.rest.gclient.StringClientParam; +import ca.uhn.fhir.rest.server.Constants; +import ca.uhn.fhir.rest.server.EncodingEnum; + +public class GenericClientDstu2Hl7OrgTest { + private static FhirContext ourCtx; + private HttpClient myHttpClient; + private HttpResponse myHttpResponse; + + @BeforeClass + public static void beforeClass() { + ourCtx = FhirContext.forDstu2Hl7Org(); + } + + @Before + public void before() { + myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient); + ourCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.NEVER); + myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + } + + @SuppressWarnings("unused") + @Test + public void testSearchWithReverseInclude() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + //@formatter:off + org.hl7.fhir.instance.model.Bundle response = client.search() + .forResource(Patient.class) + .encodedJson() + .revInclude(new Include("Provenance:target")) + .returnBundle(org.hl7.fhir.instance.model.Bundle.class) + .execute(); + //@formatter:on + + assertEquals( + "http://example.com/fhir/Patient?_revinclude=Provenance%3Atarget&_format=json", + capt.getValue().getURI().toString()); + + } + + + private String getPatientFeedWithOneResult() { + //@formatter:off + String msg = "\n" + + "d039f91a-cc3c-4013-988e-af4d8d0614bd\n" + + "\n" + + "" + + "" + + "
John Cardinal: 444333333
" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "
\n" + + "
\n" + + "
"; + //@formatter:on + return msg; + } + + @Test + public void testHistory() throws Exception { + + final String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + org.hl7.fhir.instance.model.Bundle response; + + //@formatter:off + response = client + .history() + .onServer() + .andReturnBundle(org.hl7.fhir.instance.model.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/_history", capt.getAllValues().get(idx).getURI().toString()); + assertEquals(1, response.getEntry().size()); + idx++; + + //@formatter:off + response = client + .history() + .onType(Patient.class) + .andReturnBundle(org.hl7.fhir.instance.model.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/_history", capt.getAllValues().get(idx).getURI().toString()); + assertEquals(1, response.getEntry().size()); + idx++; + + //@formatter:off + response = client + .history() + .onInstance(new IdType("Patient", "123")) + .andReturnBundle(org.hl7.fhir.instance.model.Bundle.class) + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/123/_history", capt.getAllValues().get(idx).getURI().toString()); + assertEquals(1, response.getEntry().size()); + idx++; + } + + @Test + public void testSearchByString() throws Exception { + String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}"; + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + //@formatter:off + org.hl7.fhir.instance.model.Bundle response = client.search() + .forResource("Patient") + .where(new StringClientParam("name").matches().value("james")) + .returnBundle(org.hl7.fhir.instance.model.Bundle.class) + .execute(); + //@formatter:on + + assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString()); + assertEquals(Patient.class, response.getEntry().get(0).getResource().getClass()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchRequiresBundleType() { + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + try { + //@formatter:off + Bundle response = client.search() + .forResource("Patient") + .where(new StringClientParam("name").matches().value("james")) + .execute(); + //@formatter:on + fail(); + } catch (IllegalArgumentException e) { + // good + } + } + + @Test + public void testOperationWithListOfParameterResponse() throws Exception { + IParser p = ourCtx.newXmlParser(); + + Parameters inParams = new Parameters(); + inParams.addParameter().setValue(new StringType("STRINGVALIN1")); + inParams.addParameter().setValue(new StringType("STRINGVALIN2")); + String reqString = p.encodeResourceToString(inParams); + + Parameters outParams = new Parameters(); + outParams.addParameter().setValue(new StringType("STRINGVALOUT1")); + outParams.addParameter().setValue(new StringType("STRINGVALOUT2")); + final String respString = p.encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + //@formatter:off + Parameters resp = client + .operation() + .onServer() + .named("$SOMEOPERATION") + .withParameters(inParams).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onType(Patient.class) + .named("$SOMEOPERATION") + .withParameters(inParams).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onInstance(new IdType("Patient", "123")) + .named("$SOMEOPERATION") + .withParameters(inParams).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + resp = client.operation().onInstance(new IdType("http://foo.com/bar/baz/Patient/123/_history/22")).named("$SOMEOPERATION").withParameters(inParams).execute(); + // @formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + idx++; + } + + @Test + public void testOperationWithNoInParameters() throws Exception { + IParser p = ourCtx.newXmlParser(); + + Parameters inParams = new Parameters(); + final String reqString = p.encodeResourceToString(inParams); + + Parameters outParams = new Parameters(); + outParams.addParameter().setValue(new StringType("STRINGVALOUT1")); + outParams.addParameter().setValue(new StringType("STRINGVALOUT2")); + final String respString = p.encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + //@formatter:off + Parameters resp = client + .operation() + .onServer() + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onType(Patient.class) + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onInstance(new IdType("Patient", "123")) + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + // @formatter:off + resp = client + .operation() + .onInstance(new IdType("http://foo.com/bar/baz/Patient/123/_history/22")) + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class) + .execute(); + // @formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + idx++; + } + + @Test + public void testOperationAsGetWithNoInParameters() throws Exception { + IParser p = ourCtx.newXmlParser(); + + Parameters outParams = new Parameters(); + outParams.addParameter().setValue(new StringType("STRINGVALOUT1")); + outParams.addParameter().setValue(new StringType("STRINGVALOUT2")); + final String respString = p.encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + //@formatter:off + Parameters resp = client + .operation() + .onServer() + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class) + .useHttpGet() + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals("GET", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onType(Patient.class) + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class) + .useHttpGet() + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals("GET", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onInstance(new IdType("Patient", "123")) + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class) + .useHttpGet() + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals("GET", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + // @formatter:off + resp = client + .operation() + .onInstance(new IdType("http://foo.com/bar/baz/Patient/123/_history/22")) + .named("$SOMEOPERATION") + .withNoParameters(Parameters.class) + .useHttpGet() + .execute(); + // @formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + idx++; + } + + @Test + public void testOperationAsGetWithInParameters() throws Exception { + IParser p = ourCtx.newXmlParser(); + + Parameters inParams = new Parameters(); + inParams.addParameter().setName("param1").setValue(new StringType("STRINGVALIN1")); + inParams.addParameter().setName("param1").setValue(new StringType("STRINGVALIN1b")); + inParams.addParameter().setName("param2").setValue(new StringType("STRINGVALIN2")); + + Parameters outParams = new Parameters(); + outParams.addParameter().setValue(new StringType("STRINGVALOUT1")); + outParams.addParameter().setValue(new StringType("STRINGVALOUT2")); + final String respString = p.encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + //@formatter:off + Parameters resp = client + .operation() + .onServer() + .named("$SOMEOPERATION") + .withParameters(inParams) + .useHttpGet() + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/$SOMEOPERATION?param1=STRINGVALIN1¶m1=STRINGVALIN1b¶m2=STRINGVALIN2", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals("GET", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onType(Patient.class) + .named("$SOMEOPERATION") + .withParameters(inParams) + .useHttpGet() + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/$SOMEOPERATION?param1=STRINGVALIN1¶m1=STRINGVALIN1b¶m2=STRINGVALIN2", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals("GET", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + //@formatter:off + resp = client + .operation() + .onInstance(new IdType("Patient", "123")) + .named("$SOMEOPERATION") + .withParameters(inParams) + .useHttpGet() + .execute(); + //@formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION?param1=STRINGVALIN1¶m1=STRINGVALIN1b¶m2=STRINGVALIN2", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(respString, p.encodeResourceToString(resp)); + assertEquals("GET", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + // @formatter:off + resp = client + .operation() + .onInstance(new IdType("http://foo.com/bar/baz/Patient/123/_history/22")) + .named("$SOMEOPERATION") + .withParameters(inParams) + .useHttpGet() + .execute(); + // @formatter:on + assertEquals("http://example.com/fhir/Patient/123/$SOMEOPERATION?param1=STRINGVALIN1¶m1=STRINGVALIN1b¶m2=STRINGVALIN2", capt.getAllValues().get(idx).getURI().toASCIIString()); + idx++; + } + + @Test + public void testOperationWithBundleResponse() throws Exception { + IParser p = ourCtx.newXmlParser(); + + Parameters inParams = new Parameters(); + inParams.addParameter().setValue(new StringType("STRINGVALIN1")); + inParams.addParameter().setValue(new StringType("STRINGVALIN2")); + String reqString = p.encodeResourceToString(inParams); + + org.hl7.fhir.instance.model.Bundle outParams = new org.hl7.fhir.instance.model.Bundle(); + outParams.setTotal(123); + final String respString = p.encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + //@formatter:off + Parameters resp = client + .operation() + .onServer() + .named("$SOMEOPERATION") + .withParameters(inParams).execute(); + //@formatter:on + assertEquals("http://example.com/fhir/$SOMEOPERATION", capt.getAllValues().get(idx).getURI().toASCIIString()); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertEquals(extractBody(capt, idx), reqString); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + assertEquals(1, resp.getParameter().size()); + assertEquals(org.hl7.fhir.instance.model.Bundle.class, resp.getParameter().get(0).getResource().getClass()); + idx++; + } + + @Test + public void testTransactionWithListOfResources() throws Exception { + + org.hl7.fhir.instance.model.Bundle resp = new org.hl7.fhir.instance.model.Bundle(); + resp.addEntry().getTransactionResponse().setLocation("Patient/1/_history/1"); + resp.addEntry().getTransactionResponse().setLocation("Patient/2/_history/2"); + String respString = ourCtx.newJsonParser().encodeResourceToString(resp); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + List input = new ArrayList(); + + Patient p1 = new Patient(); // No ID + p1.addName().addFamily("PATIENT1"); + input.add(p1); + + Patient p2 = new Patient(); // Yes ID + p2.addName().addFamily("PATIENT2"); + p2.setId("Patient/2"); + input.add(p2); + + //@formatter:off + List response = client.transaction() + .withResources(input) + .encodedJson() + .execute(); + //@formatter:on + + assertEquals("http://example.com/fhir?_format=json", capt.getValue().getURI().toString()); + assertEquals(2, response.size()); + + String requestString = IOUtils.toString(((HttpEntityEnclosingRequest) capt.getValue()).getEntity().getContent()); + org.hl7.fhir.instance.model.Bundle requestBundle = ourCtx.newJsonParser().parseResource(org.hl7.fhir.instance.model.Bundle.class, requestString); + assertEquals(2, requestBundle.getEntry().size()); + assertEquals("POST", requestBundle.getEntry().get(0).getTransaction().getMethod().name()); + assertEquals("PUT", requestBundle.getEntry().get(1).getTransaction().getMethod().name()); + assertEquals("Patient/2", requestBundle.getEntry().get(1).getTransaction().getUrl()); + + p1 = (Patient) response.get(0); + assertEquals(new IdType("Patient/1/_history/1"), p1.getId().toUnqualified()); + // assertEquals("PATIENT1", p1.getName().get(0).getFamily().get(0).getValue()); + + p2 = (Patient) response.get(1); + assertEquals(new IdType("Patient/2/_history/2"), p2.getId().toUnqualified()); + // assertEquals("PATIENT2", p2.getName().get(0).getFamily().get(0).getValue()); + } + + @Test + public void testTransactionWithTransactionResource() throws Exception { + + org.hl7.fhir.instance.model.Bundle resp = new org.hl7.fhir.instance.model.Bundle(); + resp.addEntry().getTransactionResponse().setLocation("Patient/1/_history/1"); + resp.addEntry().getTransactionResponse().setLocation("Patient/2/_history/2"); + String respString = ourCtx.newJsonParser().encodeResourceToString(resp); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + org.hl7.fhir.instance.model.Bundle input = new org.hl7.fhir.instance.model.Bundle(); + + Patient p1 = new Patient(); // No ID + p1.addName().addFamily("PATIENT1"); + input.addEntry().setResource(p1); + + Patient p2 = new Patient(); // Yes ID + p2.addName().addFamily("PATIENT2"); + p2.setId("Patient/2"); + input.addEntry().setResource(p2); + + //@formatter:off + org.hl7.fhir.instance.model.Bundle response = client.transaction() + .withBundle(input) + .encodedJson() + .execute(); + //@formatter:on + + assertEquals("http://example.com/fhir?_format=json", capt.getValue().getURI().toString()); + assertEquals(2, response.getEntry().size()); + + assertEquals("Patient/1/_history/1", response.getEntry().get(0).getTransactionResponse().getLocation()); + assertEquals("Patient/2/_history/2", response.getEntry().get(1).getTransactionResponse().getLocation()); + } + + @Test + public void testDeleteConditional() throws Exception { + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, "")); + // when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", + // Constants.CT_TEXT + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).then(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + client.delete().resourceById(new IdType("Patient/123")).execute(); + assertEquals("DELETE", capt.getAllValues().get(idx).getMethod()); + assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + client.delete().resourceConditionalByUrl("Patient?name=foo").execute(); + assertEquals("DELETE", capt.getAllValues().get(idx).getMethod()); + assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + client.delete().resourceConditionalByType("Patient").where(new StringClientParam("name").matches().value("foo")).execute(); + assertEquals("DELETE", capt.getAllValues().get(idx).getMethod()); + assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + } + + @Test + public void testCreateConditional() throws Exception { + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, "")); + when(myHttpResponse.getEntity().getContent()).then(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + Patient p = new Patient(); + p.addName().addFamily("FOOFAMILY"); + + client.create().resource(p).conditionalByUrl("Patient?name=foo").execute(); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, idx), containsString("")); + assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString()); + assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_IF_NONE_EXIST).getValue()); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + client.create().resource(p).conditional().where(new StringClientParam("name").matches().value("foo")).execute(); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, idx), containsString("")); + assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString()); + assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_IF_NONE_EXIST).getValue()); + assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod()); + idx++; + + } + + @Test + public void testUpdateConditional() throws Exception { + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, "")); + when(myHttpResponse.getEntity().getContent()).then(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + Patient p = new Patient(); + p.addName().addFamily("FOOFAMILY"); + + client.update().resource(p).conditionalByUrl("Patient?name=foo").execute(); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, idx), containsString("")); + assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod()); + assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p)).conditionalByUrl("Patient?name=foo").execute(); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, idx), containsString("")); + assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod()); + assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + client.update().resource(p).conditional().where(new StringClientParam("name").matches().value("foo")).and(new StringClientParam("address").matches().value("AAA|BBB")).execute(); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, idx), containsString("")); + assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod()); + assertEquals("http://example.com/fhir/Patient?name=foo&address=AAA%5C%7CBBB", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p)).conditional().where(new StringClientParam("name").matches().value("foo")).and(new StringClientParam("address").matches().value("AAA|BBB")).execute(); + assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, idx), containsString("")); + assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod()); + assertEquals("http://example.com/fhir/Patient?name=foo&address=AAA%5C%7CBBB", capt.getAllValues().get(idx).getURI().toString()); + idx++; + + } + + private String extractBody(ArgumentCaptor capt, int count) throws IOException { + String body = IOUtils.toString(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(count)).getEntity().getContent(), "UTF-8"); + return body; + } + +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientTest.java new file mode 100644 index 00000000000..6f2078a8a2f --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/OperationClientTest.java @@ -0,0 +1,307 @@ +package ca.uhn.fhir.rest.client; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.InputStream; +import java.io.StringReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.instance.model.Parameters; +import org.hl7.fhir.instance.model.Patient; +import org.hl7.fhir.instance.model.StringType; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.Operation; +import ca.uhn.fhir.rest.annotation.OperationParam; +import ca.uhn.fhir.rest.client.api.IBasicClient; +import ca.uhn.fhir.rest.server.Constants; + +public class OperationClientTest { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(OperationClientTest.class); + private FhirContext ourCtx; + private HttpClient ourHttpClient; + + private HttpResponse ourHttpResponse; + + @Before + public void before() { + ourCtx = FhirContext.forDstu2Hl7Org(); + + ourHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + ourCtx.getRestfulClientFactory().setHttpClient(ourHttpClient); + ourCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.NEVER); + + ourHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + } + + @Test + public void testOpInstance() throws Exception { + Parameters outParams = new Parameters(); + outParams.addParameter().setName("FOO"); + final String retVal = ourCtx.newXmlParser().encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse); + when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(ourHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8")); + } + }); + + IOpClient client = ourCtx.newRestfulClient(IOpClient.class, "http://foo"); + + int idx = 0; + + Parameters response = client.opInstance(new IdDt("222"), new StringType("PARAM1str"), new Patient().setActive(true)); + assertEquals("FOO", response.getParameter().get(0).getName()); + HttpPost value = (HttpPost) capt.getAllValues().get(idx); + String requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + Parameters request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/Patient/222/$OP_INSTANCE", value.getURI().toASCIIString()); + assertEquals(2, request.getParameter().size()); + assertEquals("PARAM1", request.getParameter().get(0).getName()); + assertEquals("PARAM1str", ((StringType) request.getParameter().get(0).getValue()).getValue()); + assertEquals("PARAM2", request.getParameter().get(1).getName()); + assertEquals(Boolean.TRUE, ((Patient) request.getParameter().get(1).getResource()).getActive()); + idx++; + } + + @Test + public void testOpServer() throws Exception { + Parameters outParams = new Parameters(); + outParams.addParameter().setName("FOO"); + final String retVal = ourCtx.newXmlParser().encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse); + when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(ourHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8")); + } + }); + + IOpClient client = ourCtx.newRestfulClient(IOpClient.class, "http://foo"); + + int idx = 0; + + Parameters response = client.opServer(new StringType("PARAM1str"), new Patient().setActive(true)); + assertEquals("FOO", response.getParameter().get(0).getName()); + HttpPost value = (HttpPost) capt.getAllValues().get(idx); + String requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + Parameters request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/$OP_SERVER", value.getURI().toASCIIString()); + assertEquals(2, request.getParameter().size()); + assertEquals("PARAM1", request.getParameter().get(0).getName()); + assertEquals("PARAM1str", ((StringType) request.getParameter().get(0).getValue()).getValue()); + assertEquals("PARAM2", request.getParameter().get(1).getName()); + assertEquals(Boolean.TRUE, ((Patient) request.getParameter().get(1).getResource()).getActive()); + idx++; + + response = client.opServer(null, new Patient().setActive(true)); + assertEquals("FOO", response.getParameter().get(0).getName()); + value = (HttpPost) capt.getAllValues().get(idx); + requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals(1, request.getParameter().size()); + assertEquals("PARAM2", request.getParameter().get(0).getName()); + assertEquals(Boolean.TRUE, ((Patient) request.getParameter().get(0).getResource()).getActive()); + idx++; + + response = client.opServer(null, null); + assertEquals("FOO", response.getParameter().get(0).getName()); + value = (HttpPost) capt.getAllValues().get(idx); + requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals(0, request.getParameter().size()); + idx++; + + } + + @Test + public void testOpWithListParam() throws Exception { + Parameters outParams = new Parameters(); + outParams.addParameter().setName("FOO"); + final String retVal = ourCtx.newXmlParser().encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse); + when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(ourHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8")); + } + }); + + IOpClient client = ourCtx.newRestfulClient(IOpClient.class, "http://foo"); + + int idx = 0; + + Parameters response = client.opServerListParam(new Patient().setActive(true), Arrays.asList(new StringType("PARAM3str1"), new StringType("PARAM3str2"))); + assertEquals("FOO", response.getParameter().get(0).getName()); + HttpPost value = (HttpPost) capt.getAllValues().get(idx); + String requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + Parameters request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/$OP_SERVER_LIST_PARAM", value.getURI().toASCIIString()); + assertEquals(3, request.getParameter().size()); + assertEquals("PARAM2", request.getParameter().get(0).getName()); + assertEquals(Boolean.TRUE, ((Patient) request.getParameter().get(0).getResource()).getActive()); + assertEquals("PARAM3", request.getParameter().get(1).getName()); + assertEquals("PARAM3str1", ((StringType) request.getParameter().get(1).getValue()).getValue()); + assertEquals("PARAM3", request.getParameter().get(2).getName()); + assertEquals("PARAM3str2", ((StringType) request.getParameter().get(2).getValue()).getValue()); + idx++; + + response = client.opServerListParam(null, Arrays.asList(new StringType("PARAM3str1"), new StringType("PARAM3str2"))); + assertEquals("FOO", response.getParameter().get(0).getName()); + value = (HttpPost) capt.getAllValues().get(idx); + requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/$OP_SERVER_LIST_PARAM", value.getURI().toASCIIString()); + assertEquals(2, request.getParameter().size()); + assertEquals("PARAM3", request.getParameter().get(0).getName()); + assertEquals("PARAM3str1", ((StringType) request.getParameter().get(0).getValue()).getValue()); + assertEquals("PARAM3", request.getParameter().get(1).getName()); + assertEquals("PARAM3str2", ((StringType) request.getParameter().get(1).getValue()).getValue()); + idx++; + + response = client.opServerListParam(null, new ArrayList()); + assertEquals("FOO", response.getParameter().get(0).getName()); + value = (HttpPost) capt.getAllValues().get(idx); + requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/$OP_SERVER_LIST_PARAM", value.getURI().toASCIIString()); + assertEquals(0, request.getParameter().size()); + idx++; + + response = client.opServerListParam(null, null); + assertEquals("FOO", response.getParameter().get(0).getName()); + value = (HttpPost) capt.getAllValues().get(idx); + requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/$OP_SERVER_LIST_PARAM", value.getURI().toASCIIString()); + assertEquals(0, request.getParameter().size()); + idx++; + + + } + + @Test + public void testOpType() throws Exception { + Parameters outParams = new Parameters(); + outParams.addParameter().setName("FOO"); + final String retVal = ourCtx.newXmlParser().encodeResourceToString(outParams); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse); + when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(ourHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8")); + } + }); + + IOpClient client = ourCtx.newRestfulClient(IOpClient.class, "http://foo"); + + int idx = 0; + + Parameters response = client.opType(new StringType("PARAM1str"), new Patient().setActive(true)); + assertEquals("FOO", response.getParameter().get(0).getName()); + HttpPost value = (HttpPost) capt.getAllValues().get(idx); + String requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent()); + IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent()); + ourLog.info(requestBody); + Parameters request = ourCtx.newXmlParser().parseResource(Parameters.class, requestBody); + assertEquals("http://foo/Patient/$OP_TYPE", value.getURI().toASCIIString()); + assertEquals(2, request.getParameter().size()); + assertEquals("PARAM1", request.getParameter().get(0).getName()); + assertEquals("PARAM1str", ((StringType) request.getParameter().get(0).getValue()).getValue()); + assertEquals("PARAM2", request.getParameter().get(1).getName()); + assertEquals(Boolean.TRUE, ((Patient) request.getParameter().get(1).getResource()).getActive()); + idx++; + } + + public interface IOpClient extends IBasicClient { + //@formatter:off + @Operation(name="$OP_INSTANCE", type=Patient.class) + public Parameters opInstance( + @IdParam IdDt theId, + @OperationParam(name="PARAM1") StringType theParam1, + @OperationParam(name="PARAM2") Patient theParam2 + ); + //@formatter:on + + //@formatter:off + @Operation(name="$OP_SERVER") + public Parameters opServer( + @OperationParam(name="PARAM1") StringType theParam1, + @OperationParam(name="PARAM2") Patient theParam2 + ); + //@formatter:on + + //@formatter:off + @Operation(name="$OP_SERVER_LIST_PARAM") + public Parameters opServerListParam( + @OperationParam(name="PARAM2") Patient theParam2, + @OperationParam(name="PARAM3") List theParam3 + ); + //@formatter:on + + //@formatter:off + @Operation(name="$OP_TYPE", type=Patient.class) + public Parameters opType( + @OperationParam(name="PARAM1") StringType theParam1, + @OperationParam(name="PARAM2") Patient theParam2 + ); + //@formatter:on + + } +} diff --git a/hapi-fhir-testpage-overlay/.gitignore b/hapi-fhir-testpage-overlay/.gitignore index c03ad9739e0..84c048a73cc 100644 --- a/hapi-fhir-testpage-overlay/.gitignore +++ b/hapi-fhir-testpage-overlay/.gitignore @@ -1,127 +1 @@ -/target/ - -# Created by https://www.gitignore.io - -### Java ### -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - - -### Maven ### -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties - - -### Vim ### -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -*.un~ -Session.vim -.netrwhist -*~ - - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm - -*.iml - -## Directory-based project format: -.idea/ -# if you remove the above rule, at least ignore the following: - -# User-specific stuff: -# .idea/workspace.xml -# .idea/tasks.xml -# .idea/dictionaries - -# Sensitive or high-churn files: -# .idea/dataSources.ids -# .idea/dataSources.xml -# .idea/sqlDataSources.xml -# .idea/dynamic.xml -# .idea/uiDesigner.xml - -# Gradle: -# .idea/gradle.xml -# .idea/libraries - -# Mongo Explorer plugin: -# .idea/mongoSettings.xml - -## File-based project format: -*.ipr -*.iws - -## Plugin-specific files: - -# IntelliJ -/out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties - - - -### Eclipse ### -*.pydevproject -.metadata -.gradle -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath - -# Eclipse Core -.project - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# JDT-specific (Eclipse Java Development Tools) -.classpath - -# PDT-specific -.buildpath - -# sbteclipse plugin -.target - -# TeXlipse plugin -.texlipse - +/build/ diff --git a/hapi-fhir-testpage-overlay/.project b/hapi-fhir-testpage-overlay/.project index 7c7bcb0cf03..f86c4f92f18 100644 --- a/hapi-fhir-testpage-overlay/.project +++ b/hapi-fhir-testpage-overlay/.project @@ -1,10 +1,8 @@ hapi-fhir-testpage-overlay - NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + - hapi-fhir-jpaserver-base - hapi-fhir-jpaserver-test @@ -13,12 +11,12 @@ - org.eclipse.wst.common.project.facet.core.builder + org.eclipse.jdt.core.javabuilder - org.eclipse.jdt.core.javabuilder + org.eclipse.wst.common.project.facet.core.builder @@ -34,11 +32,11 @@ + org.eclipse.m2e.core.maven2Nature org.eclipse.jem.workbench.JavaEMFNature org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature org.eclipse.wst.jsdt.core.jsNature diff --git a/hapi-fhir-testpage-overlay/src/main/webapp/css/tester.css b/hapi-fhir-testpage-overlay/src/main/webapp/css/tester.css index 8486c654c25..697eac63c2e 100644 --- a/hapi-fhir-testpage-overlay/src/main/webapp/css/tester.css +++ b/hapi-fhir-testpage-overlay/src/main/webapp/css/tester.css @@ -78,12 +78,13 @@ SPAN.headerValue { } SPAN.includeCheckContainer { - margin-top: 6px; - margin-bottom: 6px; + margin-top: 2px; + margin-bottom: 2px; margin-right: 0px; - margin-left: 15px; + margin-left: 2px; white-space: nowrap; line-height: 35px; + display: inline-block; } SPAN.includeCheckCheck { diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java index 2ffc66d4d85..a43691f418e 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java @@ -106,7 +106,6 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP retVal.add(("/dt/" + version + "/attachment.xml")); retVal.add(("/dt/" + version + "/contactpoint.xml")); retVal.add(("/dt/" + version + "/elementdefinition.xml")); - retVal.add(("/dt/" + version + "/reference.xml")); retVal.add(("/dt/" + version + "/timing.xml")); retVal.add(("/dt/" + version + "/signature.xml")); } diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 5b7ed2cefc1..3d051bb05fc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -130,6 +130,12 @@ JPA server failed to index resources containing ContactPointDt elements with populated values (e.g. Patient.telecom). Thanks to Mohammad Jafari for reporting! + + Add a new configuration method on the parsers, + setStripVersionsFromReferences(boolean)
]]> which + configures the parser to preserve versions in resource reference links when + encoding. By default, these are removed. +