複数の患者情報取得

メニュー

更新履歴

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

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


概要

複数患者の基本情報を返却します。

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

 

テスト方法

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

処理概要

指定された複数患者番号のリクエストにより、対応する患者の基本情報を返却します。

処理詳細

  1. 患者番号は必須入力とします。
  2. 患者番号の設定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>

リクエスト一覧

番号項目名内容備考
1Patient_ID_Information患者番号情報 (繰り返し 100) 必須
1-1
Patient_ID患者番号12
必須

レスポンス一覧

番号項目名内容備考
1Information_Date実施日2014-07-15
 
2Information_Time実施時間16:01:18
 
3Api_Result結果コード(ゼロ以外エラー)00 
4Api_Result_Messageエラーメッセージ処理終了 
5Reskey Patient Info 
6Target_Patient_Count対象件数002 
7No_Target_Patient_Countエラー件数000 
8Patient_Information患者情報 (繰り返し 100)  
8-1Patient_ID患者番号00012 
8-2WholeName漢字氏名日医 太郎 
8-3WholeName_inKanaカナ氏名ニチイ タロウ 
8-4BirthDate生年月日1975-01-01 
8-5Sex性別
(1:男性、2:女性)
1 
8-6Home_Address_Information自宅住所情報  
8-6-1Address_ZipCode郵便番号1130021 
8-6-2WholeAddress1住所東京都文京区本駒込 
8-6-3WholeAddress2番地番号6−16−3 
8-6-4PhoneNumber1自宅電話番号03-3333-2222
 
8-6-5PhoneNumber2連絡先電話番号03-3333-1133
 
8-7Outpatient_Class入外区分
(1:入院、2:入院外)
1
 
8-8HealthInsurance_Information保険情報 (繰り返し 3)  
8-8-1InsuranceProvider_Class保険の種類(060 :国保)060 
8-8-2InsuranceProvider_WholeName保険の制度名称国保 
8-8-3InsuranceProvider_Number保険者番号138057 
8-8-4HealthInsuredPerson_Symbol記号01 
8-8-5HealthInsuredPerson_Number番号1234567 
8-8-6
HealthInsuredPerson_Branch_Number
枝番
00
追加
(2021-01-27)
8-8-7HealthInsuredPerson_Continuation継続区分
(1:継続療養、 2:任意継続)
  
8-8-8HealthInsuredPerson_Assistance補助区分
(詳細については、「日医標準レセプトソフトデータベーステーブル定義書」を参照して下さい。)
3 
8-8-9RelationToInsuredPerson本人家族区分
(1:本人、 2:家族)
1 
8-8-10HealthInsuredPerson_WholeName被保険者名日医 太郎 
8-8-11Certificate_StartDate適用開始日2010-05-01 
8-8-12Certificate_ExpiredDate適用終了日9999-12-31 
8-9PublicInsurance_Information公費情報(繰り返し 4)  
8-9-1PublicInsurance_Class公費の種類019 
8-9-2PublicInsurance_Name公費の制度名称原爆一般
 
8-9-3PublicInsurer_Number負担者番号19113760
 
8-9-4PublicInsuredPerson_Number受給者番号1234566 
8-9-5Certificate_IssuedDate適用開始日2010-05-01 
8-9-6Certificate_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 -*- 

 

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

sample_patient_list_v2.cs

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未登録

 

 

 

このページのトップへ