患者病名情報の返却

メニュー

更新履歴

2019-07-29   「レスポンス一覧」に項目を追加

2019-05-28   「レスポンス一覧」に項目を追加

2017-05-25   「レスポンス一覧」に項目を追加

2016-09-26   全ての患者病名情報の取得対応。
        「リクエスト(POSTリクエスト)サンプル」の処理詳細に説明を追加。
        「レスポンスサンプル」に項目を追加。
        「リクエスト一覧」「レスポンス一覧」に項目を追加。

2016-04-18   合併症に係わる情報追加対応。
        「レスポンス一覧」に項目を追加。

 

概要

POSTメソッドによる患者病名情報の返却を行います。

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

テスト方法

  1. 参考提供されている sample_disease_info.rb 内の変数HOST等を接続環境に合わせます。
  2. sample_disease_info.rb 内の患者番号等を接続先の日レセの環境に合わせ、送信したい情報を設定します。
  3. ruby sample_disease_info.rb により接続します。

 

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

POST : /api01rv2/diseasegetv2?class=01 
    class = 01 (患者病名情報の取得)

Content-Type: application/xml

application/xml の場合の文字コードは UTF-8 とします。


<data> 
<disease_inforeq type="record">
<Patient_ID type="string">00012</Patient_ID>
<Base_Date type="string">2012-05</Base_Date>
</disease_inforeq>
</data>

処理概要

指定された患者番号、基準月のリクエストにより、該当患者の病名情報を返却します。

処理詳細

  1. 該当患者の返却病名設定のmaxは、200とします。
  2. 送信された患者番号による患者の存在をチェックします。
  3. 送信された基準月の妥当性をチェックします。
  4. 返却順は、開始日の古いものからとします。
    (Select_Mode=Allの場合は開始日の降順、表示連番、診療科、登録順)
  5. Select_Mode=Allの場合は基準日の含む月から、遡って転帰済も含め全ての病名も対象とします。
    (上限を越えた場合は、その前月までを返却します。All以外の値は全て、指定月で有効な病名を返却します。)

 

レスポンスサンプル

<xmlio2>
<disease_infores type="record">
<Information_Date type="string">2012-05-29</Information_Date>
<Information_Time type="string">17:11:59</Information_Time>
<Api_Result type="string">00</Api_Result>
<Api_Result_Message type="string">処理終了</Api_Result_Message>
<Reskey type="string">Medical Info</Reskey>
<Information_Overflow type="string">False</Information_Overflow>
<Disease_Infores 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>
</Disease_Infores>
<Base_Date type="string">2012-05</Base_Date>
<Disease_Information type="array">
<Disease_Information_child type="record">
<Disease_InOut type="string">I</Disease_InOut>
<Department_Code type="string">01</Department_Code>
<Insurance_Combination_Number type="string">0002</Insurance_Combination_Number>
<Disease_Name type="string">胃炎</Disease_Name>
<Disease_Single type="array">
<Disease_Single_child type="record">
<Disease_Single_Code type="string">8830417</Disease_Single_Code>
<Disease_Single_Name type="string">胃炎</Disease_Single_Name>
</Disease_Single_child>
</Disease_Single>
<Disease_Category type="string">PD</Disease_Category>
<Disease_StartDate type="string">2012-05-04</Disease_StartDate>
<Disease_EndDate type="string">2012-09-04</Disease_EndDate>
<Disease_OutCome type="string">F</Disease_OutCome>
<Disease_Class type="string">05</Disease_Class>
<Disease_Receipt_Print type="string">1</Disease_Receipt_Print>
<Insurance_Disease type="string">False</Insurance_Disease>
</Disease_Information_child>
<Disease_Information_child type="record">
<Disease_InOut type="string">I</Disease_InOut>
<Department_Code type="string">01</Department_Code>
<Insurance_Combination_Number type="string">0002</Insurance_Combination_Number>
<Disease_Name type="string">急性くも膜下出血の疑い</Disease_Name>
<Disease_Single type="array">
<Disease_Single_child type="record">
<Disease_Single_Code type="string">ZZZ4012</Disease_Single_Code>
<Disease_Single_Name type="string">急性</Disease_Single_Name>
</Disease_Single_child>
<Disease_Single_child type="record">
<Disease_Single_Code type="string">4309001</Disease_Single_Code>
<Disease_Single_Name type="string">くも膜下出血</Disease_Single_Name>
</Disease_Single_child>
<Disease_Single_child type="record">
<Disease_Single_Code type="string">ZZZ8002</Disease_Single_Code>
<Disease_Single_Name type="string">の疑い</Disease_Single_Name>
</Disease_Single_child>
</Disease_Single>
<Disease_SuspectedFlag type="string">SA</Disease_SuspectedFlag>
<Disease_StartDate type="string">2012-05-06</Disease_StartDate>
<Disease_EndDate type="string">2012-09-04</Disease_EndDate>
<Disease_OutCome type="string">F</Disease_OutCome>
<Disease_Class type="string">05</Disease_Class>
<Insurance_Disease type="string">False</Insurance_Disease>
<Classification_Number_Servant type="string">02</Classification_Number_Servant>
<Discharge_Certificate type="string">1</Discharge_Certificate>
</Disease_Information_child>
</Disease_Information>
</disease_infores>
</xmlio2>

