for (Element e : cda.getChildren(p, "name")) pat.getName().add(convert.makeNameFromEN(e)); pat.setGender(convert.makeGenderFromCD(cda.getChild(p, "administrativeGenderCode"))); pat.setBirthDateElement(convert.makeDateFromTS(cda.getChild(p, "birthTime"))); pat.setMaritalStatus(convert.makeCodeableConceptFromCD(cda.getChild(p, "maritalStatusCode")));
for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); tgt.setGender(convertAdministrativeGender(src.getGender())); tgt.setBirthDate(src.getBirthDate()); tgt.setDeceased(convertType(src.getDeceased()));
patient.setGender(patient.getGender() == AdministrativeGender.MALE ? AdministrativeGender.FEMALE : AdministrativeGender.MALE);
public static void main(String[] theArgs) { // Create a client IGenericClient client = FhirContext.forDstu3().newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3"); // Register some interceptors client.registerInterceptor(new CookieInterceptor("mycookie=Chips Ahoy")); client.registerInterceptor(new LoggingInterceptor()); // Read a Patient Patient patient = client.read().resource(Patient.class).withId("example").execute(); // Change the gender patient.setGender(patient.getGender() == AdministrativeGender.MALE ? AdministrativeGender.FEMALE : AdministrativeGender.MALE); // Update the patient MethodOutcome outcome = client.update().resource(patient).execute(); System.out.println("Now have ID: " + outcome.getId()); } }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); // Enumerated types are provided for many coded elements ContactPoint contact = pat.addTelecom(); contact.setUse(ContactPoint.ContactPointUse.HOME); contact.setSystem(ContactPoint.ContactPointSystem.PHONE); contact.setValue("1 (416) 340-4800"); pat.setGender(Enumerations.AdministrativeGender.MALE); } }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); // Enumerated types are provided for many coded elements ContactPoint contact = pat.addTelecom(); contact.setUse(ContactPoint.ContactPointUse.HOME); contact.setSystem(ContactPoint.ContactPointSystem.PHONE); contact.setValue("1 (416) 340-4800"); pat.setGender(Enumerations.AdministrativeGender.MALE); } }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); pat.setGender(AdministrativeGender.MALE); // Create a context FhirContext ctx = FhirContext.forDstu3(); // Create a client String serverBaseUrl = "http://fhirtest.uhn.ca/baseDstu3"; IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl); // Use the client to store a new resource instance MethodOutcome outcome = client .create() .resource(pat) .execute(); // Print the ID of the newly created resource System.out.println(outcome.getId()); } }
public static void main(String[] theArgs) { // Create a Patient Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); pat.addTelecom().setUse(ContactPointUse.HOME).setSystem(ContactPointSystem.PHONE).setValue("1 (416) 340-4800"); pat.setGender(AdministrativeGender.MALE); // Create a context FhirContext ctx = FhirContext.forDstu3(); // Create a JSON parser IParser parser = ctx.newJsonParser(); parser.setPrettyPrint(true); String encode = parser.encodeResourceToString(pat); System.out.println(encode); } }
public static void step3_create_patient() { // Create a patient Patient newPatient = new Patient(); // Populate the patient with fake information newPatient .addName() .setFamily("DevDays2015") .addGiven("John") .addGiven("Q"); newPatient .addIdentifier() .setSystem("http://acme.org/mrn") .setValue("1234567"); newPatient.setGender(Enumerations.AdministrativeGender.MALE); newPatient.setBirthDateElement(new DateType("2015-11-18")); // Create a client FhirContext ctx = FhirContext.forDstu3(); IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3"); // Create the resource on the server MethodOutcome outcome = client .create() .resource(newPatient) .execute(); // Log the ID that the server assigned IIdType id = outcome.getId(); System.out.println("Created patient, got ID: " + id); }
for (Element e : cda.getChildren(p, "name")) pat.getName().add(convert.makeNameFromEN(e)); pat.setGender(convert.makeGenderFromCD(cda.getChild(p, "administrativeGenderCode"))); pat.setBirthDateElement(convert.makeDateFromTS(cda.getChild(p, "birthTime"))); pat.setMaritalStatus(convert.makeCodeableConceptFromCD(cda.getChild(p, "maritalStatusCode")));
for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(convertContactPoint(t)); tgt.setGender(convertAdministrativeGender(src.getGender())); tgt.setBirthDate(src.getBirthDate()); tgt.setDeceased(convertType(src.getDeceased()));