コード例 #1
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public String buildAppointmentMessage(MessageDTO dto) throws Exception {
   Patient patient = appDAO.findPatientById(dto.getPatientId());
   decrypt(patient);
   String message = "Appointment Request from: ";
   message +=
       patient.getCred().getFirstName()
           + " "
           + patient.getCred().getMiddleName()
           + " "
           + patient.getCred().getLastName()
           + "\n";
   message += "Visit Reason: " + dto.getVisitReason() + "\n";
   Clinician clinician = appDAO.findClinicianById(dto.getClinicianId());
   String clinicianFullName =
       clinician.getFirstName()
           + " "
           + clinician.getMiddleName()
           + " "
           + clinician.getLastName()
           + "\n";
   message += "Wants to See: " + clinicianFullName + "\n";
   message += "Would See: " + dto.getWouldSee() + "\n";
   message += "Preferred Dates: " + dto.getApptFrom() + " - " + dto.getApptTo() + "\n";
   message += "Preferred Times: " + dto.getPreferredTimes() + "\n";
   activityLogService.logViewPatient(
       patient.getId(), null, patient.getId(), "BuildAppointmentMessage");
   return message;
 }
コード例 #2
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public boolean getPatientLetter(LetterDTO dto) throws Exception {
   Patient patient = appDAO.findPatientBySessionId(dto.getSessionId());
   PatientLetter patientLetter = appDAO.findPatientLetterById(dto.getId(), patient.getId());
   dto.setContent(patientLetter.getContent());
   activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "GetPatientLetter");
   return true;
 }
コード例 #3
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 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;
 }
コード例 #4
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public boolean getPatientMessage(MessageDTO dto) throws Exception {
   Patient patient = appDAO.findPatientBySessionId(dto.getSessionId());
   PatientMessage patientMessage = appDAO.findPatientMessageById(dto.getId());
   dto.setContent(patientMessage.getContent());
   dto.setFromClinician(patientMessage.getFromClinician());
   activityLogService.logViewPatient(
       patient.getId(), null, patient.getId(), "GetPatientMedicalTestComponents");
   return true;
 }
コード例 #5
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 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;
 }
コード例 #6
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 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;
 }
コード例 #7
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 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;
 }
コード例 #8
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 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;
 }
コード例 #9
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public Patient validateViaActivation(AuthorizedDTO authDTO, String ipAddress) throws Exception {
   Patient patient = appDAO.authenticatePatientViaActivationCode(authDTO.getActivationCode());
   if (patient.getCred().getAuthStatus() == Patient.STATUS_AUTHORIZED) {
     startPatientSession(patient, ipAddress, appDAO);
     decrypt(patient);
   }
   activityLogService.logViewPatient(
       patient.getId(), null, patient.getId(), "ValidateViaActivation");
   return patient;
 }
コード例 #10
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
  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);
  }
コード例 #11
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public void startPatientSession(Patient patient, String ipAddress, AppDAO appDAO)
     throws Exception {
   PatientSession patientSession = new PatientSession();
   patientSession.setPatient(patient);
   patientSession.setSessionId(patient.getCred().getSessionId());
   patientSession.setIpAddress(ipAddress);
   patientSession.setLastAccessTime(new Date());
   appDAO.create(patientSession);
   PatientSessionData patientSessionData = new PatientSessionData();
   patientSessionData.setPatientSession(patientSession);
   log.info("======= Added " + patientSession.toString());
   activityLogService.logViewPatient(
       patient.getId(), null, patient.getId(), "StartPatientSession");
 }
コード例 #12
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
  public boolean doPasswordReset(PasswordResetDTO passwordResetDTO) throws Exception {
    Patient patient = appDAO.findPatientByEmail(passwordResetDTO.getEmail());
    if (patient != null) {

      String newPassword = generatePassword();
      String newSalt = UUID.randomUUID().toString();
      String encodedPassword = OneWayPasswordEncoder.getInstance().encode(newPassword, newSalt);
      patient.getCred().setPassword(encodedPassword);
      patient.getCred().setSalt(newSalt);
      appDAO.update(patient.getCred());
      new MailHandler().sendPasswordReset(patient, newPassword);
    }
    activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "PasswordReset");
    return patient != null;
  }
