class PatientSessions::ConsentsController
Public Instance Methods
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 20 def create authorize Consent @draft_consent = DraftConsent.new(request_session: session, current_user:) @draft_consent.clear_attributes @draft_consent.assign_attributes(create_params) if @draft_consent.save redirect_to draft_consent_path(Wicked::FIRST_STEP) else render "patient_sessions/programmes/show", layout: "full", status: :unprocessable_content end end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 96 def edit_confirm_refusal render :confirm_refusal end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 65 def edit_follow_up render :follow_up end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 148 def edit_invalidate render :invalidate end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 128 def edit_withdraw render :withdraw end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 37 def send_request # For programmes that are administered together we should send the consent request together. programmes = ProgrammeGrouper .call(@session.programmes) .values .find { it.include?(@programme) } if @patient.notifier.can_send_consent_request?( programmes, academic_year: @academic_year ) @patient.notifier.send_consent_request( programmes, session: @session, sent_by: current_user ) end redirect_to session_patient_programme_path(@session, @patient, @programme), flash: { success: "Consent request sent." } end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 100 def update_confirm_refusal @form.assign_attributes(confirm_refusal_params) if @form.valid? if @form.confirmed? @consent.resolve_follow_up!( outcome: :confirmed, notes: confirm_refusal_params[:notes].to_s ) @consent.notifier.send_confirmation( session: @session, triage: nil, sent_by: current_user ) redirect_to session_patient_programme_consent_path, flash: { success: "Consent from #{@consent.name} updated." } else redirect_to session_patient_programme_consent_path end else render :confirm_refusal, status: :unprocessable_content end end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 69 def update_follow_up @form.assign_attributes(follow_up_params) if @form.valid? if @form.decision_stands? redirect_to confirm_refusal_session_patient_programme_consent_path else @draft_consent = DraftConsent.new(request_session: session, current_user:) @draft_consent.clear_attributes @draft_consent.assign_attributes(create_params) @draft_consent.follow_up_consent_id = @consent.id @draft_consent.follow_up_flow = true @draft_consent.new_or_existing_contact = @consent.parent_id.to_s @draft_consent.route = "phone" if @draft_consent.save redirect_to draft_consent_path("agree") else render :follow_up, status: :unprocessable_content end end else render :follow_up, status: :unprocessable_content end end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 152 def update_invalidate @consent.assign_attributes(invalidate_params) if @consent.valid? ActiveRecord::Base.transaction do @consent.save! @consent.update_vaccination_records_no_notify! update_patient_status end redirect_to session_patient_programme_consent_path, flash: { success: "Consent response from #{@consent.name} marked as invalid" } else render :invalidate, status: :unprocessable_content end end
Source
# File app/controllers/patient_sessions/consents_controller.rb, line 132 def update_withdraw @consent.assign_attributes(withdraw_params) if @consent.valid? ActiveRecord::Base.transaction do @consent.save! update_patient_status end redirect_to session_patient_programme_consent_path else render :withdraw, status: :unprocessable_content end end