API 予約
メニュー
- 更新履歴
- 概要
- テスト方法
- リクエスト(POSTリクエスト)サンプル
- レスポンスサンプル
- リクエスト一覧
- レスポンス一覧
- Rubyによるリクエストサンプルソース
- C#によるリクエストサンプルソース
- エラーメッセージ一覧
- 警告メッセージ一覧
更新履歴
2014-07-24 「エラーメッセージ一覧」を追加。
「警告メッセージ一覧」を追加。
「レスポンス一覧」に警告メッセージ格納用項目を追加。
「リクエスト(POSTリクエスト)サンプル」の処理詳細を修正。
概要
POSTメソッドによる予約登録/予約取消を行います。
リクエストおよびレスポンスデータはxml2形式になります。
テスト方法
- 参考提供されている sample_appoint_v2.rb 内の変数HOST等を接続環境に合わせます。
- sample_appoint_v2.rb 内の患者番号等を接続先の日レセの環境に合わせます。
- ruby sample_appoint_v2.rb により接続。
リクエスト(POSTリクエスト)サンプル
POST : /orca14/appointmodv2?class=01
class = 01 予約受付
class = 02 予約取消
Content-Type : application/xml
application/xml の場合の文字コードは UTF-8 とします。
<data>
<appointreq type="record">
<Patient_ID type="string">12</Patient_ID>
<WholeName type="string"></WholeName>
<WholeName_inKana type="string"></WholeName_inKana>
<Appointment_Date type="string">2014-07-02</Appointment_Date>
<Appointment_Time type="string">12:10:00</Appointment_Time>
<Appointment_Id type="string"></Appointment_Id>
<Department_Code type="string">01</Department_Code>
<Physician_Code type="string">10001</Physician_Code>
<Medical_Information type="string"></Medical_Information>
<Appointment_Information type="string"></Appointment_Information>
<Appointment_Note type="string">予約めもです</Appointment_Note>
</appointreq>
</data>
処理概要
予約リクエストにより該当患者の予約又は取消を行います。
処理詳細
予約時
- 送信されたユーザID(職員情報)の妥当性チェック
- 送信された患者番号による患者の存在チェック
- 該当患者の排他チェック(他端末で展開中の有無)
- 診療科の存在チェック
- ドクターコードの存在チェック
- 診療内容の存在チェック
- 予約内容の存在チェック
- 予約日・予約時間・ドクター・診療内容で同一患者が予約済みかチェック
- 予約登録時に警告が出た場合は警告メッセージを「Api_Warning_Message」として返却
取消時
- 送信されたユーザID(職員情報)の妥当性チェック
- 送信された患者番号による患者の存在チェック
- 該当患者の排他チェック(他端末で展開中の有無)
- 送信された予約IDと患者番号または予約氏名とのチェック
- 予約取消時に警告が出た場合は警告メッセージを「Api_Warning_Message」として返却
レスポンスサンプル
<xmlio2>
<appointres type="record">
<Information_Date type="string">2014-07-04</Information_Date>
<Information_Time type="string">11:07:20</Information_Time>
<Api_Result type="string">K3</Api_Result>
<Api_Result_Message type="string">予約登録終了</Api_Result_Message>
<Api_Warning_Message_Information type="array">
<Api_Warning_Message_Information_child type="record">
<Api_Warning_Message type="string">診療内容情報を自動設定しました</Api_Warning_Message>
</Api_Warning_Message_Information_child>
<Api_Warning_Message_Information_child type="record">
<Api_Warning_Message type="string">予約日<システム日付です。過去日の予約です</Api_Warning_Message>
</Api_Warning_Message_Information_child>
</Api_Warning_Message_Information>
<Reskey type="string">Patient Info</Reskey>
<Appointment_Date type="string">2014-07-02</Appointment_Date>
<Appointment_Time type="string">12:10:00</Appointment_Time>
<Appointment_Id type="string">00001</Appointment_Id>
<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>
<Medical_Information type="string">01</Medical_Information>
<Appointment_Information type="string">00</Appointment_Information>
<Appointment_Note type="string">予約めもです</Appointment_Note>
<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">
<Address_ZipCode type="string">1130021</Address_ZipCode>
<WholeAddress type="string">東京都文京区本駒込6−16−3</WholeAddress>
</Home_Address_Information>
<HealthInsurance_Information type="array">
<HealthInsurance_Information_child type="record">
<InsuranceProvider_Class type="string">060</InsuranceProvider_Class>
<InsuranceProvider_Number type="string">138057</InsuranceProvider_Number>
<InsuranceProvider_WholeName type="string">国保</InsuranceProvider_WholeName>
<HealthInsuredPerson_Symbol type="string">01</HealthInsuredPerson_Symbol>
<HealthInsuredPerson_Number type="string">1234567</HealthInsuredPerson_Number>
<HealthInsuredPerson_Assistance type="string">3</HealthInsuredPerson_Assistance>
<RelationToInsuredPerson type="string">1</RelationToInsuredPerson>
<HealthInsuredPerson_WholeName type="string">日医 太郎</HealthInsuredPerson_WholeName>
<Certificate_StartDate type="string">2010-05-01</Certificate_StartDate>
<Certificate_ExpiredDate type="string">9999-12-31</Certificate_ExpiredDate>
<PublicInsurance_Information type="array">
<PublicInsurance_Information_child type="record">
<PublicInsurance_Class type="string">019</PublicInsurance_Class>
<PublicInsurance_Name type="string">原爆一般</PublicInsurance_Name>
<PublicInsurer_Number type="string">19113760</PublicInsurer_Number>
<PublicInsuredPerson_Number type="string">1234566</PublicInsuredPerson_Number>
<Rate_Admission type="string">0.00</Rate_Admission>
<Money_Admission type="string"> 0</Money_Admission>
<Rate_Outpatient type="string">0.00</Rate_Outpatient>
<Money_Outpatient type="string"> 0</Money_Outpatient>
<Certificate_IssuedDate type="string">2010-05-01</Certificate_IssuedDate>
<Certificate_ExpiredDate type="string">9999-12-31</Certificate_ExpiredDate>
</PublicInsurance_Information_child>
</PublicInsurance_Information>
</HealthInsurance_Information_child>
<HealthInsurance_Information_child type="record">
<InsuranceProvider_Class type="string">060</InsuranceProvider_Class>
<InsuranceProvider_Number type="string">138057</InsuranceProvider_Number>
<InsuranceProvider_WholeName type="string">国保</InsuranceProvider_WholeName>
<HealthInsuredPerson_Symbol type="string">01</HealthInsuredPerson_Symbol>
<HealthInsuredPerson_Number type="string">1234567</HealthInsuredPerson_Number>
<HealthInsuredPerson_Assistance type="string">3</HealthInsuredPerson_Assistance>
<RelationToInsuredPerson type="string">1</RelationToInsuredPerson>
<HealthInsuredPerson_WholeName type="string">日医 太郎</HealthInsuredPerson_WholeName>
<Certificate_StartDate type="string">2010-05-01</Certificate_StartDate>
<Certificate_ExpiredDate type="string">9999-12-31</Certificate_ExpiredDate>
</HealthInsurance_Information_child>
</HealthInsurance_Information>
</Patient_Information>
</appointres>
</xmlio2>
リクエスト一覧
番号 | 項目名 | 内容 | 例 | 備考 |
---|---|---|---|---|
1 | Patient_ID | 患者番号 | 00012 | ※1 |
2 | WholeName | 予約氏名(患者氏名) | 日医 太郎 | ※2 |
3 | WholeName_inKana | カナ氏名 | ニチイ タロウ | ※2 |
4 | Appointment_Date | 予約日 | 2014-07-02 | 必須 |
5 | Appointment_Time | 予約時間 | 12:10:00 | 必須 |
6 | Appointment_Id | 予約ID | 予約取消のみ※3 | |
7 | Department_Code | 診療科コード ※4 (01:内科) | 01 | 必須(予約登録のみ) |
8 | Physician_Code | ドクターコード | 10001 | 必須 |
9 | Medical_Information | 診療内容区分 ※5 (01:診察1、 02:薬のみ、 03:注射のみ、 04:検査のみ、 05:リハビリテーション、 06:健康診断、 07:予防注射、 99:該当なし) | 01 | |
10 | Appointment_Information | 予約内容区分 (01:患者による予約、 02:医師による予約) | 01 | |
11 | Appointment_Note | 予約メモ内容 | 予約めもです | ※6 |
※1:新規患者(患者登録なし)以外は必須とします。
※2:新規患者はどちらかを必須とし、予約氏名に設定がなければカナ氏名を予約氏名とします
※3:予約取消で予約ID未設定のときは、患者番号か予約氏名が必須となります。
※4:システム管理マスタの診療科目情報の診療科コードを参照して下さい。
※5:システム管理マスタの診療内容情報の診療内容コードを参照して下さい。
※6:半角文字は全角文字へ変換します。
レスポンス一覧
番号 | 項目名 | 内容 | 例 | 備考 |
---|---|---|---|---|
1 | Information_Date | 実施日 | 2014-07-04 | |
2 | Information_Time | 実施時間 | 11:07:20 | |
3 | Api_Result | 結果コード(ゼロ以外エラー) | K3 | 警告メッセージが複数の場合は、最初の警告メッセージのエラーコードを返却 |
4 | Api_Result_Message | エラーメッセージ | 予約登録終了 | |
5 | Api_Warning_Message_Information | 警告メッセージ情報(繰り返し 5) | 追加 (2014-07-24) | |
5-1 | Api_Warning_Message | 警告メッセージ | 診療内容情報を自動設定しました | 追加 (2014-07-24) |
6 | Reskey | Patient Info | ||
7 | Appointment_Date | 予約日 | 2014-07-02 | |
8 | Appointment_Time | 予約時間 | 12:10:00 | |
9 | Appointment_Id | 予約ID | 00001 | |
10 | Department_Code | 予約診療科コード ※7 (01:内科) | 01 | |
11 | Department_WholeName | 予約診療科名称 | 内科 | |
12 | Physician_Code | 予約ドクターコード | 10001 | |
13 | Physician_WholeName | 予約ドクター名 | 日本 一 | |
14 | Medical_Information | 診療内容区分 ※8 (01:診察1、 02:薬のみ、 03:注射のみ、 04:検査のみ、 05:リハビリテーション、 06:健康診断、 07:予防注射、 99:該当なし) | 01 | |
15 | Appointment_Information | 予約内容区分 (01:患者による予約、 02:医師による予約) | 00 | |
16 | Appointment_Note | 予約メモ内容 | 予約めもです | |
17 | Patient_Information | 患者基本情報 | ||
17-1 | Patient_ID | 患者番号 | 00012 | |
17-2 | WholeName | 患者氏名 | 日医 太郎 | |
17-3 | WholeName_inKana | 患者カナ氏名 | ニチイ タロウ | |
17-4 | BirthDate | 生年月日 | 1975-01-01 | |
17-5 | Sex | 性別 (1:男性、 2:女性) | 1 | |
17-6 | Home_Address_Information | 自宅住所情報 | ||
17-6-1 | Address_ZipCode | 郵便番号 | 1130021 | |
17-6-2 | WholeAddress | 住所 | 東京都文京区本駒込6−16−3 | |
17-7 | HealthInsurance_Information | 保険組合せ情報 (繰り返し 4) | ||
17-7-1 | InsuranceProvider_Class | 保険の種類(060:国保) | 060 | |
17-7-2 | InsuranceProvider_Number | 保険者番号 | 138057 | |
17-7-3 | InsuranceProvider_WholeName | 保険の制度名称 | 国保 | |
17-7-4 | HealthInsuredPerson_Symbol | 記号 | 01 | |
17-7-5 | HealthInsuredPerson_Number | 番号 | 1234567 | |
17-7-6 | HealthInsuredPerson_Continuation | 継続区分 (1:継続療養、 2:任意継続) | ||
17-7-7 | HealthInsuredPerson_Assistance | 補助区分 (詳細については、「日医標準レセプトソフトデータベーステーブル定義書」を参照して下さい。) | 3 | |
17-7-8 | RelationToInsuredPerson | 本人家族区分 (1:本人、 2:家族) | 1 | |
17-7-9 | HealthInsuredPerson_WholeName | 被保険者名 | 日医 太郎 | |
17-7-10 | Certificate_StartDate | 適用開始日 | 2010-05-01 | |
17-7-11 | Certificate_ExpiredDate | 適用終了日 | 9999-12-31 | |
17-7-12 | PublicInsurance_Information | 公費情報(繰り返し 3) | ||
17-7-12-1 | PublicInsurance_Class | 公費の種類 | 019 | |
17-7-12-2 | PublicInsurance_Name | 公費の制度名称 | 原爆一般 | |
17-7-12-3 | PublicInsurer_Number | 負担者番号 | 19113760 | |
17-7-12-4 | PublicInsuredPerson_Number | 受給者番号 | 1234566 | |
17-7-12-5 | Rate_Admission | 入院ー負担率(割) | 0.00 | |
17-7-12-6 | Money_Admission | 入院ー固定額 | 0 | |
17-7-12-7 | Rate_Outpatient | 外来ー負担率(割) | 0.00 | |
17-7-12-8 | Money_Outpatient | 外来ー固定額 | 0 | |
17-7-12-9 | Certificate_IssuedDate | 適用開始日 | 2010-05-01 | |
17-7-12-10 | Certificate_ExpiredDate | 適用終了日 | 9999-12-31 |
※7:システム管理マスタの診療科目情報の診療科コードを参照して下さい。
※8:システム管理マスタの診療内容情報の診療内容コードを参照して下さい。
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
#!/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("/orca14/appointmodv2?class=01")
# class :01 (予約)
# class :02 (取消)
#
#
BODY = <<EOF
<data>
<appointreq type="record">
<Patient_ID type="string">44444</Patient_ID>
<Appointment_Date type="string">2012-07-19</Appointment_Date>
<Appointment_Time type="string">12:10:00</Appointment_Time>
<Appointment_Id type="string"></Appointment_Id>
<Department_Code type="string">01</Department_Code>
<Physician_Code type="string">10001</Physician_Code>
<Medical_Information type="string">01</Medical_Information>
<Appointment_Information type="string"></Appointment_Information>
<Appointment_Note type="string">予約めもです </Appointment_Note>
</appointreq>
</data>
EOF req.content_length = BODY.size req.content_type = CONTENT_TYPE req.body = BODY req.basic_auth(USER, PASSWD) puts req.body Net::HTTP.start(HOST, PORT) {|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と一緒にインストールされます)
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Appoint
{
class AppointMain
{
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 + "/orca14/appointmodv2?class=01";
/*
class :01 予約
:02 取消
1.患者番号 Patient_ID (REQUIRED)
2.予約氏名 WholeName (REQUIRED)
3.カナ氏名 WholeName_inKane (REQUIRED)
4.予約日 Appointment_Date (REQUIRED)
5.予約時間 Appointment_Time (REQUIRED)
6.予約ID Appointment_Id (IMPLIED)
7.診療科 Department_Code (REQUIRED)
8.ドクターコード Physician_Code (REQUIRED)
9.診療内容区分 Medical_Information (IMPLIED)
10.予約内容区分 Appointment_Information (IMPLIED)
11.予約コメント Appointment_Note (IMPLIED)
REQUIRED : 必須 IMPLIED : 任意
*/
string BODY = @"
<data>
<appointreq type=""record"">
<Patient_ID type=""string"">44444</Patient_ID>
<Appointment_Date type=""string"">2012-07-19</Appointment_Date>
<Appointment_Time type=""string"">12:10:00</Appointment_Time>
<Appointment_Id type=""string""></Appointment_Id>
<Department_Code type=""string"">01</Department_Code>
<Physician_Code type=""string"">10001</Physician_Code>
<Medical_Information type=""string"">01</Medical_Information>
<Appointment_Information type=""string""></Appointment_Information>
<Appointment_Note type=""string"">予約めもです </Appointment_Note>
</appointreq>
</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(); } } } }
エラーメッセージ一覧
エラーコード | エラーメッセージ |
---|---|
01 | 患者番号・予約氏名・予約カナ氏名のいずれかを設定して下さい |
02 | 予約日が未設定です |
03 | 予約時間が未設定です |
04 | 診療科が未設定です |
05 | ドクターが未設定です |
10 | 患者番号に該当する患者が存在しません |
11 | 予約日が暦日ではありません |
12 | 予約時間設定誤り |
13 | 診療科が存在しません |
14 | ドクターが存在しません |
15 | 診療内容情報が存在しません |
16 | 予約内容が存在しません |
17 | 予約メモに登録できない文字があります |
18 | 予約氏名に登録できない文字があります |
19 | 予約カナ氏名に登録できない文字があります |
20 | 診療内容・ドクター・予約時間帯で予約登録済みです |
25 | 削除対象の予約レコードが存在しません |
26 | 予約ID設定誤り |
27 | 予約IDの予約情報と患者情報が一致しません |
50 | 予約IDが99まで登録済みです。これ以上予約できません |
51 | 予約登録エラー |
52 | 予約メモ登録エラー |
53 | 予約更新エラー |
54 | 予約削除エラー |
89 | 職員情報が取得できません |
医療機関情報が取得できません | |
システム日付が取得できません | |
患者番号構成情報が取得できません | |
グループ医療機関が不整合です。処理を終了して下さい | |
システム項目が設定できません | |
90 | 他端末使用中 |
91 | 処理区分未設定 |
97 | 送信内容に誤りがあります |
98 | 送信内容の読込ができませんでした |
99 | ユーザID未登録 |
警告メッセージ一覧
エラーコード | 警告メッセージ |
---|---|
K3 | 診療内容情報を自動設定しました |
K4 | 予約枠の最大件数以上の登録です 予約件数がオーバーしています |
K5 | 予約日<システム日付です 過去日の予約です |