@Test public void age_shouldCalculatePatientAgeOnDate() { Patient patient = TestUtils.getPatient(7); patient.setBirthdate(TestUtils.date(2000, 1, 1)); SimpleObject response = controller.age(patient, TestUtils.date(2010, 1, 1)); Assert.assertEquals(10, response.get("age")); response = controller.age(patient, TestUtils.date(2010, 6, 1)); Assert.assertEquals(10, response.get("age")); }
public SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now) { return SimpleObject.create("age", patient.getAge(now)); }
PatientUtilsFragmentController { public SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now) { return SimpleObject.create("age", patient.getAge(now)); } }
PatientUtilsFragmentController { public SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now) { return SimpleObject.create("age", patient.getAge(now)); }  }
PatientUtilsFragmentController { public SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now) { return SimpleObject.create("age", patient.getAge(now)); }  @SharedAction List<SimpleObject> getFlags(@RequestParam("patientId") Integer patientId, @SpringBean CalculationManager calculationManager); @SharedAction List<SimpleObject> getScheduled(@RequestParam("date") Date date, UiUtils ui); @SharedAction List<SimpleObject> getSeenPatients(@RequestParam("date") Date date, UiUtils ui); @AppAction(EmrConstants.APP_CHART) SimpleObject[] recentlyViewed(UiUtils ui, Session session); SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now); SimpleObject[] getMothers(@RequestParam("patientId") Patient patient,UiUtils ui); SimpleObject[] getFathers(@RequestParam("patientId") Patient patient,UiUtils ui); String patientExist(@RequestParam("patientId") String patientId,UiUtils ui); }
PatientUtilsFragmentController { public SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now) { return SimpleObject.create("age", patient.getAge(now)); }  @SharedAction List<SimpleObject> getFlags(@RequestParam("patientId") Integer patientId, @SpringBean CalculationManager calculationManager); @SharedAction List<SimpleObject> getScheduled(@RequestParam("date") Date date, UiUtils ui); @SharedAction List<SimpleObject> getSeenPatients(@RequestParam("date") Date date, UiUtils ui); @AppAction(EmrConstants.APP_CHART) SimpleObject[] recentlyViewed(UiUtils ui, Session session); SimpleObject age(@RequestParam("patientId") Patient patient, @RequestParam("now") Date now); SimpleObject[] getMothers(@RequestParam("patientId") Patient patient,UiUtils ui); SimpleObject[] getFathers(@RequestParam("patientId") Patient patient,UiUtils ui); String patientExist(@RequestParam("patientId") String patientId,UiUtils ui);  }