List of usage examples for org.joda.time Period Period
public Period(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis, PeriodType type)
From source file:us.mn.state.health.lims.upload.patient.PatientPersister.java
License:Mozilla Public License
private Patient getPatient(CSVPatient csvPatient, Person person) throws ParseException { us.mn.state.health.lims.patient.valueholder.Patient patient = new us.mn.state.health.lims.patient.valueholder.Patient(); patient.setPerson(person);/* w w w . j a v a 2 s . c o m*/ patient.setGender(csvPatient.gender); patient.setSysUserId(getSysUserId()); patient.setUuid(UUID.randomUUID().toString()); patient.setHealthCenter(healthCenterDAO.getByName(csvPatient.healthCenter)); if (csvPatient.dob != null && csvPatient.dob.trim().length() > 0) { patient.setBirthDate(new Timestamp(getSimpleDateFormat().parse(csvPatient.dob).getTime())); } else { Period ageAsPeriod = new Period(Integer.parseInt(csvPatient.age), 0, 0, 0, 0, 0, 0, 0, PeriodType.yearMonthDay()); LocalDate dateOfBirth = new LocalDate(new Date()).minus(ageAsPeriod); patient.setBirthDateForDisplay(DateUtil.convertDateToAmbiguousStringDate(dateOfBirth.toDate())); } return patient; }