for i:= 0 to qry_patient_bed.FieldCount - 1 do
  begin
    dw_patient.CreateRow;
    dw_patient.Rows[i].DataBinding.FieldName := qry_patient_bed.Fields[i].FieldName;
    dw_patient.Rows[i].Kind := rkData;
    if qry_patient_bed.Fields[i].FieldName = 'photo' then
    begin
      dw_patient.Rows[i].Caption := '';
      dw_patient.Rows[i].DataBinding.ValueType := 'Variants';
      dw_patient.Rows[i].PropertiesClass := TcxImageProperties;
      TcxImageProperties(dw_patient.Rows[i].Properties).GraphicClassName:= 'TJPEGIMAGE';
      dw_patient.Rows[i].Position.LineCount := 3;
    end

end;