本文整理汇总了Java中org.hl7.fhir.dstu3.model.Patient.addTelecom方法的典型用法代码示例。如果您正苦于以下问题:Java Patient.addTelecom方法的具体用法?Java Patient.addTelecom怎么用?Java Patient.addTelecom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hl7.fhir.dstu3.model.Patient
的用法示例。
在下文中一共展示了Patient.addTelecom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadPatientData
import org.hl7.fhir.dstu3.model.Patient; //导入方法依赖的package包/类
public void loadPatientData() throws Exception {
IParser parser = ctx.newJsonParser();
NameGenerator nameGenerator = new NameGenerator();
FileReader fileReader = new FileReader(
new File(this.getClass().getClassLoader().getResource("fhir/patient_f001.json").getPath()));
IBaseResource resource = parser.parseResource(fileReader);
for (int i = 0; i < 100; i++) {
String family = nameGenerator.getName();
String given1 = nameGenerator.getName();
String email = given1.toLowerCase() + "." + family.toLowerCase() + "@gmail.com";
resource.getIdElement().setValue("pat_" + i);
Patient patient = (Patient) resource;
patient.getIdentifier().get(0).setValue(resource.getIdElement().getValue());
HumanName name = patient.getName().get(0);
name.getFamily().clear();
name.getGiven().clear();
name.addFamily(family);
name.addGiven(given1).addGiven(nameGenerator.getName());
patient.setGender(i % 2 == 0 ? AdministrativeGender.MALE : AdministrativeGender.FEMALE);
patient.getTelecom().clear();
ContactPoint cp = new ContactPoint();
cp.setSystem(ContactPointSystem.EMAIL);
cp.setValue(email);
patient.addTelecom(cp);
String json = parser.encodeResourceToString(resource);
long timestamp = Calendar.getInstance().getTimeInMillis();
session.execute(
"INSERT INTO test.FHIR_RESOURCES (resource_id, version, resource_type, state, lastupdated, format, author, content)"
+ " VALUES ('" + resource.getIdElement().getValue() + "', 1, '"
+ resource.getClass().getSimpleName() + "', 'active', " + timestamp + ", 'json', 'dr who',"
+ "'" + json + "')");
System.out.println(resource.getClass().getSimpleName() + ": " + resource.getIdElement().getValue()
+ ", family:" + family + ", email:" + email);
}
}