コード例 #1
0
  /** @throws Exception */
  @Test
  public void addConsumedMedication() throws Exception {

    int oldSize = patientMedicationDao.findAll().size();

    Patient patient = (Patient) userService.findUserByLogin("sysuser1");
    assertNotNull(patient);
    Medication medication = medicationService.findByName("Kort 2", Locale.GERMANY).get(0);
    assertNotNull(medication);

    Disease disease = diseaseService.findByCode("M79.0");
    assertNotNull(disease);

    patientMedicationService.addConsumedMedication(
        patient.getId(), disease.getId(), medication.getId(), 2.0d, new Date(), null);
    assertEquals(oldSize + 1, patientMedicationDao.findAll().size());

    patientMedicationService.addConsumedMedication(
        patient.getId(), disease.getId(), medication.getId(), 2.0d, new Date(), "test");
    assertEquals(oldSize + 2, patientMedicationDao.findAll().size());

    List<Medication> result =
        patientMedicationService.findAllConsumedMedications(patient.getId(), disease.getId());
    assertEquals(4, result.size());
    assertFalse(result.get(0).equals(result.get(1)));

    result = patientMedicationService.findAllConsumedMedications(patient.getId(), 0L);
    assertEquals(0, result.size());
  }
コード例 #2
0
  /** @throws Exception */
  @Test
  public void findConsumedMedications() throws Exception {
    Patient patient = (Patient) userService.findUserByLogin("sysuser1");
    assertNotNull(patient);

    Disease disease = diseaseService.findByCode("M79.0");
    assertNotNull(disease);

    List<Medication> result =
        patientMedicationService.findAllConsumedMedications(patient.getId(), disease.getId());
    assertEquals(4, result.size());
    Medication medication = result.get(0);
    assertNotNull(medication);
  }