トップ > 日医標準レセプトソフト > 技術情報 > 日医標準レセプトソフト API > 日医標準レセプトソフト API 予約

API 予約

メニュー

更新履歴

2014-07-24   「エラーメッセージ一覧」を追加。
      「警告メッセージ一覧」を追加。
      「レスポンス一覧」に警告メッセージ格納用項目を追加。
      「リクエスト(POSTリクエスト)サンプル」の処理詳細を修正。


概要

POSTメソッドによる予約登録/予約取消を行います。

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

テスト方法

  1. 参考提供されている sample_appoint_v2.rb 内の変数HOST等を接続環境に合わせます。
  2. sample_appoint_v2.rb 内の患者番号等を接続先の日レセの環境に合わせます。
  3. 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>

処理概要

予約リクエストにより該当患者の予約又は取消を行います。

処理詳細

予約時

  1. 送信されたユーザID(職員情報)の妥当性チェック
  2. 送信された患者番号による患者の存在チェック
  3. 該当患者の排他チェック(他端末で展開中の有無)
  4. 診療科の存在チェック
  5. ドクターコードの存在チェック
  6. 診療内容の存在チェック
  7. 予約内容の存在チェック
  8. 予約日・予約時間・ドクター・診療内容で同一患者が予約済みかチェック
  9. 予約登録時に警告が出た場合は警告メッセージを「Api_Warning_Message」として返却

取消時

  1. 送信されたユーザID(職員情報)の妥当性チェック
  2. 送信された患者番号による患者の存在チェック
  3. 該当患者の排他チェック(他端末で展開中の有無)
  4. 送信された予約IDと患者番号または予約氏名とのチェック
  5. 予約取消時に警告が出た場合は警告メッセージを「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>

 

リクエスト一覧

番号項目名内容備考
1Patient_ID患者番号00012※1
2WholeName予約氏名(患者氏名)日医 太郎
※2
3WholeName_inKanaカナ氏名ニチイ タロウ
※2
4Appointment_Date予約日2014-07-02必須
5Appointment_Time予約時間12:10:00必須
6Appointment_Id予約ID 予約取消のみ※3
7Department_Code診療科コード ※4
(01:内科)
01必須(予約登録のみ)
8Physician_Codeドクターコード10001必須
9Medical_Information診療内容区分 ※5
(01:診察1、 02:薬のみ、 03:注射のみ、 04:検査のみ、 05:リハビリテーション、 06:健康診断、 07:予防注射、 99:該当なし)
01 
10Appointment_Information予約内容区分
(01:患者による予約、 02:医師による予約)
01 
11Appointment_Note予約メモ内容予約めもです
※6

※1:新規患者(患者登録なし)以外は必須とします。

※2:新規患者はどちらかを必須とし、予約氏名に設定がなければカナ氏名を予約氏名とします

※3:予約取消で予約ID未設定のときは、患者番号か予約氏名が必須となります。

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

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

※6:半角文字は全角文字へ変換します。


 

レスポンス一覧

番号項目名内容備考
1Information_Date実施日2014-07-04 
2Information_Time実施時間11:07:20
 
3Api_Result結果コード(ゼロ以外エラー)K3
警告メッセージが複数の場合は、最初の警告メッセージのエラーコードを返却
4Api_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予約ID00001
 
10
Department_Code予約診療科コード ※7
(01:内科)
01 
11Department_WholeName予約診療科名称内科 
12Physician_Code予約ドクターコード10001 
13Physician_WholeName予約ドクター名日本 一 
14Medical_Information診療内容区分 ※8
(01:診察1、 02:薬のみ、 03:注射のみ、 04:検査のみ、 05:リハビリテーション、 06:健康診断、 07:予防注射、 99:該当なし)
01 
15Appointment_Information予約内容区分
(01:患者による予約、 02:医師による予約)
00 
16Appointment_Note予約メモ内容予約めもです
 
17Patient_Information患者基本情報  
17-1Patient_ID患者番号00012 
17-2WholeName患者氏名日医 太郎 
17-3WholeName_inKana患者カナ氏名ニチイ タロウ 
17-4BirthDate生年月日1975-01-01 
17-5Sex性別
(1:男性、 2:女性)
1 
17-6Home_Address_Information自宅住所情報  
17-6-1Address_ZipCode郵便番号1130021 
17-6-2WholeAddress住所東京都文京区本駒込6−16−3 
17-7HealthInsurance_Information保険組合せ情報 (繰り返し 4)  
17-7-1InsuranceProvider_Class保険の種類(060:国保)060 
17-7-2InsuranceProvider_Number保険者番号138057 
17-7-3InsuranceProvider_WholeName保険の制度名称国保 
17-7-4HealthInsuredPerson_Symbol記号01 
17-7-5HealthInsuredPerson_Number番号1234567 
17-7-6HealthInsuredPerson_Continuation継続区分
(1:継続療養、 2:任意継続)
  
17-7-7HealthInsuredPerson_Assistance補助区分
(詳細については、「日医標準レセプトソフトデータベーステーブル定義書」を参照して下さい。)
3 
17-7-8RelationToInsuredPerson本人家族区分
(1:本人、 2:家族)
1 
17-7-9HealthInsuredPerson_WholeName被保険者名日医 太郎 
17-7-10Certificate_StartDate適用開始日2010-05-01 
17-7-11Certificate_ExpiredDate適用終了日9999-12-31 
17-7-12PublicInsurance_Information公費情報(繰り返し 3)  
17-7-12-1PublicInsurance_Class公費の種類019 
17-7-12-2PublicInsurance_Name公費の制度名称原爆一般
 
17-7-12-3PublicInsurer_Number負担者番号19113760
 
17-7-12-4PublicInsuredPerson_Number受給者番号1234566 
17-7-12-5Rate_Admission入院ー負担率(割)0.00 
17-7-12-6Money_Admission入院ー固定額0 
17-7-12-7Rate_Outpatient外来ー負担率(割)0.00 
17-7-12-8Money_Outpatient外来ー固定額0 
17-7-12-9Certificate_IssuedDate適用開始日2010-05-01 
17-7-12-10Certificate_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 

sample_appoint_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("/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と一緒にインストールされます)

sample_appoint_v2.cs 

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 予約日<システム日付です 過去日の予約です

 

 

トップ > 日医標準レセプトソフト > 技術情報 > 日医標準レセプトソフト API > 日医標準レセプトソフト API 予約

このページのトップへ