当前位置: 首页>>代码示例>>Java>>正文


Java Patient.setGender方法代码示例

本文整理汇总了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);
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:QuickUsage.java

示例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

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

示例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;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:RestfulPatientResourceProvider.java

示例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;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:RestfulObservationResourceProvider.java

示例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());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:30,代码来源:XmlParserDstu2Test.java

示例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());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:30,代码来源:JsonParserDstu2Test.java

示例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();
}
 
开发者ID:patrick-werner,项目名称:EGKfeuer,代码行数:79,代码来源:PatientToFhirServiceDSTU2.java

示例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);
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:30,代码来源:RestfulPatientResourceProvider.java

示例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);
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:30,代码来源:RestfulObservationResourceProvider.java


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