Package org.raxa.module.raxacore

Examples of org.raxa.module.raxacore.PatientList


  /**
   * Test of updatePatientList method, of class PatientListServiceImpl.
   */
  @Test
  public void testUpdatePatientListShouldChangePatientList() {
    PatientList patientList = s.getPatientList(1);
    patientList.setName("NewNameList");
    s.updatePatientList(patientList);
    String name = s.getPatientList(1).getName();
    assertEquals(name, "NewNameList");
  }
View Full Code Here


   * Test of deletePatientList method, of class PatientListServiceImpl.
   */
  @Test
  public void testDeletePatientListShouldUsePrivileges() {
    Context.getUserContext().getAuthenticatedUser().removeRole(Context.getUserService().getRole("System Developer"));
    PatientList pList = new PatientList();
    pList.setId(2);
    pList.setName("TestList2");
    pList.setDescription("Second Test List");
    pList.setCreator(Context.getUserContext().getAuthenticatedUser());
    pList.setDateCreated(new java.util.Date());
    pList.setUuid("68547121-1b70-465e-99ee-c9dfd95e7d30");
    pList.setRetired(Boolean.FALSE);
    pList.setSearchQuery("");
    try {
      s.deletePatientList(pList);
      //if we don't throw exception fail - no privileges required!
      fail("No privileges required for deletePatientList");
    }
View Full Code Here

  @WSDoc("Gets Patients Without Saving the Patient list")
  @ResponseBody()
  public String getPatientsInPatientList(@RequestParam Map<String, String> params, HttpServletRequest request)
          throws ResponseException {
    initPatientListController();
    PatientList patientList = new PatientList();
    patientList.setSearchQuery("?" + Joiner.on("&").withKeyValueSeparator("=").join(params));
    SimpleObject obj = new SimpleObject();
    obj.add("uuid", patientList.getUuid());
    obj.add("name", patientList.getName());
    obj.add("description", patientList.getDescription());
    obj.add("searchQuery", patientList.getSearchQuery());
    ArrayList patients = new ArrayList();
    List<Patient> patientsInPatientList = service.getPatientsInPatientList(patientList);
    for (Patient p : patientsInPatientList) {
      SimpleObject patient = new SimpleObject();
      patient.add("uuid", p.getUuid());
View Full Code Here

  /**
   * Test of deletePatientList method, of class PatientListServiceImpl.
   */
  @Test
  public void testDeletePatientListShouldDeletePatientList() {
    PatientList pList = new PatientList();
    pList.setId(2);
    pList.setName("TestList2");
    pList.setDescription("Second Test List");
    pList.setCreator(Context.getUserContext().getAuthenticatedUser());
    pList.setDateCreated(new java.util.Date());
    pList.setUuid("68547121-1b70-465e-99ee-c9dfd95e7d30");
    pList.setRetired(Boolean.FALSE);
    pList.setSearchQuery("");
    s.deletePatientList(pList);
    PatientList result = s.getPatientList(2);
    assertEquals(null, result);
  }
View Full Code Here

      notInListQuery += "&location=" + params.get("location");
    }
    if (params.get("containsOrderType") != null) {
      notInListQuery += "&containsOrderType=" + params.get("containsOrderType");
    }
    PatientList inList = new PatientList();
    inList.setSearchQuery(inListQuery);
    inList = service.savePatientList(inList);
   
    PatientList notInList = new PatientList();
    notInList.setSearchQuery(notInListQuery);
    notInList = service.savePatientList(notInList);
   
    String finalQuery = ("?encounterType=" + params.get("encounterType") + "&inList=" + inList.getUuid() + "&notInList=" + notInList
            .getUuid());
   
    PatientList patientList = new PatientList();
    patientList.setSearchQuery(finalQuery);
    SimpleObject obj = new SimpleObject();
    obj.add("uuid", patientList.getUuid());
    obj.add("name", patientList.getName());
    obj.add("description", patientList.getDescription());
    obj.add("searchQuery", patientList.getSearchQuery());
    ArrayList patients = new ArrayList();
    List<Patient> patientsInPatientList = service.getPatientsInPatientList(patientList);
    List<Encounter> encountersInPatientList = service.getEncountersInPatientList(patientList);
   
    for (Patient p : patientsInPatientList) {
View Full Code Here

  @ResponseBody
  public Object retirePatientList(@PathVariable("uuid") String uuid,
          @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request,
          HttpServletResponse response) throws ResponseException {
    initPatientListController();
    PatientList patientList = service.getPatientListByUuid(uuid);
    if (patientList != null) {
      patientList.setRetired(true);
      patientList.setRetireReason(reason);
      patientList.setRetiredBy(Context.getAuthenticatedUser());
      service.updatePatientList(patientList);
    }
    return RestUtil.noContent(response);
  }
View Full Code Here

  @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "purge")
  @ResponseBody
  public Object purgePatientList(@PathVariable("uuid") String uuid, HttpServletRequest request,
          HttpServletResponse response) throws ResponseException {
    initPatientListController();
    PatientList patientList = service.getPatientListByUuid(uuid);
    if (patientList != null) {
      service.deletePatientList(patientList);
    }
    return RestUtil.noContent(response);
  }
View Full Code Here

  /**
   * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate()
   */
  @Override
  public PatientList newDelegate() {
    return new PatientList();
  }
View Full Code Here

  /**
   * Test of savePatientList method, of class HibernatePatientListDAO.
   */
  @Test
  public void testSavePatientList() {
    PatientList pList = new PatientList();
    //NOTE: never set Id, will be generated automatically (when saving)
    pList.setName("TestList3");
    pList.setDescription("Third Test List");
    pList.setCreator(Context.getUserContext().getAuthenticatedUser());
    pList.setDateCreated(new java.util.Date());
    pList.setUuid("68547121-1b70-465c-99ee-c9dfd95e7d30");
    pList.setRetired(Boolean.FALSE);
    pList.setSearchQuery("test Query");
    dao.savePatientList(pList);
    List<PatientList> result = dao.getPatientListByName("TestList3");
    String name = result.get(0).getName();
    assertEquals(name, "TestList3");
  }
View Full Code Here

  /**
   * Test of deletePatientList method, of class HibernatePatientListDAO.
   */
  @Test
  public void testDeletePatientList() {
    PatientList pList = new PatientList();
    pList.setId(2);
    pList.setName("TestList2");
    pList.setDescription("Second Test List");
    pList.setCreator(Context.getUserContext().getAuthenticatedUser());
    pList.setDateCreated(new java.util.Date());
    pList.setUuid("68547121-1b70-465e-99ee-c9dfd95e7d30");
    pList.setRetired(Boolean.FALSE);
    pList.setSearchQuery("");
    dao.deletePatientList(pList);
    PatientList result = dao.getPatientList(2);
    assertEquals(null, result);
  }
View Full Code Here

TOP

Related Classes of org.raxa.module.raxacore.PatientList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.