/**
   * Sends an e-mail informing the patient that their procedure has been updated
   *
   * @param b the procedure that was updated
   * @return an e-mail to the patient with the notice
   * @throws DBException
   */
  private Email makeEmail(LabProcedureBean b) throws DBException {

    PatientBean p = new PatientDAO(factory).getPatient(b.getPid());

    Email email = new Email();
    email.setFrom("*****@*****.**");
    email.setToList(Arrays.asList(p.getEmail()));
    email.setSubject("A Lab Procedure Was Updated");
    email.setBody(
        String.format(
            "Dear %s, \n Your Lab Procedure (%s) has a new updated status of %s. Log on to iTrust to view.",
            p.getFullName(), b.getLoinc(), b.getStatus()));
    return email;
  }
  /**
   * Creates and e-mail to inform the patient that their information has been updated.
   *
   * @return the email with the notice
   * @throws DBException
   */
  private Email makeEmail() throws DBException {

    Email email = new Email();
    List<PatientBean> reps = patientDAO.getRepresenting(pid);
    PatientBean pb = patientDAO.getPatient(pid);

    List<String> toAddrs = new ArrayList<String>();
    toAddrs.add(pb.getEmail());
    for (PatientBean r : reps) {
      toAddrs.add(r.getEmail());
    }

    email.setFrom("*****@*****.**");
    email.setToList(toAddrs); // patient and personal representative
    email.setSubject(String.format("Patient Information Updated"));
    email.setBody(
        "Dear "
            + pb.getFullName()
            + ",\n\tYour patient record information has been updated. "
            + "Please login to iTrust to see who has viewed your records.");
    return email;
  }