Class: OrcaApi::RehabilitationCommentService

Inherits:
Service
  • Object
show all
Defined in:
lib/orca_api/rehabilitation_comment_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

#get(patient_id, medication_code, perform_date, insurance_combination_number) ⇒ OrcaApi::Result

該当患者のリハビリコメント詳細情報を取得する

Parameters:

  • patient_id (String)

    患者番号

  • medication_code (String)

    診療コード

  • perform_date (String)

    診療年月

  • insurance_combination_number (String)

    保険組合せ

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/orca_api/rehabilitation_comment_service.rb', line 37

def get(patient_id, medication_code, perform_date, insurance_combination_number)
  req = {
    "Request_Number" => "00",
    "Karte_Uid" => orca_api.karte_uid,
    "Patient_ID" => patient_id,
    "Perform_Information" => {
      "Medication_Code" => medication_code,
      "Perform_Date" => perform_date,
      "Insurance_Combination_Number" => insurance_combination_number,
    },
  }
  call(req)
end

#list(patient_id) ⇒ OrcaApi::Result

該当患者のリハビリコメント一覧を取得する

Parameters:

  • patient_id (String)

    患者番号

Returns:



16
17
18
19
20
21
22
23
# File 'lib/orca_api/rehabilitation_comment_service.rb', line 16

def list(patient_id)
  req = {
    "Request_Number" => "00",
    "Karte_Uid" => orca_api.karte_uid,
    "Patient_ID" => patient_id,
  }
  call(req)
end

#update(patient_id, args) ⇒ OrcaApi::Result

該当患者のリハビリコメントを修正する

Parameters:

  • patient_id (String)

    患者番号

  • args (Hash)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/orca_api/rehabilitation_comment_service.rb', line 58

def update(patient_id, args)
  req = {
    "Request_Number" => "01",
    "Karte_Uid" => orca_api.karte_uid,
    "Patient_ID" => patient_id.to_s,
  }
  locked_result = res = call(req)
  if !res.ok?
    return res
  end

  req.merge!(args)
  req["Request_Number"] = res.response_number
  req["Orca_Uid"] = res.orca_uid
  res = call(req)
  if res.ok? && res.response_number == "00"
    locked_result = nil
    return res
  end
  if !res.ok?
    return res
  end

  req["Request_Number"] = res.response_number
  res = call(req)
  if res.ok?
    locked_result = nil
  end
  res
ensure
  unlock(locked_result)
end