/**
   * Get dicom viewer URL for given study and patient
   *
   * @param study study for the dicom viewer url
   * @param patient patient for the dicom viewer url
   * @should return dicom viewer url given completed study and patient
   * @should return null given non completed study and patient
   */
  private String getDicomViewerUrl(Study study, Patient patient) {

    if (study.isCompleted()) {
      String studyUidUrl = "studyUID=" + study.getStudyInstanceUid();
      String patientIdUrl = "patientID=" + patient.getPatientIdentifier().getIdentifier();
      return RadiologyProperties.getDicomViewerUrl() + studyUidUrl + "&" + patientIdUrl;
    } else {
      return null;
    }
  }
  /**
   * Populate model and view given radiologyOrder and obs
   *
   * @param radiologyOrder to populate the model and view
   * @param obs to populate the model and view
   * @should populate the model and view for given radiology order with completed study and obs
   * @should populate the model and view for given radiology order without completed study and obs
   */
  private ModelAndView populateModelAndView(RadiologyOrder radiologyOrder, Obs obs) {

    ModelAndView result = new ModelAndView(RADIOLOGY_OBS_FORM_PATH);

    List<Obs> previousObs = radiologyService.getObsByOrderId(radiologyOrder.getOrderId());
    result.addObject("obs", obs);
    result.addObject("previousObs", previousObs);

    Study study = radiologyOrder.getStudy();
    result.addObject("studyUID", study.isCompleted() ? study.getStudyInstanceUid() : null);
    result.addObject("dicomViewerUrl", getDicomViewerUrl(study, radiologyOrder.getPatient()));

    return result;
  }