Class: Dcm4chee::Api::V1::TrashedStudiesController

Inherits:
BaseController show all
Defined in:
app/controllers/dcm4chee/api/v1/trashed_studies_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Move a study to the trash including the related series, instances and files.

Examples:

# Request
POST /api/trashed_studies HTTP/1.1
Accept: application/vnd.menglifang.org; version=1
Content-Type: application/json

{ "study_id": ... }

# Response
HTTP/1.1 201 Created


55
56
57
58
59
60
# File 'app/controllers/dcm4chee/api/v1/trashed_studies_controller.rb', line 55

def create
  study = Study.get!(params[:study_id])
  study.move_to_trash

  head :created
end

#destroyObject

Delete a study from the trash.

Examples:

# Request
DELETE /api/trashed_studies/... HTTP/1.1
Accept: application/vnd.menglifang.org; version=1

# Response
HTTP/1.1 200 OK


71
72
73
74
75
76
# File 'app/controllers/dcm4chee/api/v1/trashed_studies_controller.rb', line 71

def destroy
  study = TrashedStudy.get!(params[:id])
  study.remove_from_trash

  head :ok
end

#indexObject

Search for studies from the trash. Supported querying conditions:

trashed_patient_id

Check DataMapper::Searcher::ClassMethods for supported querying operators.

Examples:

# Request
GET /api/trashed_studies?q[trashed_patient_id]=... HTTP/1.1
Accept: application/vnd.menglifang.org; version=1

# Response
HTTP/1.1 200 OK
{
  "trashed_studies": [{
    "id": ...,
    "trashed_patient_id": ...,
    "study_iuid": ...,
    "accession_no": ...,
    "dcm_elements": [{
      "name": ...,
      "value": ...,
      "tag": ...,
      "value_representation": ...,
      "length": ...
    }, ...]
  }, ...]
}


37
38
39
40
41
# File 'app/controllers/dcm4chee/api/v1/trashed_studies_controller.rb', line 37

def index
  studies = TrashedStudy.search(params[:q])

  respond_with trashed_studies: studies
end