予約一覧

メニュー

更新履歴

2023-12-25   「レスポンス一覧」に項目を追加。

2017-11-27   「レスポンス一覧」に項目を追加。

2014-07-03  「エラーメッセージ一覧」を追加。


概要

POSTメソッドによる予約一覧取得を行います。

リクエストおよびレスポンスデータはxml2形式になります。

 

テスト方法

  1. 参考提供されている sample_appointlst.rb 内の変数HOST等を接続環境に合わせます。
  2. sample_appointlst.rb 内の患者番号等を接続先の日レセの環境に合わせます。
  3. ruby sample_appointlst.rb により接続。

 

リクエスト(POSTリクエスト)サンプル

POST : /api01rv2/appointlstv2?class=01
class = 01 予約一覧取得
Content-Type: application/xml

文字コードは UTF-8 とします。


<data> 
<appointlstreq type="record">
<Appointment_Date type="string">2011-03-15</Appointment_Date>
<Medical_Information type="string">01</Medical_Information>
<Physician_Code type="string">10001</Physician_Code>
</appointlstreq>
</data>

処理概要

予約一覧リクエストにより指定日の予約一覧の情報を返却します。

処理詳細

  1. 予約日妥当性チェック
  2. 診療科の存在チェック(※)
  3. ドクターコードの存在チェック(※)

(※2,3の条件については、設定されていれば対象のもののみ返却します。)

 

レスポンスサンプル

<xmlio2>
<appointlstres type="record">
<Information_Date type="string">2011-03-13</Information_Date>
<Information_Time type="string">10:59:22</Information_Time>
<Api_Result type="string">00</Api_Result>
<Api_Result_Message type="string">処理終了</Api_Result_Message>
<Reskey type="string">Patient Info</Reskey>
<Appointment_Date type="string">2011-03-15</Appointment_Date>
<Appointlst_Information type="array">
<Appointlst_Information_child type="record">
<Appointment_Time type="string">15:30:00</Appointment_Time>
<Medical_Information type="string">01</Medical_Information>
<Department_Code type="string">01</Department_Code>
<Department_WholeName type="string">内科</Department_WholeName>
<Physician_Code type="string">10001</Physician_Code>
<Physician_WholeName type="string">日本 一</Physician_WholeName>
<Patient_Information type="record">
<Patient_ID type="string">00012</Patient_ID>
<WholeName type="string">日医 太郎</WholeName>
<WholeName_inKana type="string">ニチイ タロウ</WholeName_inKana>
<BirthDate type="string">1975-01-01</BirthDate>
<Sex type="string">1</Sex>
<Home_Address_Information type="record">
<PhoneNumber1 type="string">03-8888-9999</PhoneNumber1>
</Home_Address_Information>
</Patient_Information>
</Appointlst_Information_child>
</Appointlst_Information>
</appointlstres>
</xmlio2>

リクエスト一覧

番号 項目名 内容 備考
1 Appointment_Date 予約日 2011-03-15  
2 Medical_Information 診療内容区分 ※1
(01:診察1、 02:薬のみ、 03:注射のみ、 04:検査のみ、 05:リハビリテーション、 06:健康診断、 07:予防注射、 99:該当なし)
01 ※2
3 Physician_Code ドクターコード 10001 ※2

※1:システム管理マスタの診療内容情報の診療内容コードを参照して下さい。

※2:設定があれば一致する予約を対象とし、未設定であれば全てを対象とします。


レスポンス一覧

