Exemplo n.º 1
0
 @RequestMapping(method = RequestMethod.GET, value = "/update/{patientId}")
 public String update(@PathVariable("patientId") String patientId, Model uiModel) {
   Patient patient = patientService.findByPatientId(patientId);
   WeeklyAdherenceSummary adherenceSummary = adherenceService.currentWeekAdherence(patient);
   prepareModel(patient, uiModel, adherenceSummary);
   return "adherence/update";
 }
 @RequestMapping(value = "show", method = RequestMethod.GET)
 public String show(
     @RequestParam("patientId") String patientId, Model uiModel, HttpServletRequest request) {
   Patient patient = patientService.findByPatientId(patientId);
   treatmentUpdateOrchestrator.updateDoseInterruptions(patient);
   setupDashboardModel(uiModel, request, patient);
   return "patient/show";
 }
Exemplo n.º 3
0
  @Seed(priority = 3, version = "5.0")
  public void migrateAllPatients() {
    int pageNumber = 1;
    int pageSize = 10;

    List<Patient> patientList;
    do {
      patientList = patientService.getAll(pageNumber, pageSize);
      migratePatients(patientList);
      pageNumber++;
    } while (!patientList.isEmpty());
  }
 public AdherenceValidationResponse validate(
     AdherenceValidationRequest request, ProviderId providerId) {
   Patient patient = patientService.findByPatientId(request.getPatientId());
   AdherenceErrors errors =
       adherenceRequestValidator.validatePatientProviderMapping(providerId, patient);
   Dosage dosage = adherenceService.dosageForPatient(patient);
   if (errors.isNotEmpty()) {
     return new AdherenceValidationResponse(dosage).failure(errors.errorMessage());
   } else if (isValidDose(request, dosage)) {
     return new AdherenceValidationResponse(dosage).success();
   } else {
     return new AdherenceValidationResponse(dosage).invalidAdherenceRange();
   }
 }
  private void setupDashboardModel(Model uiModel, HttpServletRequest request, Patient patient) {
    PhaseStartDates phaseStartDates = new PhaseStartDates(patient);
    Treatment currentTreatment = patient.getCurrentTherapy().getCurrentTreatment();
    Provider provider = providerService.findByProviderId(currentTreatment.getProviderId());

    uiModel.addAttribute("patient", patientInfoMapper.map(patient, provider));
    uiModel.addAttribute("phaseStartDates", phaseStartDates);
    uiModel.addAttribute("today", WHPDate.date(today()).value());
    uiModel.addAttribute("cmfAdminRemarks", patientService.getCmfAdminRemarks(patient));
    uiModel.addAttribute("providerRemarks", providerRemarksService.getRemarks(patient));

    String messages = in(WHPConstants.NOTIFICATION_MESSAGE, request);
    if (isNotEmpty(messages)) {
      uiModel.addAttribute(WHPConstants.NOTIFICATION_MESSAGE, messages);
    }
  }
  @Test
  public void shouldCreatePatientAlertSchedulesForActivePatients() {
    PatientAlertScheduleSeed patientAlertScheduleSeed =
        new PatientAlertScheduleSeed(patientAlertScheduler, patientService);

    List<String> expectedPatientIds = asList("patient1", "patient2");
    when(patientService.getAllActivePatientIds()).thenReturn(expectedPatientIds);

    patientAlertScheduleSeed.scheduleActivePatients();

    ArgumentCaptor<String> patientIdCaptor = ArgumentCaptor.forClass(String.class);
    verify(patientAlertScheduler, times(2)).scheduleJob(patientIdCaptor.capture());
    List<String> scheduledPatientIds = patientIdCaptor.getAllValues();

    assertEquals(expectedPatientIds, scheduledPatientIds);
    verify(patientService).getAllActivePatientIds();
  }
Exemplo n.º 7
0
 private void migratePatients(List<Patient> patientList) {
   for (Patient patient : patientList) {
     patientService.update(patient);
   }
 }