リクエスト一覧

番号項目名内容備考
1Patient_ID患者番号00012必須
2Base_Date基準月2012-05未設定時はシステム日付を設定
3Select_Mode
転帰済選択区分All追加
(2016-09-26)

レスポンス一覧

番号項目名内容備考
1Information_Date実施日2012-05-29
 
2Information_Time実施時間17:11:59 
3Api_Result結果コード(ゼロ以外エラー)00 
4Api_Result_Messageエラーメッセージ処理終了 
5Reskey Medical Info 
6Information_Overflow病名情報オーバーフラグ
(True:返却対象の病名が200件を越えている)
False
追加
(2016-09-26)
7
Disease_Infores患者病名情報  
7-1Patient_ID患者番号00012 
7-2WholeName患者氏名日医 太郎 
7-3WholeName_inKana患者カナ氏名ニチイ タロウ 
7-4BirthDate生年月日1975-01-01 
7-5Sex性別
(1:男性、2:女性)
1 
8
Base_Date基準月2012-05 
9
Disease_Information病名情報(繰り返し 200)  
9-1Disease_InOut入外区分
(I:入院、O:入院外)
I
 
9-2Department_Code診療科コード ※1
(01:内科)
01 
9-3Insurance_Combination_Number保険組合せ番号0002 
9-4
Third_Party_Mark
第三者行為区分
(True:対象の保険組合せが第三者行為である)
True
追加(2019-07-29)
9-5Disease_Name病名急性くも膜下出血の疑い
 
9-6Disease_Single単独病名情報(繰り返し 21)  
9-6-1Disease_Single_Code病名コード4309001
 
9-6-2Disease_Single_Name単独病名くも膜下出血
 
9-6-3Disease_Single_Condition単独病名状態
(空白:通常、1:削除、2:廃止(実施日時点での))
  
9-7Disease_Category主病フラグ(PD:主病名)PD 
9-8Disease_SuspectedFlag疑い、急性フラグ
(S:疑い、A:急性、SA:急性かつ疑い)
SA 
9-9Disease_StartDate病名開始日2012-05-06
 
9-10Disease_EndDate転帰日2012-09-04
 
9-11Disease_OutCome転帰フラグ
(F:治癒、D:死亡、C:中止、S:移行)
F 
9-12Disease_Supplement_Name補足コメント  
9-13
Disease_Supplement_Single
単独補足コメント欄(繰り返し 3)
 追加
(2017-05-25)
9-13-1Disease_Supplement_Single_Code
単独補足コメントコード
 追加
(2017-05-25)
9-13-2

Disease_Supplement_Single_Name

単独補足コメント名称
 追加
(2017-05-25)
9-14Disease_Karte_Nameカルテ病名  
9-15Disease_Class疾患区分
(03:皮膚科特定疾患指導管理料(1)、
04:皮膚科特定疾患指導管理料(2)、
05:特定疾患療養管理料、
07:てんかん指導料、
08:特定疾患療養管理料又はてんかん指導料、
09:難病外来指導管理料)
05 
9-16Disease_Receipt_Printレセプト表示有無(1:表示しない、空白:表示する)1 
9-17Disease_Receipt_Print_Periodレセプト表示期間  
9-18Insurance_Disease保険病名
(True:保険病名である、False:以外)
False
 
9-19 Classification_Number_Mater
分類番号(主)
 追加(2016-04-18)
※2
9-20
Classification_Number_Servant
分類番号(従)
 追加(2016-04-18)
※2
9-21
Discharge_Certificate
退院証明書
(返却値なしまたは0:記載しない、
1:記載する)
1
追加(2019-05-28)

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

※2:分類番号(主)と(従)が同一数字(数字2桁)である場合は結合を示します。

 

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_disease_info_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/diseasegetv2?class=01")
# class :01 患者病名情報取得
#
#
BODY = <<EOF
<data>
<disease_inforeq type="record">
<Patient_ID type="string">44444</Patient_ID>
<Base_Date type="string">2012-06-12</Base_Date>
</disease_inforeq>
</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_disease_info_v2.cs

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

namespace DiseaseInfo
{
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/diseasegetv2?class=01";

/*
class :01

1.患者番号 Patient_ID (REQUIRED)
2.基準月 Base_Date (IMPLIED)

REQUIRED : 必須 IMPLIED : 任意
*/

string BODY = @"
<data>
<disease_inforeq type=""record"">
<Patient_ID type=""string"">44444</Patient_ID>
<Base_Date type=""string"">2012-06-12</Base_Date>
</disease_inforeq>
</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);
        }
        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();
      }
    }
  }
}

 

 

エラーメッセージ一覧

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