コード例 #1
0
  public void controller(
      @FragmentParam("patient") Patient patient,
      FragmentModel model,
      UiUtils ui,
      @SpringBean CoreContext emr) {

    String[] page1FormUuids = {Metadata.FAMILY_HISTORY_FORM, Metadata.HIV_PROGRAM_ENROLLMENT_FORM};

    List<SimpleObject> page1AvailableForms = new ArrayList<SimpleObject>();
    List<Encounter> page1Encounters = new ArrayList<Encounter>();

    for (String page1FormUuid : page1FormUuids) {
      Form page1Form = MetadataUtils.getForm(page1FormUuid);
      List<Encounter> formEncounters = getPatientEncounterByForm(patient, page1Form);

      if (formEncounters.size() == 0) {
        page1AvailableForms.add(ui.simplifyObject(page1Form));
      } else {
        page1Encounters.addAll(formEncounters);
      }
    }

    Form moh257VisitForm = MetadataUtils.getForm(Metadata.MOH_257_VISIT_SUMMARY_FORM);
    List<Encounter> moh257VisitSummaryEncounters =
        getPatientEncounterByForm(patient, moh257VisitForm);

    model.addAttribute("page1AvailableForms", page1AvailableForms);
    model.addAttribute("page1Encounters", page1Encounters);
    model.addAttribute("page2Form", moh257VisitForm);
    model.addAttribute("page2Encounters", moh257VisitSummaryEncounters);

    Concept masterSet = emr.getRegimenManager().getMasterSetConcept("ARV");
    RegimenChangeHistory arvHistory = RegimenChangeHistory.forPatient(patient, masterSet);
    model.addAttribute("arvHistory", arvHistory);
  }
コード例 #2
0
  /** Validate patient records */
  @AppAction(EmrConstants.APP_DEVELOPER)
  public List<SimpleObject> validatePatients(UiUtils ui) {
    List<SimpleObject> problems = new ArrayList<SimpleObject>();

    for (Patient patient : Context.getPatientService().getAllPatients()) {
      BindException errors = new BindException(patient, "");
      Context.getAdministrationService().validate(patient, errors);

      if (errors.hasErrors()) {
        SimpleObject problem = new SimpleObject();
        problem.put("patient", ui.simplifyObject(patient));
        problem.put("errors", uniqueErrorMessages(errors));
        problem.put("cause", errors.getCause());
        problems.add(problem);
      }
    }

    return problems;
  }
  public void controller(
      FragmentModel model,
      @FragmentParam("visit") Visit visit,
      UiUtils ui,
      PageRequest request,
      @SpringBean CoreContext emr,
      @SpringBean KenyaUiUtils kenyaUi) {

    AppDescriptor currentApp = kenyaUi.getCurrentApp(request);

    List<SimpleObject> availableForms = new ArrayList<SimpleObject>();

    for (FormDescriptor descriptor :
        emr.getFormManager().getUncompletedFormsForVisit(currentApp, visit)) {
      availableForms.add(ui.simplifyObject(descriptor.getTarget()));
    }

    model.addAttribute("availableForms", availableForms);
  }