@Test public void birthdateFromAge_shouldCalculateBirthdate() { Assert.assertThat(controller.birthdateFromAge(10, null, kenyaui), hasKey("birthdate")); Assert.assertThat(controller.birthdateFromAge(0, TestUtils.date(2000, 6, 1), kenyaui), hasEntry("birthdate", (Object) "2000-06-01")); Assert.assertThat(controller.birthdateFromAge(10, TestUtils.date(2000, 6, 1), kenyaui), hasEntry("birthdate", (Object) "1990-06-01")); }
public SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age, @RequestParam(value = "now", required = false) Date now, @SpringBean KenyaUiUtils kenyaui) { Calendar cal = Calendar.getInstance(); cal.setTime(now != null ? now : new Date()); cal.add(Calendar.YEAR, -age); return SimpleObject.create("birthdate", kenyaui.formatDateParam(cal.getTime())); }
EmrUtilsFragmentController { public SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age, @RequestParam(value = "now", required = false) Date now, @SpringBean KenyaUiUtils kenyaui) { Calendar cal = Calendar.getInstance(); cal.setTime(now != null ? now : new Date()); cal.add(Calendar.YEAR, -age); return SimpleObject.create("birthdate", kenyaui.formatDateParam(cal.getTime())); } }
EmrUtilsFragmentController { public SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age, @RequestParam(value = "now", required = false) Date now, @SpringBean KenyaUiUtils kenyaui) { Calendar cal = Calendar.getInstance(); cal.setTime(now != null ? now : new Date()); cal.add(Calendar.YEAR, -age); return SimpleObject.create("birthdate", kenyaui.formatDateParam(cal.getTime())); }  }
EmrUtilsFragmentController { public SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age, @RequestParam(value = "now", required = false) Date now, @SpringBean KenyaUiUtils kenyaui) { Calendar cal = Calendar.getInstance(); cal.setTime(now != null ? now : new Date()); cal.add(Calendar.YEAR, -age); return SimpleObject.create("birthdate", kenyaui.formatDateParam(cal.getTime())); }  @PublicAction SimpleObject isAuthenticated(); @PublicAction SimpleObject authenticate(@RequestParam(value = "username", required = false) String username,
									 @RequestParam(value = "password", required = false) String password); SimpleObject nextHivUniquePatientNumber(@RequestParam(required = false, value = "comment") String comment); SuccessResult voidRelationship(@RequestParam("relationshipId") Relationship relationship, @RequestParam("reason") String reason); @AppAction(EmrConstants.APP_CHART) SuccessResult voidVisit(@RequestParam("visitId") Visit visit, @RequestParam("reason") String reason); SimpleObject currentArvRegimen(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now, @SpringBean RegimenManager regimenManager, @SpringBean EmrUiUtils kenyaEmrUi, @SpringBean KenyaUiUtils kenyaUi, UiUtils ui); SimpleObject durationSinceStartArt(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now, @SpringBean KenyaUiUtils kenyaUi); SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age,
										 @RequestParam(value = "now", required = false) Date now,
										 @SpringBean KenyaUiUtils kenyaui); }
EmrUtilsFragmentController { public SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age, @RequestParam(value = "now", required = false) Date now, @SpringBean KenyaUiUtils kenyaui) { Calendar cal = Calendar.getInstance(); cal.setTime(now != null ? now : new Date()); cal.add(Calendar.YEAR, -age); return SimpleObject.create("birthdate", kenyaui.formatDateParam(cal.getTime())); }  @PublicAction SimpleObject isAuthenticated(); @PublicAction SimpleObject authenticate(@RequestParam(value = "username", required = false) String username,
									 @RequestParam(value = "password", required = false) String password); SimpleObject nextHivUniquePatientNumber(@RequestParam(required = false, value = "comment") String comment); SuccessResult voidRelationship(@RequestParam("relationshipId") Relationship relationship, @RequestParam("reason") String reason); @AppAction(EmrConstants.APP_CHART) SuccessResult voidVisit(@RequestParam("visitId") Visit visit, @RequestParam("reason") String reason); SimpleObject currentArvRegimen(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now, @SpringBean RegimenManager regimenManager, @SpringBean EmrUiUtils kenyaEmrUi, @SpringBean KenyaUiUtils kenyaUi, UiUtils ui); SimpleObject durationSinceStartArt(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now, @SpringBean KenyaUiUtils kenyaUi); SimpleObject birthdateFromAge(@RequestParam(value = "age") Integer age,
										 @RequestParam(value = "now", required = false) Date now,
										 @SpringBean KenyaUiUtils kenyaui);  }