コード例 #1
0
  public void testHasHistory() throws Exception {
    PatientBean p = patientDAO.getPatient(2);

    assertFalse(patientDAO.hasHistory(p.getMID()));

    p.setFirstName("Person1");
    p.setEmail("another email");
    p.setEmergencyName("another emergency person");
    p.setTopicalNotes("some topical notes");
    p.setDateOfBirthStr("05/20/1984");
    patientDAO.editPatient(p, 9000000003L);

    assertTrue(patientDAO.hasHistory(p.getMID()));
  }
コード例 #2
0
  public void testGetPatientHistory() throws Exception {
    PatientBean p = patientDAO.getPatient(2);
    p.setFirstName("Person1");
    p.setEmail("another email");
    p.setEmergencyName("another emergency person");
    p.setTopicalNotes("some topical notes");
    p.setDateOfBirthStr("05/20/1984");
    patientDAO.editPatient(p, 9000000003L);

    List<PatientHistoryBean> pList = patientDAO.getPatientHistory(p.getMID());
    assertEquals(pList.size(), 1);
    assertEquals("Person1", pList.get(0).getFirstName());
    assertEquals(9000000003L, pList.get(0).getChangeMID());
  }
コード例 #3
0
  public void testEditPatient2() throws Exception {
    PatientBean p = patientDAO.getPatient(2);
    p.setFirstName("Person1");
    p.setEmail("another email");
    p.setEmergencyName("another emergency person");
    p.setTopicalNotes("some topical notes");
    p.setDateOfBirthStr("05/20/1984");
    p.setDateOfDeactivationStr("05/21/1984");
    patientDAO.editPatient(p, 9000000003L);

    p = patientDAO.getPatient(2);
    assertEquals("Person1", p.getFirstName());
    assertEquals("Programmer", p.getLastName());
    assertEquals("another email", p.getEmail());
    assertEquals("another emergency person", p.getEmergencyName());
    assertEquals("some topical notes", p.getTopicalNotes());
    assertEquals("05/20/1984", p.getDateOfBirthStr());
    assertEquals("05/21/1984", p.getDateOfDeactivationStr());
    assertEquals("250.10", p.getCauseOfDeath());
    assertEquals("344 Bob Street", p.getStreetAddress1());
    assertEquals("", p.getStreetAddress2());
    assertEquals("Raleigh", p.getCity());
    assertEquals("NC", p.getState());
    assertEquals("27607", p.getZip());
    assertEquals("555-555-5555", p.getPhone());
    assertEquals("555-555-5551", p.getEmergencyPhone());
    assertEquals("IC", p.getIcName());
    assertEquals("Street1", p.getIcAddress1());
    assertEquals("Street2", p.getIcAddress2());
    assertEquals("City", p.getIcCity());
    assertEquals("PA", p.getIcState());
    assertEquals("19003-2715", p.getIcZip());
    assertEquals("555-555-5555", p.getIcPhone());
    assertEquals("1", p.getIcID());
    assertEquals("1", p.getMotherMID());
    assertEquals("0", p.getFatherMID());
    assertEquals("O-", p.getBloodType().getName());
    assertEquals(Ethnicity.Caucasian, p.getEthnicity());
    assertEquals(Gender.Male, p.getGender());
  }
コード例 #4
0
  /**
   * Creates the patients and adds them to the DB
   *
   * @throws DBException
   * @throws AddPatientFileExceptionTest
   */
  private void createPatients() throws DBException, AddPatientFileException {
    for (int i = 0; i < CSVData.size(); i++) {
      PatientBean temp = new PatientBean();

      temp.setFirstName(
          CSVData.get(i)
              .get(requiredFieldsMapping[Arrays.asList(requiredFields).indexOf("firstName")]));
      temp.setLastName(
          CSVData.get(i)
              .get(requiredFieldsMapping[Arrays.asList(requiredFields).indexOf("lastName")]));
      temp.setEmail(
          CSVData.get(i)
              .get(requiredFieldsMapping[Arrays.asList(requiredFields).indexOf("email")]));

      try {
        temp.setStreetAddress1(
            CSVData.get(i)
                .get(validFieldsMapping[Arrays.asList(validFields).indexOf("streetAddress1")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setStreetAddress2(
            CSVData.get(i)
                .get(validFieldsMapping[Arrays.asList(validFields).indexOf("streetAddress2")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setCity(
            CSVData.get(i).get(validFieldsMapping[Arrays.asList(validFields).indexOf("city")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setState(
            CSVData.get(i).get(validFieldsMapping[Arrays.asList(validFields).indexOf("state")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setZip(
            CSVData.get(i).get(validFieldsMapping[Arrays.asList(validFields).indexOf("zip")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setPhone(
            CSVData.get(i).get(validFieldsMapping[Arrays.asList(validFields).indexOf("phone")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setMotherMID(
            CSVData.get(i)
                .get(validFieldsMapping[Arrays.asList(validFields).indexOf("motherMID")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setFatherMID(
            CSVData.get(i)
                .get(validFieldsMapping[Arrays.asList(validFields).indexOf("fatherMID")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setCreditCardType(
            CSVData.get(i)
                .get(validFieldsMapping[Arrays.asList(validFields).indexOf("creditCardType")]));
      } catch (NullPointerException e) {
      }
      try {
        temp.setCreditCardNumber(
            CSVData.get(i)
                .get(validFieldsMapping[Arrays.asList(validFields).indexOf("creditCardNumber")]));
      } catch (NullPointerException e) {
      }

      try {
        new AddPatientValidator().validate(temp);
        new PatientValidator().validate(temp);
        if (patientDAO != null) {
          long newMID = patientDAO.addEmptyPatient();
          temp.setMID(newMID);
          String pwd = authDAO.addUser(newMID, Role.PATIENT, RandomPassword.getRandomPassword());
          temp.setPassword(pwd);
          patientDAO.editPatient(temp, loggedInMID);
        }
        patients.add(temp);
      } catch (FormValidationException e) {
        for (int j = 0; j < e.getErrorList().size(); j++) {
          System.out.println(e.getErrorList().get(j));
        }
        errors.addIfNotNull(
            "Input validation failed for patient \""
                + temp.getFirstName()
                + " "
                + temp.getLastName()
                + "\"!");
      }
    }
  }