示例#1
0
 @Test
 public void testSetPropertyD() throws Exception {
   Appointment app = new Appointment(null);
   app.setPropertyValue("MILEAGE", "500");
   assertEquals(500, app.getMileageD(), .0001);
   app.setPropertyValue("MILEAGE_D", "501");
   assertEquals(501, app.getMileage(), .0001);
   app.setPropertyValue("MILEAGE", "50000");
   assertEquals(50000, app.getMileage(), .0001);
   app.setPropertyValue("MILEAGE_D", "50000");
   assertEquals(50000, app.getMileage(), .0001);
 }
示例#2
0
  @Test
  public void testBilling() throws Exception {
    Vendor vendor =
        new Vendor(null)
            .setBillingFlat(200)
            .setBillingRate(50)
            .setBillingFlat2HrSoc(220)
            .setBillingRate2HrSoc(70)
            .setBillingFlat2HrRoc(210)
            .setBillingRate2HrRoc(60);
    Patient patient = new Patient(null).setVendor(vendor);
    Nurse nurse = new Nurse(null);
    DateTime timeIn = DateTime.now().minusHours(2);
    DateTime timeOut = DateTime.now();
    Appointment appointment =
        new Appointment(null)
            .setPatient(patient)
            .setNurse(nurse)
            .setStart(DateTime.now())
            .setTimeInD(timeIn)
            .setTimeOutD(timeOut);
    assertEquals(GenData.ACCOUNTING_TYPE_SOC_2HR.get(entityManager), appointment.getBillingType());
    assertEquals(2.0, appointment.getLoggedHours(), 0.0);
    assertEquals(220.0, appointment.getBillingFlat(), 0.0);
    assertEquals(0.0, appointment.getBilledHours(), 0.0);
    assertEquals(70.0, appointment.getBillingRate(), 0.0);
    assertEquals(220.0, appointment.getBillingTotal(), 0.0);

    appointment.setTimeInD(timeIn.minusHours(1));
    assertEquals(GenData.ACCOUNTING_TYPE_HOURLY.get(entityManager), appointment.getBillingType());
    assertEquals(3.0, appointment.getLoggedHours(), 0.0);
    assertEquals(0.0, appointment.getBillingFlat(), 0.0);
    assertEquals(50.0, appointment.getBillingRate(), 0.0);
    assertEquals(150.0, appointment.getBillingTotal(), 0.0);

    appointment.setBillingType(GenData.ACCOUNTING_TYPE_FIXED.get(entityManager));
    assertEquals(GenData.ACCOUNTING_TYPE_FIXED.get(entityManager), appointment.getBillingType());
    assertEquals(3.0, appointment.getLoggedHours(), 0.0);
    assertEquals(200.0, appointment.getBillingFlat(), 0.0);
    assertEquals(0.0, appointment.getBilledHours(), 0.0);
    assertEquals(0.0, appointment.getBillingRate(), 0.0);
    assertEquals(200.0, appointment.getBillingTotal(), 0.0);

    appointment.setTimeInD(timeIn.plusMinutes(105));
    appointment.setBillingType(GenData.ACCOUNTING_TYPE_FIXED.get(entityManager));
    assertEquals(GenData.ACCOUNTING_TYPE_FIXED.get(entityManager), appointment.getBillingType());
    assertEquals(.25, appointment.getLoggedHours(), 0.0);
    assertEquals(200.0, appointment.getBillingFlat(), 0.0);
    assertEquals(0.0, appointment.getBilledHours(), 0.0);
    assertEquals(0.0, appointment.getBillingRate(), 0.0);
    assertEquals(200.0, appointment.getBillingTotal(), 0.0);

    appointment.setTimeInD(timeIn.minusHours(1));
    appointment.setBillingType(GenData.ACCOUNTING_TYPE_SOC_2HR.get(entityManager));
    assertEquals(GenData.ACCOUNTING_TYPE_SOC_2HR.get(entityManager), appointment.getBillingType());
    assertEquals(3.0, appointment.getLoggedHours(), 0.0);
    assertEquals(220.0, appointment.getBillingFlat(), 0.0);
    assertEquals(1.0, appointment.getBilledHours(), 0.0);
    assertEquals(70.0, appointment.getBillingRate(), 0.0);
    assertEquals(290.0, appointment.getBillingTotal(), 0.0);

    appointment.setTimeInD(timeIn.minusMinutes(30));
    appointment.setBillingType(GenData.ACCOUNTING_TYPE_ROC_2HR.get(entityManager));
    assertEquals(GenData.ACCOUNTING_TYPE_ROC_2HR.get(entityManager), appointment.getBillingType());
    assertEquals(2.5, appointment.getLoggedHours(), 0.0);
    assertEquals(210.0, appointment.getBillingFlat(), 0.0);
    assertEquals(.5, appointment.getBilledHours(), 0.0);
    assertEquals(60.0, appointment.getBillingRate(), 0.0);
    assertEquals(240.0, appointment.getBillingTotal(), 0.0);

    appointment.setTimeInD(timeIn.plusMinutes(30));
    appointment.setBillingType(GenData.ACCOUNTING_TYPE_ROC_2HR.get(entityManager));
    assertEquals(GenData.ACCOUNTING_TYPE_ROC_2HR.get(entityManager), appointment.getBillingType());
    assertEquals(1.5, appointment.getLoggedHours(), 0.0);
    assertEquals(210.0, appointment.getBillingFlat(), 0.0);
    assertEquals(0.0, appointment.getBilledHours(), 0.0);
    assertEquals(60.0, appointment.getBillingRate(), 0.0);
    assertEquals(210.0, appointment.getBillingTotal(), 0.0);

    appointment.setPropertyValue("TIME_IN", "20:10");
    appointment.setPropertyValue("TIME_OUT", "03:10");
    appointment.setBillingType(GenData.ACCOUNTING_TYPE_HOURLY.get(entityManager));
    assertEquals(7, appointment.getLoggedHours(), 0.0);
    assertEquals(0.0, appointment.getBillingFlat(), 0.0);
    assertEquals(7, appointment.getBilledHours(), 0.0);
    assertEquals(50.0, appointment.getBillingRate(), 0.0);
    assertEquals(350.0, appointment.getBillingTotal(), 0.0);
  }
