/** * This is translated into a URL similar to the following: * http://fhir.healthintersections.com.au/open/Patient?identifier=urn:oid:1.2.36.146.595.217.0.1%7C12345 */ @Search List<Patient> findPatientsForMrn(@RequiredParam(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier);
@Search(queryName="namedQuery1") public List<Patient> searchByNamedQuery(@RequiredParam(name="someparam") StringParam theSomeParam) { List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: searchNamedQuery
@Search public List<Patient> findPatients( @RequiredParam(name="foo") StringParam theParameter, HttpServletRequest theRequest, HttpServletResponse theResponse) { List<Patient> retVal=new ArrayList<Patient>(); // populate this return retVal; } //END SNIPPET: underlyingReq
@Search() public List<Practitioner> findPractitionersByName( @RequiredParam(name = Practitioner.SP_NAME) final StringDt theName) { // throw new UnprocessableEntityException( // "Please provide more than 4 characters for the name"); return Lists.newArrayList(); }
/** A FHIR search */ @Search public List<Patient> findPatientsByIdentifier(@RequiredParam(name="identifier") IdentifierDt theIdentifier);
@Search List<Patient> getPatientByDob(@RequiredParam(name=Patient.SP_BIRTHDATE) DateParam theParam);
/** * The "@Search" annotation indicates that this method supports the * search operation. You may have many different method annotated with * this annotation, to support many different search criteria. This * example searches by family name. * * @param theIdentifier * This operation takes one parameter which is the search criteria. It is * annotated with the "@Required" annotation. This annotation takes one argument, * a string containing the name of the search criteria. The datatype here * is StringDt, but there are other possible parameter types depending on the * specific search criteria. * @return * This method returns a list of Patients. This list may contain multiple * matching resources, or it may also be empty. */ @Search() public List<Patient> getPatient(@RequiredParam(name = Patient.SP_FAMILY) StringDt theFamilyName);
@Search() public List<Observation> searchByObservationNames( @RequiredParam(name=Observation.SP_CODE) TokenOrListParam theCodings ) { // The list here will contain 0..* codings, and any observations which match any of the // given codings should be returned List<TokenParam> wantedCodings = theCodings.getValuesAsQueryTokens(); List<Observation> retVal = new ArrayList<Observation>(); // ...populate... return retVal; } //END SNIPPET: searchMultiple
/** * This method is a Patient search, but HAPI can not automatically * determine the resource type so it must be explicitly stated. */ @Search(type=Patient.class) public Bundle searchForPatients(@RequiredParam(name=Patient.SP_NAME) StringDt theName) { Bundle retVal = new Bundle(); // perform search return retVal; }
@Search() public List<Patient> searchByIdentifier(@RequiredParam(name=Patient.SP_IDENTIFIER) TokenParam theId) { String identifierSystem = theId.getSystem(); String identifier = theId.getValue(); List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: searchIdentifierParam
@Search public List<Patient> findObservations( @RequiredParam(name=Observation.SP_SUBJECT+'.'+Patient.SP_IDENTIFIER) TokenParam theProvider ) { String system = theProvider.getSystem(); String identifier = theProvider.getValue(); // ...Do a search for all observations for the given subject... List<Patient> retVal=new ArrayList<Patient>(); // populate this return retVal; } //END SNIPPET: referenceWithStaticChain
@Search() public List<Observation> searchByDateRange( @RequiredParam(name=Observation.SP_DATE) DateRangeParam theRange ) { Date from = theRange.getLowerBoundAsInstant(); Date to = theRange.getUpperBoundAsInstant(); List<Observation> retVal = new ArrayList<Observation>(); // ...populate... return retVal; } //END SNIPPET: dateRange
@Search() public List<Observation> searchByComposite( @RequiredParam(name=Observation.SP_CODE_VALUE_DATE, compositeTypes= {TokenParam.class, DateParam.class}) CompositeParam<TokenParam, DateParam> theParam) { // Each of the two values in the composite param are accessible separately. // In the case of Observation's name-value-date, the left is a string and // the right is a date. TokenParam observationName = theParam.getLeftValue(); DateParam observationValue = theParam.getRightValue(); List<Observation> retVal = new ArrayList<Observation>(); // ...populate... return retVal; } //END SNIPPET: searchComposite
@Search public List<DiagnosticReport> findReportsWithChain( @RequiredParam(name=DiagnosticReport.SP_SUBJECT, chainWhitelist= {Patient.SP_FAMILY, Patient.SP_GENDER}) ReferenceParam theSubject ) { List<DiagnosticReport> retVal=new ArrayList<DiagnosticReport>(); String chain = theSubject.getChain(); if (Patient.SP_FAMILY.equals(chain)) { String familyName = theSubject.getValue(); // .. populate with reports matching subject family name .. } if (Patient.SP_GENDER.equals(chain)) { String gender = theSubject.getValue(); // .. populate with reports matching subject gender .. } return retVal; } //END SNIPPET: referenceWithChain
@Search public List<DiagnosticReport> findReportsWithChainCombo ( @RequiredParam(name=DiagnosticReport.SP_SUBJECT, chainWhitelist= {"", Patient.SP_FAMILY}) ReferenceParam theSubject ) { List<DiagnosticReport> retVal=new ArrayList<DiagnosticReport>(); String chain = theSubject.getChain(); if (Patient.SP_FAMILY.equals(chain)) { String familyName = theSubject.getValue(); // .. populate with reports matching subject family name .. } if ("".equals(chain)) { String resourceId = theSubject.getValue(); // .. populate with reports matching subject with resource ID .. } return retVal; } //END SNIPPET: referenceWithChainCombo
@Search() public List<Observation> getObservationsByQuantity( @RequiredParam(name=Observation.SP_VALUE_QUANTITY) QuantityParam theQuantity) { List<Observation> retVal = new ArrayList<Observation>(); ParamPrefixEnum prefix = theQuantity.getPrefix(); BigDecimal value = theQuantity.getValue(); String units = theQuantity.getUnits(); // .. Apply these parameters .. // ... populate ... return retVal; } //END SNIPPET: quantity
@Search() public List<Patient> searchByNames( @RequiredParam(name=Patient.SP_FAMILY) StringParam theFamilyName, @OptionalParam(name=Patient.SP_GIVEN) StringParam theGivenName ) { String familyName = theFamilyName.getValue(); String givenName = theGivenName != null ? theGivenName.getValue() : null; List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: searchOptionalParam
@Search() public List<Patient> searchByObservationNames( @RequiredParam(name=Patient.SP_BIRTHDATE) DateParam theDate ) { ParamPrefixEnum prefix = theDate.getPrefix(); // e.g. gt, le, etc.. Date date = theDate.getValue(); // e.g. 2011-01-02 TemporalPrecisionEnum precision = theDate.getPrecision(); // e.g. DAY List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: dates
@Description(shortDefinition="This search finds all patient resources matching a given name combination") @Search() public List<Patient> searchWithDocs( @Description(shortDefinition="This is the patient's last name - Supports partial matches") @RequiredParam(name=Patient.SP_FAMILY) StringParam theFamilyName, @Description(shortDefinition="This is the patient's given names") @OptionalParam(name=Patient.SP_GIVEN) StringParam theGivenName ) { List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: searchWithDocs
@Search public List<Patient> findPatients( @RequiredParam(name=Patient.SP_IDENTIFIER) StringParam theParameter, @Sort SortSpec theSort) { List<Patient> retVal=new ArrayList<Patient>(); // populate this // theSort is null unless a _sort parameter is actually provided if (theSort != null) { // The name of the param to sort by String param = theSort.getParamName(); // The sort order, or null SortOrderEnum order = theSort.getOrder(); // This will be populated if a second _sort was specified SortSpec subSort = theSort.getChain(); // ...apply the sort... } return retVal; } //END SNIPPET: sort