番号 項目名 内容 備考
1 Information_Date 実施日 2011-03-13  
2 Information_Time 実施時間 10:50:00  
3 Api_Result 結果コード(ゼロ以外エラー) 00  
4 Api_Result_Message エラーメッセージ 処理終了  
5 Reskey   Patient Info  
6 Appointment_Date 予約日 2011-03-15  
7 Appointlst_Information 予約情報 (繰り返し500)    
7-1 Appointment_Time 予約時間 15:30:00  
7-2 Medical_Information 診療内容区分 ※3
(01:診察1、 02:薬のみ、 03:注射のみ、 04:検査のみ、 05:リハビリテーション、 06:健康診断、 07:予防注射、 99:該当なし)
01  
7-3 Department_Code 予約診療科コード ※4
(01:内科)
01  
7-4 Department_WholeName 予約診療科名称 内科  
7-5 Physician_Code 予約ドクタコード 10001  
7-6 Physician_WholeName 予約ドクター名 日本 一  
7-7 Visit_Information 来院情報 (1:来院済)    
7-8
Appointment_Id
予約ID
02
追加
(2017-11-27)
7-9
Patient_Information 患者情報    
7-9-1 Patient_ID 患者番号 00012  
7-9-2 WholeName 患者氏名 日医 太郎  
7-9-3 WholeName_inKana 患者カナ氏名 ニチイ タロウ  
7-9-4 BirthDate 生年月日 1975-01-01  
7-9-5 Sex 性別
(1:男性、2:女性)
1  
7-9-6 Home_Address_Information 自宅住所情報    
7-9-6-1 PhoneNumber1 自宅電話番号 03-8888-9999  
7-9-7 HealthInsurance_Information 保険組合せ情報   追加
(2023-12-25)
※5
7-9-7-1 HealthInsurance_Info     追加
(2023-12-25)
※5
7-9-7-1-1 InsuranceProvider_Class 保険の種類(060:国保) 060 追加
(2023-12-25)
※5
7-9-7-1-2 InsuranceProvider_Number 保険者番号 138057 追加
(2023-12-25)
※5
7-9-7-1-3 InsuranceProvider_WholeName 保険の制度名称 国保 追加
(2023-12-25)
※5
7-9-7-1-4 HealthInsuredPerson_Symbol 記号 01 追加
(2023-12-25)
※5
7-9-7-1-5 HealthInsuredPerson_Number 番号 1234567 追加
(2023-12-25)
※5
7-9-7-1-6 HealthInsuredPerson_Branch_Number 枝番 01 追加
(2023-12-25)
※5
7-9-7-1-7 HealthInsuredPerson_Assistance 補助区分
(詳細については、「日医標準レセプトソフトデータベーステーブル定義書」を参照して下さい。)
3 追加
(2023-12-25)
※5
7-9-7-1-8 HealthInsuredPerson_Assistance_Name 補助区分名称 3割 追加
(2023-12-25)
※5
7-9-7-1-9 RelationToInsuredPerson 本人家族区分
(1:本人、 2:家族)
1 追加
(2023-12-25)
※5
7-9-7-1-10 Certificate_StartDate 適用開始日 2010-05-01 追加
(2023-12-25)
※5
7-9-7-1-11 Certificate_ExpiredDate 適用終了日 9999-12-31 追加
(2023-12-25)
※5

※3:システム管理マスタの診療内容情報の診療内容コードを参照して下さい。

※4:システム管理マスタの診療科目情報の診療科コードを参照して下さい。

※5:オンライン資格確認用情報として自費、労災、自賠を除く該当患者の主保険情報を取得する。

 

Rubyによるリクエストサンプルソース

 Rubyのバージョンが1.9.2以前の環境の場合、HTTPのバージョン指定を1.1に変更する必要があります。
 Rubyのバージョンを確認後、以下のように該当箇所を変更して下さい。

  • Ruby1.9.2以降の場合
    Net::HTTP.version_1_2 
  • Ruby1.9.2以前の場合
    Net::HTTP.version_1_1 

 Rubyのバージョンが1.9.1以降の環境(日レセ4.8以降の環境)ではソースファイル内の文字コードの指定が必要になります。
 サンプルソース内に以下の一行が記述されていることを確認して下さい。

# -*- coding: utf-8 -*- 

 

sample_appointlst_v2.rb

#!/usr/bin/ruby
# -*- coding: utf-8 -*-

#------ 予約一覧取得


require 'uri'
require 'net/http'

Net::HTTP.version_1_2

HOST = "localhost"
PORT = "8000"
USER = "ormaster"
PASSWD = "ormaster"
CONTENT_TYPE = "application/xml"


req = Net::HTTP::Post.new("/api01rv2/appointlstv2?class=01")
# class :01 予約一覧
#
#
BODY = <<EOF
<data>
<appointlstreq type="record">
<Appointment_Date type="string">2011-03-15</Appointment_Date>
<Medical_Information type="string">01</Medical_Information>
<Physician_Code type="string">10001</Physician_Code>
</appointlstreq>
</data>
EOF