示例#3
0
  @Test
  public void testDateTimeMethods() throws ParseException, Exception {
    Appointment app = new Appointment(null);
    assertNull(app.getStart());
    assertNull(app.getEnd());
    app.setStartDate(FormatText.USER_DATE.parse("02/18/2013"));
    assertEquals(2, app.getStart().getMonthOfYear());
    assertEquals(18, app.getStart().getDayOfMonth());
    assertEquals(2013, app.getStart().getYear());
    assertEquals(0, app.getStart().getMillisOfDay());
    app.setStartTime(new Time(FormatText.TIME.parse("08:48:48").getTime()));
    assertEquals(2, app.getStart().getMonthOfYear());
    assertEquals(18, app.getStart().getDayOfMonth());
    assertEquals(2013, app.getStart().getYear());
    assertEquals(8, app.getStart().getHourOfDay());
    assertEquals(48, app.getStart().getMinuteOfHour());
    assertEquals(48, app.getStart().getSecondOfMinute());

    app.setPropertyValue("END_TIME", "10:48:48");
    assertEquals(2, app.getEnd().getMonthOfYear());
    assertEquals(18, app.getEnd().getDayOfMonth());
    assertEquals(2013, app.getEnd().getYear());
    assertEquals(10, app.getEnd().getHourOfDay());
    assertEquals(48, app.getEnd().getMinuteOfHour());
    assertEquals(0, app.getEnd().getSecondOfMinute());

    // End time set before start time. End date +1.
    app.setPropertyValue("END_TIME", "07:12");
    assertEquals(2, app.getEnd().getMonthOfYear());
    assertEquals(19, app.getEnd().getDayOfMonth());
    assertEquals(2013, app.getEnd().getYear());
    assertEquals(7, app.getEnd().getHourOfDay());
    assertEquals(12, app.getEnd().getMinuteOfHour());
    assertEquals(0, app.getEnd().getSecondOfMinute());

    // End time adjusted to after start time. End date -1.
    app.setPropertyValue("END_TIME", "12:12");
    assertEquals(2, app.getEnd().getMonthOfYear());
    assertEquals(18, app.getEnd().getDayOfMonth());
    assertEquals(2013, app.getEnd().getYear());
    assertEquals(12, app.getEnd().getHourOfDay());
    assertEquals(12, app.getEnd().getMinuteOfHour());
    assertEquals(0, app.getEnd().getSecondOfMinute());

    // Start time jumps past end time. End date +1.
    app.setPropertyValue("START_TIME", "13:13");
    assertEquals(2, app.getEnd().getMonthOfYear());
    assertEquals(19, app.getEnd().getDayOfMonth());
    assertEquals(2013, app.getEnd().getYear());
    assertEquals(12, app.getEnd().getHourOfDay());
    assertEquals(12, app.getEnd().getMinuteOfHour());
    assertEquals(0, app.getEnd().getSecondOfMinute());

    // End time set while start still null.
    app = new Appointment(null);
    assertNull(app.getStart());
    assertNull(app.getEnd());
    app.setPropertyValue("END_TIME", "12:12");
    assertEquals(1, app.getEnd().getMonthOfYear());
    assertEquals(1, app.getEnd().getDayOfMonth());
    assertEquals(1970, app.getEnd().getYear());
    assertEquals(12, app.getEnd().getHourOfDay());
    assertEquals(12, app.getEnd().getMinuteOfHour());
    assertEquals(0, app.getEnd().getSecondOfMinute());

    // Start Date set. End should follow.
    app.setStartDate(FormatText.USER_DATE.parse("02/18/2013"));
    assertEquals(2, app.getEnd().getMonthOfYear());
    assertEquals(18, app.getEnd().getDayOfMonth());
    assertEquals(2013, app.getEnd().getYear());
    assertEquals(12, app.getEnd().getHourOfDay());
    assertEquals(12, app.getEnd().getMinuteOfHour());
    assertEquals(0, app.getEnd().getSecondOfMinute());

    app.setPropertyValue("TIME_IN", "10:52");
    assertEquals(10, app.getTimeIn().getHourOfDay());
    assertEquals(52, app.getTimeIn().getMinuteOfHour());
  }