本文整理了Java中org.fujion.common.DateUtil.formatAge()
方法的一些代码示例,展示了DateUtil.formatAge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil.formatAge()
方法的具体详情如下:
包路径:org.fujion.common.DateUtil
类名称:DateUtil
方法名:formatAge
[英]Returns age as a formatted string expressed in days, months, or years, depending on whether person is an infant (< 2 mos), toddler (> 2 mos, < 2 yrs), or more than 2 years old.
[中]返回以天、月或年表示的格式化字符串形式的年龄,具体取决于此人是婴儿(<2个月)、幼儿(>2个月、<2岁)还是2岁以上。
代码示例来源:origin: org.fujion/fujion-common
/**
* <p>
* Returns age as a formatted string expressed in days, months, or years, depending on whether
* person is an infant (< 2 mos), toddler (> 2 mos, < 2 yrs), or more than 2 years old.
* </p>
*
* @param dob Date of person's birth
* @return the age display string
*/
public static String formatAge(Date dob) {
return formatAge(dob, true, null);
}
代码示例来源:origin: org.hspconsortium.carewebframework/cwf-plugin-patientheader
private String formatDateAndAge(Date date) {
return date == null ? null : DateUtil.formatDate(date) + " (" + DateUtil.formatAge(date) + ")";
}
代码示例来源:origin: org.fujion/fujion-common
@Test
public void testAge() {
Date dob = DateUtil.toDate(27, 7, 1958);
Date ref = DateUtil.toDate(1, 1, 2013);
assertEquals("54 yrs", DateUtil.formatAge(dob, true, ref));
assertEquals("54 yr", DateUtil.formatAge(dob, false, ref));
dob = DateUtil.toDate(15, 12, 2012);
assertEquals("17 days", DateUtil.formatAge(dob, true, ref));
dob = DateUtil.toDate(30, 10, 2012);
assertEquals("2 mos", DateUtil.formatAge(dob, true, ref));
}
代码示例来源:origin: org.hspconsortium.carewebframework/cwf-ui-reporting
/**
* Retrieves a formatted header for the current patient.
*
* @return Formatted header.
*/
public String getPatientInfo() {
Patient patient = PatientContext.getActivePatient();
String text;
if (patient == null) {
text = "No Patient Selected";
} else {
Identifier mrn = FhirUtil.getMRN(patient); // May be null!
text = FhirUtil.formatName(patient.getName());
if (mrn != null) {
text += " #" + mrn.getValue();
}
String gender = patient.hasGender() ? patient.getGender().getDisplay() : "";
if (!StringUtils.isEmpty(gender)) {
text += " (" + gender + ")";
}
Date deceased = patient.getDeceased() instanceof DateType ? ((DateType) patient.getDeceased()).getValue() : null;
String age = DateUtil.formatAge(patient.getBirthDate(), true, deceased);
text += " Age: " + age;
if (deceased != null) {
text += " Died: " + DateUtil.formatDate(deceased);
}
}
return text;
}
代码示例来源:origin: org.hspconsortium.carewebframework/cwf-ui-patientselection-core
addDemographic(root, "gender", patient.getGender());
addDemographic(root, "age", DateUtil.formatAge(patient.getBirthDate()));
addDemographic(root, "dob", patient.getBirthDate());
addDemographic(root, "dod", patient.getDeceased());
内容来源于网络,如有侵权,请联系作者删除!