Class: OrcaApi::PrintService

Inherits:
Service
  • Object
show all
Defined in:
lib/orca_api/print_service.rb

Overview

帳票印刷を扱うサービスを表現したクラス

Instance Attribute Summary

Attributes inherited from Service

#orca_api

Instance Method Summary collapse

Methods inherited from Service

#initialize, reuse_session

Constructor Details

This class inherits a constructor from OrcaApi::Service

Constructor Details

This class inherits a constructor from OrcaApi::Service

Instance Method Details

#create(type, patient_id, invoice_number, outside_class, push_notification = false) ⇒ OrcaApi::Result

帳票印刷リクエスト

処方箋

お薬手帳

Parameters:

  • type (String)

    帳票種別。shohosen = 処方箋、okusuri_techo = お薬手帳

  • patient_id (String)

    患者番号

  • invoice_number (String)

    伝票番号

  • outside_class (Boolean)

    院内・院外区分。true = 院外、false = 院内

  • push_notification (Boolean) (defaults to: false)

    帳票データ返却と同時にpush通知を行う場合はtrue、そうでない場合はfalseを指定する

Returns:

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/orca_api/print_service.rb', line 34

def create(type, patient_id, invoice_number, outside_class, push_notification = false)
  case type.to_s
  when "shohosen"
    path = "/api01rv2/prescriptionv2"
    request_name = "prescriptionv2req"
  when "okusuri_techo"
    path = "/api01rv2/medicinenotebookv2"
    request_name = "medicine_notebookv2req"
  else
    raise ArgumentError, "対応していない帳票種別です: #{type}"
  end

  req = {
    "Request_Number" => push_notification ? "01" : "02",
    "Patient_ID" => patient_id.to_s,
    "Invoice_Number" => invoice_number.to_s,
    "Outside_Class" => outside_class ? "True" : "False",
  }

  FormResult.new(orca_api.call(path, body: { request_name => req }))
end