本文整理汇总了Java中ca.uhn.fhir.model.dstu2.resource.Patient.setGender方法的典型用法代码示例。如果您正苦于以下问题:Java Patient.setGender方法的具体用法?Java Patient.setGender怎么用?Java Patient.setGender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.model.dstu2.resource.Patient
的用法示例。
在下文中一共展示了Patient.setGender方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws DataFormatException, IOException {
Patient patient = new Patient();
patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:fake:mrns").setValue("7000135");
patient.addIdentifier().setUse(IdentifierUseEnum.SECONDARY).setSystem("urn:fake:otherids").setValue("3287486");
patient.addName().addFamily("Smith").addGiven("John").addGiven("Q").addSuffix("Junior");
patient.setGender(AdministrativeGenderEnum.MALE);
FhirContext ctx = new FhirContext();
String xmlEncoded = ctx.newXmlParser().encodeResourceToString(patient);
String jsonEncoded = ctx.newJsonParser().encodeResourceToString(patient);
MyClientInterface client = ctx.newRestfulClient(MyClientInterface.class, "http://foo/fhir");
IdentifierDt searchParam = new IdentifierDt("urn:someidentifiers", "7000135");
List<Patient> clients = client.findPatientsByIdentifier(searchParam);
}
示例2: codes
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public static void codes() {
// START SNIPPET: codes
Patient patient = new Patient();
// You can set this code using a String if you want. Note that
// for "closed" valuesets (such as the one used for Patient.gender)
// you must use one of the strings defined by the FHIR specification.
// You must not define your own.
patient.getGenderElement().setValue("male");
// HAPI also provides Java enumerated types which make it easier to
// deal with coded values. This code achieves the exact same result
// as the code above.
patient.setGender(AdministrativeGenderEnum.MALE);
// You can also retrieve coded values the same way
String genderString = patient.getGenderElement().getValueAsString();
AdministrativeGenderEnum genderEnum = patient.getGenderElement().getValueAsEnum();
// The following is a shortcut to create
patient.setMaritalStatus(MaritalStatusCodesEnum.M);
// END SNIPPET: codes
}
示例3: getResourceById
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的package包/类
/**
* The "@Read" annotation indicates that this method supports the
* read operation. Read operations should return a single resource
* instance.
*
* @param theId
* The read operation takes one parameter, which must be of type
* IdDt and must be annotated with the "@Read.IdParam" annotation.
* @return
* Returns a resource matching this identifier, or null if none exists.
*/
@Read()
public Patient getResourceById(@IdParam IdDt theId) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00002");
patient.addName().addFamily("Test");
patient.getName().get(0).addGiven("PatientOne");
patient.setGender(AdministrativeGenderEnum.FEMALE);
return patient;
}
示例4: getResourceById
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的package包/类
/**
* The "@Read" annotation indicates that this method supports the
* read operation. It takes one argument, the Resource type being returned.
*
* @param theId
* The read operation takes one parameter, which must be of type
* IdDt and must be annotated with the "@Read.IdParam" annotation.
* @return
* Returns a resource matching this identifier, or null if none exists.
*/
@Read()
public Patient getResourceById(@IdParam IdDt theId) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00002");
patient.addName().addFamily("Test");
patient.getName().get(0).addGiven("PatientOne");
patient.setGender(AdministrativeGenderEnum.FEMALE);
return patient;
}
示例5: testParseResourceType
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的package包/类
/**
* See #163
*/
@Test
public void testParseResourceType() {
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
// Patient
Patient patient = new Patient();
String patientId = UUID.randomUUID().toString();
patient.setId(new IdDt("Patient", patientId));
patient.addName().addGiven("John").addFamily("Smith");
patient.setGender(AdministrativeGenderEnum.MALE);
patient.setBirthDate(new DateDt("1987-04-16"));
// Bundle
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
bundle.setType(BundleTypeEnum.COLLECTION);
bundle.addEntry().setResource(patient);
String bundleText = xmlParser.encodeResourceToString(bundle);
ourLog.info(bundleText);
ca.uhn.fhir.model.dstu2.resource.Bundle reincarnatedBundle = xmlParser.parseResource (ca.uhn.fhir.model.dstu2.resource.Bundle.class, bundleText);
Patient reincarnatedPatient = reincarnatedBundle.getAllPopulatedChildElementsOfType(Patient.class).get(0);
assertEquals("Patient", patient.getId().getResourceType());
assertEquals("Patient", reincarnatedPatient.getId().getResourceType());
}
示例6: testParseResourceType
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入方法依赖的package包/类
/**
* See #163
*/
@Test
public void testParseResourceType() {
IParser jsonParser = ourCtx.newJsonParser().setPrettyPrint(true);
// Patient
Patient patient = new Patient();
String patientId = UUID.randomUUID().toString();
patient.setId(new IdDt("Patient", patientId));
patient.addName().addGiven("John").addFamily("Smith");
patient.setGender(AdministrativeGenderEnum.MALE);
patient.setBirthDate(new DateDt("1987-04-16"));
// Bundle
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
bundle.setType(BundleTypeEnum.COLLECTION);
bundle.addEntry().setResource(patient);
String bundleText = jsonParser.encodeResourceToString(bundle);
ourLog.info(bundleText);
ca.uhn.fhir.model.dstu2.resource.Bundle reincarnatedBundle = jsonParser.parseResource (ca.uhn.fhir.model.dstu2.resource.Bundle.class, bundleText);
Patient reincarnatedPatient = reincarnatedBundle.getAllPopulatedChildElementsOfType(Patient.class).get(0);
assertEquals("Patient", patient.getId().getResourceType());
assertEquals("Patient", reincarnatedPatient.getId().getResourceType());
}
示例7: 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();
}
示例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 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);
}
示例9: 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);
}