コード例 #13
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public Patient validateFromOffice(AuthorizedDTO authDTO, String ipAddress) throws Exception {
   Patient patient = null;
   PatientSession patientSession = appDAO.findPatientSessionBySessionId(authDTO.getSessionId());
   if (patientSession != null) {
     patient = appDAO.findPatientBySessionId(authDTO.getSessionId());
     String newSessionId = UUID.randomUUID().toString();
     patient.getCred().setSessionId(newSessionId);
     appDAO.update(patient.getCred());
     patientSession.setSessionId(newSessionId);
     appDAO.update(patientSession);
     activityLogService.logViewPatient(
         patient.getId(), null, patient.getId(), "ValidateFromOffice");
     decrypt(patient);
   }
   return patient;
 }
コード例 #14
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
  public String uploadProfileImage(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String patientId = request.getParameter("patientId");
    InputStream is = null;
    FileOutputStream fos = null;
    String returnString = "";

    is = request.getInputStream();
    String filename = request.getHeader("X-File-Name");
    String filesHomePatientDirPath = Core.filesHome + Core.patientDirPath + "/" + patientId + "/";
    fos = new FileOutputStream(new File(filesHomePatientDirPath + filename));
    IOUtils.copy(is, fos);
    response.setStatus(HttpServletResponse.SC_OK);
    fos.close();
    is.close();

    String[] imageMagickArgs = {
      Core.imageMagickHome + "convert",
      filesHomePatientDirPath + filename,
      "-resize",
      "160x160",
      filesHomePatientDirPath + filename
    };
    Runtime runtime = Runtime.getRuntime();
    Process process = runtime.exec(imageMagickArgs);

    InputStream pis = process.getInputStream();
    InputStreamReader isr = new InputStreamReader(pis);
    BufferedReader br = new BufferedReader(isr);
    String line;
    log.info("Output of running " + Arrays.toString(imageMagickArgs) + "is: ");

    while ((line = br.readLine()) != null) {
      log.info(line);
    }
    log.info("\n" + filename + " uploaded");

    Patient patient = appDAO.findPatientById(new Integer(patientId));
    appDAO.updatePatientProfileImage(patient, filename);

    returnString = "{\"filename\":\"" + filename + "\"}";
    activityLogService.logViewPatient(patient.getId(), null, patient.getId(), "UploadProfileImage");
    return returnString;
  }
コード例 #15
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public boolean processMessage(MessageDTO dto, int messageTypeId) throws Exception {
   PatientMessage message = new PatientMessage();
   String content = dto.getContent();
   if (messageTypeId == PatientMessageType.APPT_REQUEST) {
     content = buildAppointmentMessage(dto);
     content +=
         "======================================\n" + "Patient Message: \n" + dto.getContent();
   }
   message.setContent(content);
   message.setDate(new Date());
   message.setSubject(dto.getSubject());
   message.setClinician(appDAO.findClinicianById(dto.getClinicianId()));
   message.setPatient(appDAO.findPatientById(dto.getPatientId()));
   message.setFromClinician(false);
   message.setPatientMessageType(appDAO.findPatientMessageTypeById(messageTypeId));
   appDAO.create(message);
   activityLogService.logViewPatient(
       dto.getPatientId(), null, dto.getPatientId(), "ProcessMessage");
   return true;
 }
コード例 #16
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 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);
 }
コード例 #17
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public List<PatientMedicalProcedure> getPatientMedicalProcedures(PatientDTO dto)
     throws Exception {
   Integer patientId = dto.getId();
   activityLogService.logViewPatient(patientId, null, patientId, "GetPatientMedicalProcedures");
   return appDAO.getPatientMedicalProcedures(patientId);
 }
コード例 #18
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public List<PatientHealthTrendReport> getPatientHealthTrendReports(PatientDTO dto)
     throws Exception {
   Integer patientId = dto.getId();
   activityLogService.logViewPatient(patientId, null, patientId, "GetPatientHealthTrendReports");
   return appDAO.getPatientHealthTrendReports(patientId);
 }
コード例 #19
0
ファイル: AppService.java プロジェクト: sayalimp912/portal
 public List<PatientImmunization> getPatientImmunizations(PatientDTO dto) throws Exception {
   Integer patientId = dto.getId();
   activityLogService.logViewPatient(patientId, null, patientId, "GetPatientImmunizations");
   return appDAO.getPatientImmunizations(patientId);
 }