/**
   * Get new obs corresponding to given radiologyOrder
   *
   * @param radiologyOrder radiology order for which the obs should be returned
   * @return model and view populated with a new obs
   * @should populate model and view with new obs given a valid radiology order
   */
  @RequestMapping(value = "/module/radiology/radiologyObs.form", method = RequestMethod.GET)
  protected ModelAndView getNewObs(
      @RequestParam(value = "orderId", required = true) RadiologyOrder radiologyOrder) {

    Obs obs = new Obs();
    obs.setOrder(radiologyOrder);
    obs.setPerson(radiologyOrder.getPatient());
    obs.setEncounter(radiologyOrder.getEncounter());
    return populateModelAndView(radiologyOrder, obs);
  }
 static Obs orderUuidToObs(
     String orderUuid, Patient patient, Date encounterTime, Location location) {
   Order order = Context.getOrderService().getOrderByUuid(orderUuid);
   if (order == null) {
     log.warn("Order not found: " + orderUuid);
     return null;
   }
   Obs obs = new Obs(patient, DbUtil.getOrderExecutedConcept(), encounterTime, location);
   obs.setOrder(order);
   obs.setValueNumeric(1d);
   return obs;
 }
  @Before
  public void runBeforeAllTests() {

    mockPatient = RadiologyTestData.getMockPatient1();
    mockStudy = RadiologyTestData.getMockStudy1PostSave();
    mockRadiologyOrder = RadiologyTestData.getMockRadiologyOrder1();
    mockRadiologyOrder.setStudy(mockStudy);
    mockRadiologyOrder.setPatient(mockPatient);
    mockRequest = new MockHttpServletRequest();
    mockObs = RadiologyTestData.getMockObs();
    mockObs.setPatient(mockPatient);
    mockObs.setOrder(mockRadiologyOrder);
    mockReadingPhysician = RadiologyTestData.getMockRadiologyReadingPhysician();
    mockRadiologyScheduler = RadiologyTestData.getMockRadiologyScheduler();

    obsErrors = mock(BindingResult.class);
  }
Exemple #4
0
  /**
   * This is an equivalent to a copy constructor. Creates a new copy of the given <code>obsToCopy
   * </code> with a null obs id
   *
   * @param obsToCopy The Obs that is going to be copied
   * @return a new Obs object with all the same attributes as the given obs
   */
  public static Obs newInstance(Obs obsToCopy) {
    Obs newObs =
        new Obs(
            obsToCopy.getPerson(),
            obsToCopy.getConcept(),
            obsToCopy.getObsDatetime(),
            obsToCopy.getLocation());

    newObs.setObsGroup(obsToCopy.getObsGroup());
    newObs.setAccessionNumber(obsToCopy.getAccessionNumber());
    newObs.setValueCoded(obsToCopy.getValueCoded());
    newObs.setValueDrug(obsToCopy.getValueDrug());
    newObs.setValueGroupId(obsToCopy.getValueGroupId());
    newObs.setValueDatetime(obsToCopy.getValueDatetime());
    newObs.setValueNumeric(obsToCopy.getValueNumeric());
    newObs.setValueModifier(obsToCopy.getValueModifier());
    newObs.setValueText(obsToCopy.getValueText());
    newObs.setComment(obsToCopy.getComment());
    newObs.setOrder(obsToCopy.getOrder());
    newObs.setEncounter(obsToCopy.getEncounter());
    newObs.setDateStarted(obsToCopy.getDateStarted());
    newObs.setDateStopped(obsToCopy.getDateStopped());
    newObs.setCreator(obsToCopy.getCreator());
    newObs.setDateCreated(obsToCopy.getDateCreated());
    newObs.setVoided(obsToCopy.getVoided());
    newObs.setVoidedBy(obsToCopy.getVoidedBy());
    newObs.setDateVoided(obsToCopy.getDateVoided());
    newObs.setVoidReason(obsToCopy.getVoidReason());

    newObs.setValueComplex(obsToCopy.getValueComplex());
    newObs.setComplexData(obsToCopy.getComplexData());

    if (obsToCopy.getGroupMembers() != null)
      for (Obs member : obsToCopy.getGroupMembers()) {
        // if the obs hasn't been saved yet, no need to duplicate it
        if (member.getObsId() == null) newObs.addGroupMember(member);
        else newObs.addGroupMember(Obs.newInstance(member));
      }

    return newObs;
  }