req.content_length = BODY.size
req.content_type = "application/xml"
req.body = BODY
req.basic_auth(USER, PASSWD)
  puts req.body

Net::HTTP.start(HOST, PASSWD) {|http|
  res = http.request(req)
  puts res.body

}

C#によるリクエストサンプルソース

Windowsでの実行環境

  • Microsoft Visual Studio 2008以降
  • .NET Framework 2.0 SDK(C#コンパイラを含む.NET Frameworkの開発ツール)
    (Microsoft Visual Studioに含まれています)

Ubuntuでの実行環境

  • MonoDevelop 2.2(1.0でも実行可能)
  • mono-gmcs(C#コンパイラ)
    (MonoDevelopと一緒にインストールされます)

sample_appointlst_v2.cs

using System;
using System.IO;
using System.Net;
using System.Text;

namespace Appointlst
{
class AppointlstMain
{
public static void Main(string[] args)
{

string HOST = "localhost";
string PORT = "8000";
string USER = "ormaster";
string PASSWD = "ormaster";
string CONTENT_TYPE = "application/xml";

string URL = "http://" + HOST + ":" + PORT + "/api01rv2/appointlstv2?class=01";
/*
class :01 予約一覧

1.予約日 Appointment_Date (IMPLIED)
2.診療内容区分 Medical_Information (IMPLIED)
3.ドクターコード Physician_Code (IMPLIED)

REQUIRED : 必須 IMPLIED : 任意
*/

string BODY = @"
<data>
<appointlstreq type=""record"">
<Appointment_Date type=""string"">2012-07-02</Appointment_Date>
<Medical_Information type=""string"">01</Medical_Information>
<Physician_Code type=""string""></Physician_Code>
</appointlstreq>
</data>
";
      byte[] record_in_byte = Encoding.UTF8.GetBytes(BODY);

      HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(URL);
      //req.ProtocolVersion = HttpVersion.Version11;

      req.Method = "POST";
      req.ContentType = CONTENT_TYPE;
      req.ContentLength = record_in_byte.Length;
      req.Credentials = new NetworkCredential(USER, PASSWD);

      Console.WriteLine(BODY);

      HttpWebResponse res = null;
      try
      {
        Stream reqstream = req.GetRequestStream();

        reqstream.Write(record_in_byte, 0, record_in_byte.Length);
        reqstream.Close();

        res = (HttpWebResponse) req.GetResponse();

        Console.WriteLine(res.ResponseUri);
        Console.WriteLine(res.StatusDescription);
      }
      catch (WebException exc)
      {
        if (exc.Status == WebExceptionStatus.ProtocolError)
        {
          HttpWebResponse err = (HttpWebResponse) exc.Response;

          int errcode = (int) err.StatusCode;

          Console.WriteLine(err.ResponseUri);
          Console.WriteLine("{0}:{1}", errcode, err.StatusDescription);

          err.Close();
        }
        else
        {
          Console.WriteLine(exc.Message);
        }
      }

      if (res != null)
      {
        Stream str = res.GetResponseStream();
        StreamReader strread = new StreamReader(str);

        string FOO = strread.ReadToEnd();
        string FILE_NAME = "foo.xml";
        File.WriteAllText(FILE_NAME, FOO);

        strread.Close();
        str.Close();

        res.Close();
      }
    }
  }
}

 

エラーメッセージ一覧

 エラーコード  エラーメッセージ
 11  予約日が暦日ではありません
 12  ドクターが存在しません
 13  診療内容情報が存在しません
 20  予約対象件数が500件以上あります
 21  対象の予約はありませんでした
 89  職員情報が取得できません
 医療機関情報が取得できません
 システム日付が取得できません
 患者番号構成情報が取得できません
 グループ医療機関が不整合です。処理を終了して下さい
 システム項目が設定できません
 90  他端末使用中
 91  処理区分未設定
 97  送信内容に誤りがあります
 98  送信内容の読込ができませんでした
 99  ユーザID未登録