複数の患者情報取得
メニュー
- 更新履歴
- 概要
- テスト方法
- リクエスト(POSTリクエスト)サンプル
- レスポンスサンプル
- リクエスト一覧
- レスポンス一覧
- Rubyによるリクエストサンプルソース
- C#によるリクエストサンプルソース
- エラーメッセージ一覧
更新履歴
2021-01-27 「レスポンス一覧」に項目を追加。
2014-07-03 「エラーメッセージ一覧」を追加。
概要
複数患者の基本情報を返却します。
リクエストおよびレスポンスデータはxml2形式になります。
テスト方法
- 参考提供されている sample_patient_list_v2.rb 内の変数HOST等を接続環境に合わせます。
- sample_patient_list_v2.rb 内の患者番号を接続先の日レセの環境に合わせます。
- ruby sample_patient_list_v2.rb により接続。
リクエスト(POSTリクエスト)サンプル
POST : /api01rv2/patientlst2v2?class=01 class = 01 ※指定した患者番号の情報を返却します。 ※患者番号が検索できない時は、氏名に【患者番号がありません】とメッセージを編集して返却します。 また、設定した患者番号の件数分返却します。
Content-Type: application/xml
application/xml の場合の文字コードは UTF-8 とします。
<data>
<patientlst2req type="record">
<Patient_ID_Information type="array">
<Patient_ID_Information_child type="record">
<Patient_ID type="string">13</Patient_ID>
</Patient_ID_Information_child>
<Patient_ID_Information_child type="record">
<Patient_ID type="string">12</Patient_ID>
</Patient_ID_Information_child>
</Patient_ID_Information>
</patientlst2req>
</data>
処理概要
指定された複数患者番号のリクエストにより、対応する患者の基本情報を返却します。
処理詳細
- 患者番号は必須入力とします。
- 患者番号の設定maxは、100人とします。
レスポンスサンプル
<xmlio2>
<patientlst2res type="record">
<Information_Date type="string">2014-07-15</Information_Date>
<Information_Time type="string">16:01:18</Information_Time>
<Api_Result type="string">00</Api_Result>
<Api_Result_Message type="string">処理終了</Api_Result_Message>
<Reskey type="string">Patient Info</Reskey>
<Target_Patient_Count type="string">002</Target_Patient_Count>
<No_Target_Patient_Count type="string">000</No_Target_Patient_Count>
<Patient_Information type="array">
<Patient_Information_child type="record">
<Patient_ID type="string">00013</Patient_ID>
<WholeName type="string">日医 次郎</WholeName>
<WholeName_inKana type="string">ニチイ ジロウ</WholeName_inKana>
<BirthDate type="string">1978-02-02</BirthDate>
<Sex type="string">1</Sex>
<Home_Address_Information type="record">
<Address_ZipCode type="string">1130021</Address_ZipCode>
<WholeAddress1 type="string">東京都文京区本駒込</WholeAddress1>
<WholeAddress2 type="string">6−16−3</WholeAddress2>
</Home_Address_Information>
<HealthInsurance_Information type="array">
<HealthInsurance_Information_child type="record">
<InsuranceProvider_Class type="string">060</InsuranceProvider_Class>
<InsuranceProvider_WholeName type="string">国保</InsuranceProvider_WholeName>
<InsuranceProvider_Number type="string">138057</InsuranceProvider_Number>
<HealthInsuredPerson_Symbol type="string">010</HealthInsuredPerson_Symbol>
<HealthInsuredPerson_Number type="string">89012</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-08-10</Certificate_StartDate>
<Certificate_ExpiredDate type="string">9999-12-31</Certificate_ExpiredDate>
</HealthInsurance_Information_child>
</HealthInsurance_Information>
<PublicInsurance_Information type="array">
<PublicInsurance_Information_child type="record">
<PublicInsurance_Class type="string">010</PublicInsurance_Class>
<PublicInsurance_Name type="string">感37の2</PublicInsurance_Name>
<PublicInsurer_Number type="string">10131142</PublicInsurer_Number>
<PublicInsuredPerson_Number type="string">1234566</PublicInsuredPerson_Number>
<Certificate_IssuedDate type="string">2010-08-10</Certificate_IssuedDate>
<Certificate_ExpiredDate type="string">9999-12-31</Certificate_ExpiredDate>
</PublicInsurance_Information_child>
</PublicInsurance_Information>
</Patient_Information_child>
<Patient_Information_child 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>
<WholeAddress1 type="string">東京都文京区本駒込</WholeAddress1>
<WholeAddress2 type="string">6−16−3</WholeAddress2>
<PhoneNumber1 type="string">03-3333-2222</PhoneNumber1>
<PhoneNumber2 type="string">03-3333-1133</PhoneNumber2>
</Home_Address_Information>
<Outpatient_Class type="string">1</Outpatient_Class>
<HealthInsurance_Information type="array">
<HealthInsurance_Information_child type="record">
<InsuranceProvider_Class type="string">060</InsuranceProvider_Class>
<InsuranceProvider_WholeName type="string">国保</InsuranceProvider_WholeName>
<InsuranceProvider_Number type="string">138057</InsuranceProvider_Number>
<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>
<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>
<Certificate_IssuedDate type="string">2010-05-01</Certificate_IssuedDate>
<Certificate_ExpiredDate type="string">9999-12-31</Certificate_ExpiredDate>
</PublicInsurance_Information_child>
</PublicInsurance_Information>
</Patient_Information_child>
</Patient_Information>
</patientlst2res>
</xmlio2>
リクエスト一覧
番号 | 項目名 | 内容 | 例 | 備考 |
---|---|---|---|---|
1 | Patient_ID_Information | 患者番号情報 (繰り返し 100) | 必須 | |
1-1 | Patient_ID | 患者番号 | 12 | 必須 |
レスポンス一覧
番号 | 項目名 | 内容 | 例 | 備考 |
---|---|---|---|---|
1 | Information_Date | 実施日 | 2014-07-15 | |
2 | Information_Time | 実施時間 | 16:01:18 | |
3 | Api_Result | 結果コード(ゼロ以外エラー) | 00 | |
4 | Api_Result_Message | エラーメッセージ | 処理終了 | |
5 | Reskey | Patient Info | ||
6 | Target_Patient_Count | 対象件数 | 002 | |
7 | No_Target_Patient_Count | エラー件数 | 000 | |
8 | Patient_Information | 患者情報 (繰り返し 100) | ||
8-1 | Patient_ID | 患者番号 | 00012 | |
8-2 | WholeName | 漢字氏名 | 日医 太郎 | |
8-3 | WholeName_inKana | カナ氏名 | ニチイ タロウ | |
8-4 | BirthDate | 生年月日 | 1975-01-01 | |
8-5 | Sex | 性別 (1:男性、2:女性) | 1 | |
8-6 | Home_Address_Information | 自宅住所情報 | ||
8-6-1 | Address_ZipCode | 郵便番号 | 1130021 | |
8-6-2 | WholeAddress1 | 住所 | 東京都文京区本駒込 | |
8-6-3 | WholeAddress2 | 番地番号 | 6−16−3 | |
8-6-4 | PhoneNumber1 | 自宅電話番号 | 03-3333-2222 | |
8-6-5 | PhoneNumber2 | 連絡先電話番号 | 03-3333-1133 | |
8-7 | Outpatient_Class | 入外区分 (1:入院、2:入院外) | 1 | |
8-8 | HealthInsurance_Information | 保険情報 (繰り返し 3) | ||
8-8-1 | InsuranceProvider_Class | 保険の種類(060 :国保) | 060 | |
8-8-2 | InsuranceProvider_WholeName | 保険の制度名称 | 国保 | |
8-8-3 | InsuranceProvider_Number | 保険者番号 | 138057 | |
8-8-4 | HealthInsuredPerson_Symbol | 記号 | 01 | |
8-8-5 | HealthInsuredPerson_Number | 番号 | 1234567 | |
8-8-6 | HealthInsuredPerson_Branch_Number | 枝番 | 00 | 追加 (2021-01-27) |
8-8-7 | HealthInsuredPerson_Continuation | 継続区分 (1:継続療養、 2:任意継続) | ||
8-8-8 | HealthInsuredPerson_Assistance | 補助区分 (詳細については、「日医標準レセプトソフトデータベーステーブル定義書」を参照して下さい。) | 3 | |
8-8-9 | RelationToInsuredPerson | 本人家族区分 (1:本人、 2:家族) | 1 | |
8-8-10 | HealthInsuredPerson_WholeName | 被保険者名 | 日医 太郎 | |
8-8-11 | Certificate_StartDate | 適用開始日 | 2010-05-01 | |
8-8-12 | Certificate_ExpiredDate | 適用終了日 | 9999-12-31 | |
8-9 | PublicInsurance_Information | 公費情報(繰り返し 4) | ||
8-9-1 | PublicInsurance_Class | 公費の種類 | 019 | |
8-9-2 | PublicInsurance_Name | 公費の制度名称 | 原爆一般 | |
8-9-3 | PublicInsurer_Number | 負担者番号 | 19113760 | |
8-9-4 | PublicInsuredPerson_Number | 受給者番号 | 1234566 | |
8-9-5 | Certificate_IssuedDate | 適用開始日 | 2010-05-01 | |
8-9-6 | Certificate_ExpiredDate | 適用終了日 | 9999-12-31 |
※保険情報・公費情報はそれぞれの情報になります。(保険組合せ内容ではありません)
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 -*-
#!/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/patientlst2v2?class=01")
# class :01 指定患者情報取得
#
#
BODY = <<EOF
<data>
<patientlst2req type="record">
<Patient_ID_Information type="array">
<Patient_ID_Information_child type="record">
<Patient_ID type="string">2</Patient_ID>
</Patient_ID_Information_child>
<Patient_ID_Information_child type="record">
<Patient_ID type="string">3</Patient_ID>
</Patient_ID_Information_child>
<Patient_ID_Information_child type="record">
<Patient_ID type="string">4</Patient_ID>
</Patient_ID_Information_child>
</Patient_ID_Information>
</patientlst2req>
</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 PatientList
{
class MainClass
{
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/patientlst2v2?class=01";
/*
class :01 指定した患者番号と一致する患者情報を返却
1.患者番号情報 Patient_ID_Information (REQUIRED)
2.患者番号 Patient_ID (REQUIRED)
REQUIRED : 必須 IMPLIED : 任意
*/
string BODY = @"
<data>
<patientlst2req type=""record"">
<Patient_ID_Information type=""array"">
<Patient_ID_Information_child type=""record"">
<Patient_ID type=""string"">2</Patient_ID>
</Patient_ID_Information_child>
<Patient_ID_Information_child type=""record"">
<Patient_ID type=""string"">3</Patient_ID>
</Patient_ID_Information_child>
<Patient_ID_Information_child type=""record"">
<Patient_ID type=""string"">4</Patient_ID>
</Patient_ID_Information_child>
</Patient_ID_Information>
</patientlst2req>
</data>
";
byte[] BODY_byte = Encoding.UTF8.GetBytes(BODY); HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(URL); req.Method = "POST"; req.ContentType = CONTENT_TYPE; req.ContentLength = BODY_byte.Length; req.Credentials = new NetworkCredential(USER, PASSWD); Console.WriteLine(BODY); HttpWebResponse res = null; try { Stream reqstream = req.GetRequestStream(); reqstream.Write(BODY_byte, 0, BODY_byte.Length); reqstream.Close(); res = (HttpWebResponse) req.GetResponse(); Console.WriteLine(res.ResponseUri); Console.WriteLine(res.StatusDescription); } catch(WebException wex) { if(wex.Status == WebExceptionStatus.ProtocolError) { HttpWebResponse err = (HttpWebResponse) wex.Response; int errcode = (int) err.StatusCode; Console.WriteLine(err.ResponseUri); Console.WriteLine("{0}:{1}", errcode, err.StatusDescription); err.Close(); } else { Console.WriteLine(wex.Message); } } if(res != null) { Stream str = res.GetResponseStream(); StreamReader strread = new StreamReader(str); Console.WriteLine(strread.ReadToEnd()); strread.Close(); str.Close(); res.Close(); } } } }
エラーメッセージ一覧
エラーコード | エラーメッセージ |
---|---|
89 | 職員情報が取得できません |
医療機関情報が取得できません | |
システム日付が取得できません | |
患者番号構成情報が取得できません | |
グループ医療機関が不整合です。処理を終了して下さい | |
システム項目が設定できません | |
90 | 他端末使用中 |
91 | 処理区分未設定 |
97 | 送信内容に誤りがあります |
98 | 送信内容の読込ができませんでした |
99 | ユーザID未登録 |