public function getRangeString($patient = null) { # Returns range in string for printing or displaying $retval = ""; if ($this->getRangeType() == Measure::$RANGE_OPTIONS || $this->getRangeType() == Measure::$RANGE_MULTI || $this->getRangeType() == Measure::$RANGE_AUTOCOMPLETE) { $range_parts = explode("/", $this->range); # TODO: Display possible options for result indicator?? $retval .= "-"; } else { if ($this->getRangeType() == Measure::$RANGE_NUMERIC) { $ref_range = null; if ($patient != null) { $ref_range = ReferenceRange::getByAgeAndSex($patient->getAgeNumber(), $patient->sex, $this->measureId, $_SESSION['lab_config_id']); } if ($ref_range == null) { # Fetch from default entry in 'measure' table $range_parts = explode(":", $this->range); } else { $range_parts = array($ref_range->rangeLower, $ref_range->rangeUpper); } $retval .= "(" . $range_parts[0] . "-" . $range_parts[1]; if ($this->range != null && trim($this->range) != "") { $retval .= " " . $this->unit; } $retval .= ")"; } } return $range_parts; }