[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[orca-tech:01879] PHP ORCA API 利用して受付リストを取得
- To: orca-tech@xxxxxxxxxxxxxx
- Subject: [orca-tech:01879] PHP ORCA API 利用して受付リストを取得
- From: koji yuen <koji.yuen@xxxxxxxxx>
- Date: Sun, 16 Mar 2014 00:02:53 +0900 (JST)
- Priority: normal
phpからOrca4.70のAPIを利用するVBAプログラムをつくってみました
今回は受付リスト取得のPOSTメソッドによるプログラムです。
バグやプログラムに対するアドバイスお聞かせください。
ゆうえん医院@岡山
----------------------(ukelistv2.html)------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>受付リスト</title>
</head>
<body>
<form action="ukelistv2.php" method="post">
ORCA受付リスト検索
<br />
<br />
検索日付:
<input type="text" name="sdate" size="30" value="" />
<br />
診療科コード:
<input type="text" name="ska" size="30" value="" />
<br />
ドクターID:
<input type="text" name="sdr" size="30" value="" />
<br />
<input type="submit" value="検索する" />
<br />
</body>
</html>
-------------------------------------------------------------------------
----------------------(ukelistv2.php)-----------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>患者受付</title>
</head>
<?php
#患者IDを入力フォームより取得
$sdate=$_POST["sdate"] ;
#診療科コードを入力フォームより取得
$ska=$_POST["ska"] ;
#ドクターIDを入力フォームより取得
$sdr=$_POST["sdr"] ;
#orcaのユーザー、パスワード、ホスト情報
$user = "ormaster";
$password = "123ormaster";
$host="192.168.0.10"; #ORCAサーバーのアドレス
#本日の日付
$ty = date("Y");
$tm = date("m");
$td = date("d");
$kyo = date("Y") . "-" . date("m") . "-" . date("d");
#検索日付指定しない場合は本日の日付を設定
if ($sdate == "" ) {
$sdate = $kyo;
}
$tmpfile="ukelist.xml";
#POSTリクエストするURL
$url = "http://" . $user . ":" . $password . "@" . $host . ":8000/api01rv2/acc
eptlstv2?class=03";
#POSTするデータを設定
$param ='
<data>
<acceptlstreq type="record">
<Acceptance_Date type="string">' . $sdate . '</Acceptance_Date>
<Department_Code type="string">' . $ska . '</Department_Code>
<Physician_Code type="string">' . $sdr . '</Physician_Code>
<Medical_Information type="string"></Medical_Information>
</acceptlstreq>
</data>
';
$fp = fopen($tmpfile, "w");
#セッションの初期化
$ch = curl_init();
//リクエストを送るURL
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POST, 1);
//ヘッダーの出力無し
curl_setopt( $ch, CURLOPT_HEADER, 0 );
//POSTするデータ
curl_setopt( $ch, CURLOPT_POSTFIELDS, $param );
//結果をファイルで受け取る
curl_setopt($ch, CURLOPT_FILE, $fp);
//リクエスト送信
curl_exec( $ch );
//セッションを終了
curl_close( $ch );
fclose($fp);
$xml = simplexml_load_file($tmpfile);
foreach($xml->acceptlstres->Api_Result as $apirs)
if($apirs == "00"){
echo "受付 ( ". $sdate . " )" . "<br />";
print("<table border=1>");
echo "<td>番号<td>患者番号<td>患者氏名<td>カナシメイ<td>年齢<td>性別<td>診療科
<td>診療内容<td>受付時刻<td>会計時間<td>主保険<td>公費1<tr/>";
$ia=0;
do {
$ib=$ia+1;
echo "<td>" . $ib . "<td>";
#患者ID
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Patient_Information->Patient_ID as $patid) {
echo $patid . "<td>";
}
#氏名
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Patient_Information->WholeName as $name) {
echo $name . "<td>";
}
#カナシメイ
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Patient_Information->WholeName_inKana as $kananame) {
echo $kananame . "<td>";
}
#年齢
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Patient_Information->BirthDate as $birthday) {
echo calc_age( $birthday ) . "<td>";
}
#性別
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Patient_Information->Sex as $sex) {
if( $sex == 1){
echo "男" . "<td>";
}elseif( $sex == 2){
echo "女" . "<td>";
}
break;
}
#診療科
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Department_WholeName as $shinryouka) {
echo $shinryouka . "<td>";
}
#診療種別
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Medical_Information as $syubetu) {
echo $syubetu . "<td>";
}
#受付時間
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Acceptance_Time as $uketuke) {
echo $uketuke . "<td>";
}
#会計時間
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->Account_Time as $kaikei) {
echo $kaikei . "<td>";
}
#主保険
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->HealthInsurance_Information->InsuranceProvider_WholeName as $hoken) {
echo $hoken . "<td>";
}
#公費
foreach ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chi
ld[$ia]->HealthInsurance_Information->PublicInsurance_Information->PublicInsur
ance_Information_child->PublicInsurance_Name as $kouhi) {
echo $kouhi ;
}
echo "<tr/>";
$ia++;
} while ($xml->acceptlstres->Acceptlst_Information->Acceptlst_Information_chil
d[$ia]->Patient_Information->Patient_ID != "");
print("</table>");
}else{
foreach($xml->acceptlstres->Api_Result_Message as $apimes)
{
echo $apimes . "(" . $sdate . ")" . "<br />";
}
}
# 年齢を計算する関数
function calc_age( $birthday )
{
$by = mb_substr( $birthday, 0, 4 );
$bm = mb_substr( $birthday, 5, 2 );
$bd = mb_substr( $birthday, 8, 2 );
$ty = date("Y");
$tm = date("m");
$td = date("d");
$age = $ty - $by;
if($tm * 100 + $td < $bm * 100 + $bd) $age--;
return $age;
}
?>
-----------------------------------------------------------------------