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"); }
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; }