/**
   * gets Patient from the server if existing. else creates a new one.
   *
   * @return
   */
  private Patient getPatient() {
    Log.d(TAG, "looking for patient");
    Patient p =
        this.newPatient(patient.getLastname(), patient.getFirstName(), patient.getDateOfBirth());
    p.setText(getNarrative(p));
    p.setIdentifier(
        Arrays.asList(
            new IdentifierDt()
                .setSystem(SYSTEM_URL.concat("/patients/"))
                .setValue(
                    patient
                        .getLastname()
                        .concat(patient.getFirstName())
                        .concat(
                            SimpleDateFormat.getDateInstance(DateFormat.SHORT)
                                .format(patient.getDateOfBirth())))));

    IdDt patientId =
        (IdDt)
            client
                .create()
                .resource(p)
                .conditionalByUrl(getConditionalUrl(p, p.getIdentifierFirstRep()))
                .execute()
                .getId();
    p.setId(patientId);

    return p;
  }
Пример #2
0
    @Search(queryName = "containedInclude")
    public List<Patient> containedInclude() {
      Organization o1 = new Organization();
      o1.getNameElement().setValue("o1");

      Patient p1 = new Patient();
      p1.setId("p1");
      p1.addIdentifier().setValue("p1");
      p1.getManagingOrganization().setResource(o1);

      Patient p2 = new Patient();
      p2.setId("p2");
      p2.addIdentifier().setValue("p2");
      p2.getManagingOrganization().setResource(o1);

      return Arrays.asList(p1, p2);
    }
Пример #3
0
    @Search(queryName = "extInclude")
    public List<Patient> extInclude() {
      Organization o1 = new Organization();
      o1.getNameElement().setValue("o1");
      o1.setId("o1");

      Patient p1 = new Patient();
      p1.setId("p1");
      p1.addIdentifier().setValue("p1");
      p1.addUndeclaredExtension(false, "http://foo", new ResourceReferenceDt(o1));

      Patient p2 = new Patient();
      p2.setId("p2");
      p2.addIdentifier().setValue("p2");
      p2.addUndeclaredExtension(false, "http://foo", new ResourceReferenceDt(o1));

      return Arrays.asList(p1, p2);
    }
Пример #4
0
 @Search()
 public Patient search(@Elements Set<String> theElements) {
   ourLastElements = theElements;
   Patient patient = new Patient();
   patient.setId("Patient/1/_history/1");
   patient.getText().setDiv("<div>THE DIV</div>");
   patient.addName().addFamily("FAMILY");
   patient.setMaritalStatus(MaritalStatusCodesEnum.D);
   return patient;
 }
Пример #5
0
    @Search
    public List<Patient> findPatient(
        @RequiredParam(name = Patient.SP_NAME) StringDt theName,
        @IncludeParam(allow = {"foo", "bar"}) Set<Include> theIncludes) {
      ArrayList<Patient> retVal = new ArrayList<Patient>();

      Patient p = new Patient();
      p.addIdentifier().setSystem("foo").setValue("bar");

      p.setId(theName.getValue());

      if (theIncludes != null) {
        for (Include next : theIncludes) {
          p.addName().addFamily().setValue(next.getValue());
        }
      }
      retVal.add(p);

      return retVal;
    }