Class: Dcm4chee::Api::V1::TrashedPatientsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

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

Examples:

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

{ "patient_id": ... }

# Response
HTTP/1.1 201 Created


59
60
61
62
63
64
# File 'app/controllers/dcm4chee/api/v1/trashed_patients_controller.rb', line 59

def create
  patient = Patient.get!(params[:patient_id])
  patient.move_to_trash

  head :created
end

#destroyObject

Delete a patient from the trash.

Examples:

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

# Response
HTTP/1.1 200 OK


75
76
77
78
79
80
# File 'app/controllers/dcm4chee/api/v1/trashed_patients_controller.rb', line 75

def destroy
  patient = TrashedPatient.get!(params[:id])
  patient.remove_from_trash

  head :ok
end

#indexObject

Search for patients from the trash. Supported querying conditions:

name
pid
pid_issuer
trashed_studies.accession_no
trashed_studies.series.source_aet

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

Examples:

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

# Response
HTTP/1.1 200 OK
{
  "trashed_patients": [{
    "id": ...,
    "pid": ...,
    "pid_issuer": ...,
    "name": ...,
    "dcm_elements": [{
      "name": ...,
      "value": ...,
      "tag": ...,
      "value_representation": ...,
      "length": ...
    }, ...]
  }, ...]
}


41
42
43
44
45
# File 'app/controllers/dcm4chee/api/v1/trashed_patients_controller.rb', line 41

def index
  patients = TrashedPatient.search(params[:q])

  respond_with trashed_patients: patients
end