• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HumanNameDt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ca.uhn.fhir.model.dstu2.composite.HumanNameDt的典型用法代码示例。如果您正苦于以下问题:Java HumanNameDt类的具体用法?Java HumanNameDt怎么用?Java HumanNameDt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HumanNameDt类属于ca.uhn.fhir.model.dstu2.composite包,在下文中一共展示了HumanNameDt类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
public static void main(String[] args)
{
    MediatorFhirConfig mediatorConfiguration=new MediatorFhirConfig();
    try {
        Practitioner oPractitioner=new Practitioner();
        oPractitioner.setId("123");
        HumanNameDt name=new HumanNameDt();
        name.addFamily("Gerard");
        oPractitioner.setName(name);
        List<IResource> listOfResource=new ArrayList<IResource>();
        listOfResource.add(oPractitioner);
        System.out.print(listOfResource.get(0).getResourceName());



    } catch (Exception e) {
       System.out.print(e.getMessage());
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:20,代码来源:TestProcess.java


示例2: testServiceCallInRHS

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@Test
public void testServiceCallInRHS() {
    Assert.assertNotNull(kBase);
    KieSession kSession = kBase.newKieSession();

    kSession.setGlobal("myConditionsProviderService", new MyConditionsProviderServiceImpl());
    System.out.println(" ---- Starting testServiceCallInRHS() Test ---");

    Patient patient = (Patient) new Patient().setId("Patient/1");
    FactHandle patientHandle = kSession.insert(patient);

    Assert.assertEquals(50, kSession.fireAllRules());
    
    //A modification of the patient will execute the service 
    patient.addName(new HumanNameDt().addFamily("Richards"));
    kSession.update(patientHandle, patient);
    Assert.assertEquals(50, kSession.fireAllRules());
    
    System.out.println(" ---- Finished testServiceCallInRHS() Test ---");
    kSession.dispose();
}
 
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:22,代码来源:WrongServiceRulesJUnitTest.java


示例3: findPatientsByName

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
/**
 * 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 theFamilyName
 *            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> findPatientsByName(@RequiredParam(name = Patient.SP_FAMILY) StringDt theFamilyName) {
	LinkedList<Patient> retVal = new LinkedList<Patient>();

	/*
	 * Look for all patients matching the name
	 */
	for (Deque<Patient> nextPatientList : myIdToPatientVersions.values()) {
		Patient nextPatient = nextPatientList.getLast();
		NAMELOOP: for (HumanNameDt nextName : nextPatient.getName()) {
			for (StringDt nextFamily : nextName.getFamily()) {
				if (theFamilyName.equals(nextFamily)) {
					retVal.add(nextPatient);
					break NAMELOOP;
				}
			}
		}
	}

	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:31,代码来源:PatientResourceProvider.java


示例4: namesHard

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
public void namesHard() {
   // START SNIPPET: namesHard
   Patient patient = new Patient();
   HumanNameDt name = patient.addName();
   StringDt family = name.addFamily();
   family.setValue("Smith");
   StringDt firstName = name.addGiven();
   firstName.setValue("Rob");
   StringDt secondName = name.addGiven();
   secondName.setValue("Bruce");
   // END SNIPPET: namesHard
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:13,代码来源:FhirDataModel.java


示例5: encodeMsg

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
public void encodeMsg() throws DataFormatException {
FhirContext ctx = new FhirContext(Patient.class, Observation.class);
//START SNIPPET: encodeMsg

/**
 * FHIR model types in HAPI are simple POJOs. To create a new
 * one, invoke the default constructor and then
 * start populating values.
 */
Patient patient = new Patient();

// Add an MRN (a patient identifier)
IdentifierDt id = patient.addIdentifier();
id.setSystem("http://example.com/fictitious-mrns");
id.setValue("MRN001");

// Add a name
HumanNameDt name = patient.addName();
name.setUse(NameUseEnum.OFFICIAL);
name.addFamily("Tester");
name.addGiven("John");
name.addGiven("Q");

// We can now use a parser to encode this resource into a string.
String encoded = ctx.newXmlParser().encodeResourceToString(patient);
System.out.println(encoded);
//END SNIPPET: encodeMsg

//START SNIPPET: encodeMsgJson
IParser jsonParser = ctx.newJsonParser();
jsonParser.setPrettyPrint(true);
encoded = jsonParser.encodeResourceToString(patient);
System.out.println(encoded);
//END SNIPPET: encodeMsgJson

		
	}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:38,代码来源:FhirContextIntro.java


示例6: testUpdateById

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@Test
public void testUpdateById() {
	final Patient existing = client.read(Patient.class, "1");
	final List<HumanNameDt> name = existing.getName();
	name.get(0).addSuffix("The Second");
	existing.setName(name);
	client.setEncoding(EncodingEnum.XML);
	final MethodOutcome results = client.update("1", existing);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:10,代码来源:JaxRsPatientProviderTest.java


示例7: testExtensionOnPrimitiveExtensionJson

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@Test
public void testExtensionOnPrimitiveExtensionJson() throws Exception {
    MyPatientWithCustomUrlExtension patient = new MyPatientWithCustomUrlExtension();
    patient.setId("1");
    final HumanNameDt name = patient.getNameFirstRep();
    name.addFamily(new StringDt("family"));
    name.getFamilyFirstRep().addUndeclaredExtension(new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/iso21090-nullFlavor", new StringDt("UNK")));

    final StringDt stringExt = new StringDt();
    stringExt.setValue("myStringExt");
    stringExt.addUndeclaredExtension(new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/iso21090-nullFlavor", new StringDt("UNK")));
    final ExtensionDt ext = new ExtensionDt();
    ext.setValue(stringExt);
    ext.setUrl("/myExt");
    patient.addUndeclaredExtension(ext);


    patient.setPetName(new StringDt("myPet"));
    patient.getPetName().addUndeclaredExtension(false, "http://hl7.org/fhir/StructureDefinition/iso21090-nullFlavor", new StringDt("UNK"));

    final IParser parser = ctx.newJsonParser().setPrettyPrint(true);
    final String json = parser.encodeResourceToString(patient);

    ourLog.info(json);

    patient = parser.parseResource(MyPatientWithCustomUrlExtension.class, json);
    assertEquals(1, patient.getName().get(0).getFamilyFirstRep().getUndeclaredExtensions().size());
    assertEquals(1, ((StringDt) patient.getUndeclaredExtensionsByUrl("/myExt").get(0).getValue()).getUndeclaredExtensions().size());
    assertEquals(1, patient.getPetName().getUndeclaredExtensions().size());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:31,代码来源:ElementWithExtensionDstu2Test.java


示例8: testExtensionOnPrimitiveExtensionXml

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@Test
public void testExtensionOnPrimitiveExtensionXml() throws Exception {
    MyPatientWithCustomUrlExtension patient = new MyPatientWithCustomUrlExtension();
    patient.setId("1");

    final HumanNameDt name = patient.getNameFirstRep();
    name.addFamily(new StringDt("family"));
    name.getFamilyFirstRep().addUndeclaredExtension(new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/iso21090-nullFlavor", new StringDt("UNK")));

    final StringDt stringExt = new StringDt();
    stringExt.setValue("myStringExt");
    stringExt.addUndeclaredExtension(new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/iso21090-nullFlavor", new StringDt("UNK")));
    final ExtensionDt ext = new ExtensionDt();
    ext.setValue(stringExt);
    ext.setUrl("/myExt");
    patient.addUndeclaredExtension(ext);


    patient.setPetName(new StringDt("myPet"));
    patient.getPetName().addUndeclaredExtension(false, "http://hl7.org/fhir/StructureDefinition/iso21090-nullFlavor", new StringDt("UNK"));
    final IParser parser = ctx.newXmlParser().setPrettyPrint(true);
    final String xml = parser.encodeResourceToString(patient);

    ourLog.info(xml);

    patient = parser.parseResource(MyPatientWithCustomUrlExtension.class, xml);
    assertEquals(1, patient.getName().get(0).getFamilyFirstRep().getUndeclaredExtensions().size());
    assertEquals(1, ((StringDt) patient.getUndeclaredExtensionsByUrl("/myExt").get(0).getValue()).getUndeclaredExtensions().size());
    assertEquals(1, patient.getPetName().getUndeclaredExtensions().size());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:31,代码来源:ElementWithExtensionDstu2Test.java


示例9: testSerialization2

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
/**
 * Contributed by Travis from iSalus
 */
@Test
public void testSerialization2() {
	Patient patient = new Patient().addName(new HumanNameDt().addGiven("George").addFamily("Washington")).addName(new HumanNameDt().addGiven("George2").addFamily("Washington2"))
			.addAddress(new AddressDt().addLine("line 1").addLine("line 2").setCity("city").setState("UT"))
			.addAddress(new AddressDt().addLine("line 1b").addLine("line 2b").setCity("cityb").setState("UT")).setBirthDate(new Date(), TemporalPrecisionEnum.DAY);

	testIsSerializable(patient);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:12,代码来源:ModelSerializationDstu2Test.java


示例10: searchByIdentifier

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Search()
public List searchByIdentifier(
		@RequiredParam(name=Patient.SP_IDENTIFIER) TokenParam theIdentifier) {
	ourLastMethod = "searchByIdentifier";
	ArrayList<Patient> retVal = new ArrayList<Patient>();
	retVal.add((Patient) new Patient().addName(new HumanNameDt().addFamily("FAMILY")).setId("1"));
	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:10,代码来源:SearchWithGenericListDstu2Test.java


示例11: search

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Search()
public List search(
		@OptionalParam(name=Patient.SP_IDENTIFIER) TokenParam theIdentifier,
		@Count() Integer theParam
		) {
	ourLastMethod = "search";
	ourLastParam = theParam;
	ArrayList<Patient> retVal = new ArrayList<Patient>();
	for (int i = 1; i < 100; i++) {
		retVal.add((Patient) new Patient().addName(new HumanNameDt().addFamily("FAMILY")).setId("" + i));
	}
	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:15,代码来源:SearchCountParamDstu2Test.java


示例12: searchWithNoCountParam

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Search(queryName="searchWithNoCountParam")
public List searchWithNoCountParam() {
	ourLastMethod = "searchWithNoCountParam";
	ourLastParam = null;
	ArrayList<Patient> retVal = new ArrayList<Patient>();
	for (int i = 1; i < 100; i++) {
		retVal.add((Patient) new Patient().addName(new HumanNameDt().addFamily("FAMILY")).setId("" + i));
	}
	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:12,代码来源:SearchCountParamDstu2Test.java


示例13: sendPatientToFhirServer

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
public String sendPatientToFhirServer(EgkPatient patient) {
    FhirContext ctx = FhirContext.forDstu2();
    IGenericClient client = ctx.newRestfulGenericClient(serverBase);

    //set Identifier
    Patient fhirPatient = new Patient();
    fhirPatient.addIdentifier()
            .setSystem("http://fhir.de/NamingSystem/gkv/kvnr")
            .setValue(patient.getHealthInsuranceNumber());
    //setName
    //TODO: HumanName.text adden
    HumanNameDt name = new HumanNameDt();
    name.addFamily(patient.getSurname())
            .addGiven(patient.getGivenName())
            .addPrefix(patient.getTitle())
            .addSuffix(patient.getNamenszusatz());
    ExtensionDt vorsatzwort = new ExtensionDt(false, "http://fhir.de/StructureDefinition/kbv/egk/vorsatzwort", new StringDt(patient.getVorsatzwort()));
    name.addUndeclaredExtension(vorsatzwort);
    fhirPatient.addName(name);

    //setSex
    if (patient.getSex() == Sex.FEMALE)
        fhirPatient.setGender(AdministrativeGenderEnum.FEMALE);
    else if (patient.getSex() == Sex.MALE)
        fhirPatient.setGender(AdministrativeGenderEnum.MALE);
    else
        throw new RuntimeException("Gender of patient was not set");

    //setBirthday
    fhirPatient.setBirthDateWithDayPrecision(Date.from(patient.getBirthday().atStartOfDay(ZoneId.systemDefault()).toInstant()));

    //setAdress
    //TODO: AdressType postal, other Countries than Germany
    List<AddressDt> adresses = new ArrayList<AddressDt>();
    AddressDt adress = new AddressDt();
    adress.addLine(patient.getStreetname() + " " + patient.getHousenumber()).setCity(patient.getCity()).setType(AddressTypeEnum.PHYSICAL).setPostalCode(patient.getZip()).setCountry("Germany");


    ExtensionDt streetname = new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-streetName", new StringDt(patient.getStreetname()));
    ExtensionDt housenumber = new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-houseNumber", new StringDt(patient.getHousenumber()));
    adress.addUndeclaredExtension(streetname);
    adress.addUndeclaredExtension(housenumber);
    adresses.add(adress);
    fhirPatient.setAddress(adresses);

    //setProfile
    fhirPatient.getResourceMetadata().put(ResourceMetadataKeyEnum.PROFILES,
            "http://fhir.de/StructureDefinition/kbv/persoenlicheVersicherungsdaten");

    //submitToServer
    IdDt idPatient = (IdDt) client.update().resource(fhirPatient).conditional()
            .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("http://fhir.de/NamingSystem/gkv/kvnr", patient.getHealthInsuranceNumber()))
            .execute().getId();
    logger.info("EgkPatient with ID: " + idPatient + " generated");


    Organization healthInsurance = new Organization();
    healthInsurance.addIdentifier()
            .setSystem("http://fhir.de/NamingSystem/arge-ik/iknr")
            .setValue(patient.getHealthInsuranceProviderNumber());
    healthInsurance.setName(patient.getHealthInsuranceProviderName());
    IdDt idInsurance = (IdDt) client.update().resource(healthInsurance).conditional()
            .where(Organization.IDENTIFIER.exactly().systemAndIdentifier("http://fhir.de/NamingSystem/arge-ik/iknr",patient.getHealthInsuranceProviderNumber()))
            .execute().getId();
    logger.info("Organization with ID: " + idInsurance + " generated");

    Coverage coverage = new Coverage();
    coverage.addIdentifier()
            .setSystem("http://fhir.de/NamingSystem/gkv/kvnr").setValue(patient.getHealthInsuranceNumber());
    coverage.setIssuer(new ResourceReferenceDt(idInsurance))
            .setSubscriber(new ResourceReferenceDt(idPatient));
    IdDt idCoverage = (IdDt) client.update().resource(coverage).conditional()
            .where(Coverage.IDENTIFIER.exactly().systemAndIdentifier("http://fhir.de/NamingSystem/gkv/kvnr", patient.getHealthInsuranceNumber()))
            .execute().getId();
    logger.info("Coverage with ID: " + idCoverage + " generated");

    return idPatient.toString();
}
 
开发者ID:patrick-werner,项目名称:EGKfeuer,代码行数:79,代码来源:PatientToFhirServiceDSTU2.java


示例14: testEN2HumanName

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@Test
public void testEN2HumanName() {
	// simple instance test 1
	EN en = DatatypesFactory.eINSTANCE.createEN();
	// Notice that EntityNameUse.P maps to NameUseEnum.NICKNAME.
	en.getUses().add(EntityNameUse.P);
	en.addText("theText");
	en.addFamily("theFamily");
	en.addGiven("theGiven");
	en.addPrefix("thePrefix");
	en.addSuffix("theSuffix");
	
	// Data for ivl_ts:  low: 19950127, high: 20160228
	IVL_TS ivl_ts = DatatypesFactory.eINSTANCE.createIVL_TS("19950115","20160228");
	en.setValidTime(ivl_ts);
	
	HumanNameDt humanName = dtt.tEN2HumanName(en);
	
	Assert.assertEquals("EN.use was not transformed","nickname",humanName.getUse());
	Assert.assertEquals("EN.text was not transformed","theText",humanName.getText());
	Assert.assertEquals("EN.family was not transformed","theFamily",humanName.getFamily().get(0).getValue());
	Assert.assertEquals("EN.given was not transformed","theGiven",humanName.getGiven().get(0).getValue());
	Assert.assertEquals("EN.prefix was not transformed","thePrefix",humanName.getPrefix().get(0).getValue());
	Assert.assertEquals("EN.suffix was not transformed","theSuffix",humanName.getSuffix().get(0).getValue());
	
	// EN.period tests for the simple instance test 1
	PeriodDt en_period = dtt.tIVL_TS2Period(ivl_ts);
	Assert.assertEquals("EN.period(low) was not transformed",en_period.getStart(),humanName.getPeriod().getStart());
	Assert.assertEquals("EN.period(high) was not transformed",en_period.getEnd(),humanName.getPeriod().getEnd());
	
	// instance test: there exists an instance of ED but no setter is called
	EN en4 = DatatypesFactory.eINSTANCE.createEN();
	HumanNameDt humanName4 = dtt.tEN2HumanName(en4);
	Assert.assertNull("EN.use was not transformed",humanName4.getUse());
	Assert.assertNull("EN.text was not transformed",humanName4.getText());
	Assert.assertTrue("EN.family was not transformed",humanName4.getFamily().size() == 0);
	Assert.assertTrue("EN.given was not transformed",humanName4.getGiven().size() == 0);
	Assert.assertTrue("EN.prefix was not transformed",humanName4.getPrefix().size() == 0);
	Assert.assertTrue("EN.suffix was not transformed",humanName4.getSuffix().size() == 0);
	
	// null instance test
	EN en2 = null;
	HumanNameDt humanName2 = dtt.tEN2HumanName(en2);
	Assert.assertNull("ED null instance transform failed", humanName2);
	
	
	// nullFlavor instance test
	EN en3 = DatatypesFactory.eINSTANCE.createEN();
	en3.setNullFlavor(NullFlavor.NI);
	HumanNameDt humanName3 = dtt.tEN2HumanName(en3);
	Assert.assertNull("EN.nullFlavor set instance transform failed",humanName3);
}
 
开发者ID:srdc,项目名称:cda2fhir,代码行数:53,代码来源:DataTypesTransformerTest.java


示例15: main

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws DataFormatException, IOException {

	
// START SNIPPET: resourceExtension
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:example").setValue("7000135");

// Create an extension
ExtensionDt ext = new ExtensionDt();
ext.setModifier(false);
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
// Continuing the example from above, we will add a name to the patient, and then
// add an extension to part of that name
HumanNameDt name = patient.addName();
name.addFamily().setValue("Shmoe");

// Add a new "given name", which is of type StringDt 
StringDt given = name.addGiven();
given.setValue("Joe");

// Create an extension and add it to the StringDt
ExtensionDt givenExt = new ExtensionDt(false, "http://examples.com#moreext", new StringDt("Hello"));
given.addUndeclaredExtension(givenExt);
//END SNIPPET: resourceStringExtension

String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
System.out.println(output);


//START SNIPPET: parseExtension
// Get all extensions (modifier or not) for a given URL
List<ExtensionDt> resourceExts = patient.getUndeclaredExtensionsByUrl("http://fooextensions.com#exts");

// Get all non-modifier extensions regardless of URL
List<ExtensionDt> nonModExts = patient.getUndeclaredExtensions();

//Get all non-modifier extensions regardless of URL
List<ExtensionDt> modExts = patient.getUndeclaredModifierExtensions();
//END SNIPPET: parseExtension

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:52,代码来源:Extensions.java


示例16: main

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws DataFormatException, IOException {
   
	
// START SNIPPET: resourceExtension
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:example").setValue("7000135");

// Create an extension
ExtensionDt ext = new ExtensionDt();
ext.setModifier(false);
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().setValue("Shmoe");
StringDt given = name.addGiven();
given.setValue("Joe");
ExtensionDt ext2 = new ExtensionDt(false, "http://examples.com#moreext", new StringDt("Hello"));
given.addUndeclaredExtension(ext2);
//END SNIPPET: resourceStringExtension

String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
System.out.println(output);


//START SNIPPET: parseExtension
// Get all extensions (modifier or not) for a given URL
List<ExtensionDt> resourceExts = patient.getUndeclaredExtensionsByUrl("http://fooextensions.com#exts");

// Get all non-modifier extensions regardless of URL
List<ExtensionDt> nonModExts = patient.getUndeclaredExtensions();

//Get all non-modifier extensions regardless of URL
List<ExtensionDt> modExts = patient.getUndeclaredModifierExtensions();
//END SNIPPET: parseExtension

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:46,代码来源:ServerInterceptors.java


示例17: main

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws DataFormatException, IOException {
   
	
// START SNIPPET: resourceExtension
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:example").setValue("7000135");

// Create an extension
ExtensionDt ext = new ExtensionDt();
ext.setModifier(false);
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().setValue("Shmoe");
StringDt given = name.addGiven();
given.setValue("Joe");
ExtensionDt ext2 = new ExtensionDt(false, "http://examples.com#moreext", new StringDt("Hello"));
given.addUndeclaredExtension(ext2);
//END SNIPPET: resourceStringExtension

String output = FhirContext.forDstu2().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
System.out.println(output);


//START SNIPPET: parseExtension
// Get all extensions (modifier or not) for a given URL
List<ExtensionDt> resourceExts = patient.getUndeclaredExtensionsByUrl("http://fooextensions.com#exts");

// Get all non-modifier extensions regardless of URL
List<ExtensionDt> nonModExts = patient.getUndeclaredExtensions();

//Get all non-modifier extensions regardless of URL
List<ExtensionDt> modExts = patient.getUndeclaredModifierExtensions();
//END SNIPPET: parseExtension

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:46,代码来源:ServerInterceptors.java


示例18: main

import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws DataFormatException, IOException {

   {   
   Questionnaire q= new Questionnaire();
   GroupQuestion item = q.getGroup().addQuestion();
   item.setText("Hello");
   
   ExtensionDt extension = new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/translation");
   item.getTextElement().addUndeclaredExtension(extension);
   
   extension.addUndeclaredExtension(new ExtensionDt(false, "lang", new CodeDt("es")));
   extension.addUndeclaredExtension(new ExtensionDt(false, "cont", new StringDt("hola")));
   
   System.out.println(FhirContext.forDstu2().newJsonParser().setPrettyPrint(true).encodeResourceToString(q));
   }

   
// START SNIPPET: resourceExtension
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:example").setValue("7000135");

// Create an extension
ExtensionDt ext = new ExtensionDt();
ext.setModifier(false);
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
// Continuing the example from above, we will add a name to the patient, and then
// add an extension to part of that name
HumanNameDt name = patient.addName();
name.addFamily().setValue("Shmoe");

// Add a new "given name", which is of type StringDt 
StringDt given = name.addGiven();
given.setValue("Joe");

// Create an extension and add it to the StringDt
ExtensionDt givenExt = new ExtensionDt(false, "http://examples.com#moreext", new StringDt("Hello"));
given.addUndeclaredExtension(givenExt);
//END SNIPPET: resourceStringExtension

FhirContext ctx = FhirContext.forDstu2();
String output = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
System.out.println(output);


//START SNIPPET: parseExtension
// Get all extensions (modifier or not) for a given URL
List<ExtensionDt> resourceExts = patient.getUndeclaredExtensionsByUrl("http://fooextensions.com#exts");

// Get all non-modifier extensions regardless of URL
List<ExtensionDt> nonModExts = patient.getUndeclaredExtensions();

//Get all non-modifier extensions regardless of URL
List<ExtensionDt> modExts = patient.getUndeclaredModifierExtensions();
//END SNIPPET: parseExtension

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:67,代码来源:ExtensionsDstu2.java



注:本文中的ca.uhn.fhir.model.dstu2.composite.HumanNameDt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WorkerPool类代码示例发布时间:2022-05-23
下一篇:
Java CustomizationUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap