Package org.openmrs

Examples of org.openmrs.Provider


   * @param context
   * @return
   * @throws ResponseException
   */
  public SimpleObject getRaxaAlertsByProvider(String providerUniqueId, RequestContext context) throws ResponseException {
    Provider provider = Context.getProviderService().getProviderByUuid(providerUniqueId);
    if (provider == null) {
      throw new ObjectNotFoundException();
    }
    List<RaxaAlert> raxaAlerts = Context.getService(RaxaAlertService.class).getRaxaAlertByProviderRecipientId(
        provider.getId(), false);
    return new NeedsPaging<RaxaAlert>(raxaAlerts, context).toSimpleObject();
  }
View Full Code Here


      identifier = "" + (int) (Math.random() * 100000);
      if (Context.getProviderService().getProviderByIdentifier(identifier) == null) {
        identifierInUse = false;
      }
    }
    Provider provider = new Provider();
    provider.setPerson(person);
    provider.setIdentifier(identifier);
    if (post.get("isOutpatientDoctor") == null && post.get("isOutpatientDoctor").equals("true")) {
      //Provider service does not allow us to get the provider attribute by name currently, so have to get all....
      Iterator<ProviderAttributeType> iter = Context.getProviderService().getAllProviderAttributeTypes().iterator();
      while (iter.hasNext()) {
        ProviderAttributeType pAttribType = iter.next();
        if (pAttribType.getName().equals("isOutpatientDoctor")) {
          ProviderAttribute pAttrib = new ProviderAttribute();
          pAttrib.setValue(true);
          pAttrib.setAttributeType(pAttribType);
          provider.addAttribute(pAttrib);
          break;
        }
      }
    }
    Context.getPersonService().savePerson(person);
View Full Code Here

   * @param post our REST call
   * @return the changed raxa alert
   */
  private RaxaAlert setPostFields(RaxaAlert raxaAlert, SimpleObject post) {
    if (post.get("providerRecipient") != null) {
      Provider pRecipient = Context.getProviderService().getProviderByUuid(post.get("providerRecipient").toString());
      raxaAlert.setProviderRecipientId(pRecipient.getId());
      raxaAlert.setProviderRecipient(pRecipient);
    }
    if (post.get("providerSent") != null) {
      Provider pSender = Context.getProviderService().getProviderByUuid(post.get("providerSent").toString());
      raxaAlert.setProviderSentId(pSender.getId());
      raxaAlert.setProviderSent(pSender);
    }
    if (post.get("toLocation") != null) {
      Location toLocation = Context.getLocationService().getLocationByUuid(post.get("toLocation").toString());
      raxaAlert.setToLocationId(toLocation.getId());
View Full Code Here

    SimpleObject obj = new SimpleObject();
    obj.add("uuid", rAlert.getUuid());
    obj.add("name", rAlert.getName());
    obj.add("description", rAlert.getDescription());
    SimpleObject pRecipientObj = new SimpleObject();
    Provider pRecipient = rAlert.getProviderRecipient();
    if (pRecipient != null) {
      pRecipientObj.add("uuid", pRecipient.getUuid());
      pRecipientObj.add("display", pRecipient.getName());
    }
    obj.add("providerRecipient", pRecipientObj);
    SimpleObject pSentObj = new SimpleObject();
    Provider pSent = rAlert.getProviderSent();
    if (pSent != null) {
      pSentObj.add("uuid", pSent.getUuid());
      pSentObj.add("display", pSent.getName());
    }
    obj.add("providerSent", pSentObj);
    SimpleObject toLocationObj = new SimpleObject();
    Location toLocation = rAlert.getToLocation();
    if (toLocation != null) {
View Full Code Here

    String json = "{\"firstName\":\"Darth\",\"lastName\":\"Vader\",\"gender\":\"M\",\"userName\":\"johnJames\",\"password\":\"Hello123\",\"type\":\"provider\",\"location\":\"dc5c1fcc-0459-4201-bf70-0b90535ba362\"} }";
    SimpleObject post = new ObjectMapper().readValue(json, SimpleObject.class);
    Object user = controller.createNewUser(post, request, response);
    System.out.println(user);
    User u = Context.getUserService().getUserByUsername("johnJames");
    Provider p = Context.getProviderService().getProviders("Darth Vader", null, null, null).iterator().next();
    Assert.assertEquals("Darth Vader", p.getName());
    Assert.assertEquals("1", u.getPerson().getAttribute("Health Center").getValue());
  }
View Full Code Here

    dao.deleteRaxaAlert(raxaAlert);
  }
 
  @Override
  public List<RaxaAlert> getRaxaAlertByProviderSentUuid(String providerSentUuid, boolean includeSeen) {
    Provider p = Context.getProviderService().getProviderByUuid(providerSentUuid);
    if (p == null) {
      return new ArrayList<RaxaAlert>();
    }
    return dao.getRaxaAlertByProviderSentId(p.getId(), includeSeen);
  }
View Full Code Here

    }
    //"?encounterType=<uuid>&startDate=2012-05-07&endDate=2012-05-08&inlist=<uuidForList>&notinlist=<uuidForList>"
    EncounterType encType = null;
    Date startDate = null;
    Date endDate = null;
    Provider provid = null;
    Patient patient = null;
    String uuid = null;
    //the return value can only choose encounters from this list (if not null)
    List<Encounter> inListEncounters = null;
    //the return value can not contain any patients from this list
View Full Code Here

    }
    if (post.get("roomLocation") != null) {
      drugInventory.setRoomLocation(post.get("roomLocation").toString());
    }
    if (post.get("provider") != null) {
      Provider p = Context.getProviderService().getProviderByUuid(post.get("provider").toString());
      drugInventory.setProviderId(p.getId());
      drugInventory.setProvider(p);
    }
    if (post.get("location") != null) {
      Location l = Context.getLocationService().getLocationByUuid(post.get("location").toString());
      drugInventory.setLocationId(l.getId());
View Full Code Here

    obj.add("supplier", di.getSupplier());
    obj.add("value", di.getValue());
    obj.add("status", di.getStatus());
    obj.add("roomLocation", di.getRoomLocation());
    SimpleObject pObj = new SimpleObject();
    Provider p = di.getProvider();
    if (p != null) {
      pObj.add("uuid", p.getUuid());
      pObj.add("display", p.getName());
    }
    obj.add("provider", pObj);
    SimpleObject lObj = new SimpleObject();
    Location l = di.getLocation();
    if (l != null) {
View Full Code Here

  public String getLoginInfo(HttpServletRequest request, HttpServletResponse response) throws ResponseException {
    SimpleObject obj = new SimpleObject();
    if (Context.isAuthenticated()) {
      User u = Context.getAuthenticatedUser();
      Person p = Context.getPersonService().getPersonByUuid(u.getPerson().getUuid());
      Provider provider = Context.getProviderService().getProvidersByPerson(p).iterator().next();
      obj.add("personUuid", p.getUuid());
      if (provider != null) {
        obj.add("providerUuid", provider.getUuid());
        ArrayList attributesObj = new ArrayList();
        Iterator<ProviderAttribute> attributesIterator = provider.getActiveAttributes().iterator();
        while (attributesIterator.hasNext()) {
          SimpleObject attributeObj = new SimpleObject();
          ProviderAttribute pAttribute = attributesIterator.next();
          attributeObj.add("attributeType", pAttribute.getAttributeType().getName());
          attributeObj.add("value", pAttribute.getValue());
View Full Code Here

TOP

Related Classes of org.openmrs.Provider

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.