Ejemplo n.º 1
0
 public void createPassword(PatientDTO dto) throws Exception {
   Patient patient = appDAO.findPatientById(dto.getId());
   String newSalt = UUID.randomUUID().toString();
   String encodedPassword = OneWayPasswordEncoder.getInstance().encode(dto.getPassword(), newSalt);
   patient.getCred().setPassword(encodedPassword);
   appDAO.update(patient.getCred());
 }
Ejemplo n.º 2
0
 public boolean getPatientMedicalTestComponents(PatientDTO dto) throws Exception {
   List<PatientMedicalTestComponent> patientMedicalTestComponents =
       appDAO.findPatientMedicalTestComponentByTestId(dto.getPatientMedicalTestId());
   dto.setPatientMedicalTestComponents(patientMedicalTestComponents);
   activityLogService.logViewPatient(
       dto.getId(), null, dto.getId(), "GetPatientMedicalTestComponents");
   return true;
 }
Ejemplo n.º 3
0
  public void saveNewPatient(PatientDTO dto, HttpServletRequest request) throws Exception {
    Patient patient = dto.getPatient();

    if (dto.isUpdatePassword()) {
      if (testPassword(patient.getCred().getPassword()) == false) {
        dto.setResult(false);
        dto.setErrorMsg("Insufficient Password");
        dto.setReturnCode(RETURN_CODE_INVALID_PASSWORD);
        return;
      }
      String salt = UUID.randomUUID().toString();
      patient.getCred().setSalt(salt);
      String encodedPassword =
          OneWayPasswordEncoder.getInstance().encode(patient.getCred().getPassword(), salt);
      patient.getCred().setPassword(encodedPassword);
    }

    if (dto.isUpdateEmail()) {
      if (appDAO.checkEmail(DataEncryptor.encrypt(patient.getCred().getEmail())) == false) {
        dto.setResult(false);
        dto.setErrorMsg("Email already in system");
        dto.setReturnCode(RETURN_CODE_DUP_EMAIL);
        return;
      }
    }

    Demographics demo = patient.getDemo();
    demo.setEthnicity(appDAO.findEthnicityById(demo.getEthnicity().getId()));
    demo.setMaritalStatus(appDAO.findMaritalStatusById(demo.getMaritalStatus().getId()));
    if (demo.getUsState() != null) {
      demo.setUsState(appDAO.findUSStateById(demo.getUsState().getId()));
    }
    demo.setRace(appDAO.findRaceById(demo.getRace().getId()));
    appDAO.update(patient);
    decrypt(patient);
    String patientFullName =
        patient.getCred().getFirstName() + " " + patient.getCred().getLastName();
    String title = patientFullName + ", welcome to the Pleasantville Medical Patient Portal";
    String templatePath = context.getRealPath("/WEB-INF/email_templates");
    StringTemplateGroup group =
        new StringTemplateGroup("underwebinf", templatePath, DefaultTemplateLexer.class);
    StringTemplate st = group.getInstanceOf("portal_signup_confirmation");
    String from = Core.mailFrom;
    st.setAttribute("patient", patientFullName);
    st.setAttribute("email", patient.getCred().getEmail());
    st.setAttribute("phone", patient.getDemo().getPrimaryPhone());

    MailHandler handler = new MailHandler();
    boolean isHtml = true;
    String stString = st.toString();
    activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "SaveNewPatient");
    handler.sendMimeMessage(patient.getCred().getEmail(), from, stString, title, isHtml);
  }
Ejemplo n.º 4
0
 public List<PatientLetter> getPatientLetters(PatientDTO dto) throws Exception {
   Patient patient = appDAO.findPatientById(dto.getId());
   activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "GetPatientLetters");
   List<PatientLetter> letters = appDAO.getPatientLetters(patient);
   for (PatientLetter pl : letters) {
     decrypt(pl.getPatient());
   }
   return letters;
 }
Ejemplo n.º 5
0
 public List<Appointment> getAppointments(PatientDTO dto, boolean isPast) throws Exception {
   Patient patient = appDAO.findPatientById(dto.getId());
   activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "GetAppointments");
   List<Appointment> appointments = appDAO.getAppointments(patient, isPast);
   for (Appointment a : appointments) {
     decrypt(a.getPatient());
   }
   return appointments;
 }
Ejemplo n.º 6
0
 public List<PatientClinician> getPatientClinicians(PatientDTO dto) throws Exception {
   Patient patient = appDAO.findPatientById(dto.getId());
   activityLogService.logViewPatient(
       patient.getId(), null, patient.getId(), "GetPatientClinicians");
   List<PatientClinician> patientClinicians = appDAO.getPatientClinicians(patient);
   for (PatientClinician patientClinician : patientClinicians) {
     ExcludedObjects.excludeObjects(patientClinician.getPatient());
   }
   return patientClinicians;
 }
Ejemplo n.º 7
0
 public List<PatientMessage> getPatientMessages(PatientDTO dto, Boolean fromClinician)
     throws Exception {
   Patient patient = appDAO.findPatientById(dto.getId());
   activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "GetPatientMessages");
   List<PatientMessage> messages = appDAO.getPatientMessages(patient, fromClinician);
   for (PatientMessage pm : messages) {
     decrypt(pm.getPatient());
   }
   return messages;
 }
Ejemplo n.º 8
0
 public List<PatientHealthTrendReport> getPatientHealthTrendReports(PatientDTO dto)
     throws Exception {
   Integer patientId = dto.getId();
   activityLogService.logViewPatient(patientId, null, patientId, "GetPatientHealthTrendReports");
   return appDAO.getPatientHealthTrendReports(patientId);
 }
Ejemplo n.º 9
0
 public List<PatientMedicalProcedure> getPatientMedicalProcedures(PatientDTO dto)
     throws Exception {
   Integer patientId = dto.getId();
   activityLogService.logViewPatient(patientId, null, patientId, "GetPatientMedicalProcedures");
   return appDAO.getPatientMedicalProcedures(patientId);
 }
Ejemplo n.º 10
0
 public List<PatientImmunization> getPatientImmunizations(PatientDTO dto) throws Exception {
   Integer patientId = dto.getId();
   activityLogService.logViewPatient(patientId, null, patientId, "GetPatientImmunizations");
   return appDAO.getPatientImmunizations(patientId);
 }
Ejemplo n.º 11
0
 public List<PatientAllergen> getPatientAllergens(PatientDTO dto) throws Exception {
   Patient patient = appDAO.findPatientById(dto.getId());
   activityLogService.logViewPatient(
       patient.getId(), null, patient.getId(), "GetPatientAllergens");
   return appDAO.getPatientAllergens(patient);
 }