本文整理汇总了Java中ca.uhn.fhir.model.dstu2.resource.Patient.addName方法的典型用法代码示例。如果您正苦于以下问题:Java Patient.addName方法的具体用法?Java Patient.addName怎么用?Java Patient.addName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.model.dstu2.resource.Patient
的用法示例。
在下文中一共展示了Patient.addName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testServiceCallInRHS
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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();
}
示例2: namesHard
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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
}
示例3: encodeMsg
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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
}
示例4: sendPatientToFhirServer
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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();
}
示例5: main
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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
}
示例6: main
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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
}
示例7: getPatient
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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 StringParam, 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) StringParam theFamilyName) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setUse(IdentifierUseEnum.OFFICIAL);
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00001");
patient.addName();
patient.getName().get(0).addFamily(theFamilyName.getValue());
patient.getName().get(0).addGiven("PatientOne");
patient.setGender(AdministrativeGenderEnum.MALE);
return Collections.singletonList(patient);
}
示例8: getPatient
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的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 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) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setUse(IdentifierUseEnum.OFFICIAL);
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00001");
patient.addName();
patient.getName().get(0).addFamily("Test");
patient.getName().get(0).addGiven("PatientOne");
patient.setGender(AdministrativeGenderEnum.MALE);
return Collections.singletonList(patient);
}