@Override
  public String execute() throws Exception {
    Program program = programService.getProgram(programId);

    Collection<OrganisationUnit> orgunits = selectionTreeManager.getRootOrganisationUnits();

    program = programService.getProgram(programId);

    // ---------------------------------------------------------------------
    // Get orgunitIds
    // ---------------------------------------------------------------------

    Collection<Integer> orgunitIds = new HashSet<>();

    for (OrganisationUnit orgunit : orgunits) {
      if (facilityLB.equals("selected")) {
        orgunitIds.add(orgunit.getId());
      } else if (facilityLB.equals("childrenOnly")) {
        orgunitIds.addAll(
            organisationUnitService.getOrganisationUnitHierarchy().getChildren(orgunit.getId()));
        orgunitIds.remove(orgunit.getId());
      } else {
        orgunitIds.addAll(
            organisationUnitService.getOrganisationUnitHierarchy().getChildren(orgunit.getId()));
      }
    }

    if (orgunitIds.size() > 0) {
      grid =
          programStageInstanceService.getCompletenessProgramStageInstance(
              orgunitIds, program, startDate, endDate, i18n);
    }

    return (type == null) ? SUCCESS : type;
  }
예제 #2
0
  @Override
  public String execute() throws Exception {
    List<OutboundSms> tempListOutboundSMS = outboundSmsService.getAllOutboundSms();

    listOutboundSMS = new ArrayList<OutboundSms>();

    if (filterStatusType != null && filterStatusType == 0) {
      for (OutboundSms each : tempListOutboundSMS) {
        if (each.getStatus().equals(OutboundSmsStatus.OUTBOUND)) {
          this.listOutboundSMS.add(each);
        }
      }
    }
    if (filterStatusType != null && filterStatusType == 1) {
      for (OutboundSms each : tempListOutboundSMS) {
        if (each.getStatus().equals(OutboundSmsStatus.SENT)) {
          this.listOutboundSMS.add(each);
        }
      }
    }
    if (filterStatusType != null && filterStatusType == 2 || filterStatusType == null) {
      for (OutboundSms each : tempListOutboundSMS) {
        this.listOutboundSMS.add(each);
      }
    }
    schedulingProgramObjects = programStageInstanceService.getSendMesssageEvents();
    return SUCCESS;
  }
  @Override
  public String execute() throws Exception {
    DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
    ProgramInstance programInstance = programInstanceService.getProgramInstance(programInstanceId);
    ProgramStage programStage = programStageService.getProgramStage(programStageId);

    patientId = programInstance.getPatient().getId();
    programId = programInstance.getProgram().getId();

    ProgramStageInstance programStageInstance = new ProgramStageInstance();
    try {
      programStageInstance.setDueDate(sdf.parseDateTime(nextDueDate).toDate());
    } catch (Exception e) {
      e.printStackTrace();
    }

    programStageInstance.setProgramInstance(programInstance);
    programStageInstance.setProgramStage(programStage);
    programStageInstanceService.addProgramStageInstance(programStageInstance);

    return SUCCESS;
  }