%s %s %s %s 関連内用薬剤 上位%s位",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['target'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[0]); $result = $db->Execute($sql_arr[1]); $result = $db->Execute($sql_arr[2]); $result = $db->QueryEx($sql_arr[3]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,"; $csv_header .= "処方日数_合計,処方日数_病院,処方日数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); $rank = 0; while ($result) { $rank += 1; $ret .= ""; $med_name = convert_sjis($result['BrandName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$med_name.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名".$disp_arr['internaltitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$med_name."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////注射開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_medlist2.csv"; $csvname = $_SESSION['LOGINID']."_dis_medlist2.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s 関連注射薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['target'],LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download2','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[6]); $result = $db->Execute($sql_arr[7]); $result = $db->Execute($sql_arr[4]); $result = $db->Execute($sql_arr[8]); $result = $db->QueryEx($sql_arr[3]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,"; $csv_header .= "処方回数_合計,処方回数_病院,処方回数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); $rank = 0; while ($result) { $rank += 1; $ret .= ""; $med_name = convert_sjis($result['BrandName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$med_name.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名".$disp_arr['injectiontitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$med_name."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////内用開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_medlist3.csv"; $csvname = $_SESSION['LOGINID']."_dis_medlist3.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s 関連外用薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['target'],LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download3','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[6]); $result = $db->Execute($sql_arr[7]); $result = $db->Execute($sql_arr[5]); $result = $db->Execute($sql_arr[8]); $result = $db->QueryEx($sql_arr[3]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,"; $csv_header .= "処方回数_合計,処方回数_病院,処方回数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); $rank = 0; while ($result) { $rank += 1; $ret .= ""; $med_name = convert_sjis($result['BrandName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$med_name.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名".$disp_arr['externaltitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$med_name."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); $ret .= ''; $ret .= get_button_img('back','前のページに戻る'); $ret .= ''; break; case 'dis_agespan.php': $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_agespan.csv"; $csvname = $_SESSION['LOGINID']."_dis_agespan.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $sql_arr = get_dis_sql('dis_agespan',$_SESSION['PERIOD']); $ret .= sprintf( "

%s %s %s %s %s %s

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['icd10'],$disp_arr['icdname'],$disp_arr['pattype']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $ret .= ''; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "年齢層,"; $csv_header .= $disp_arr['pattype']."人数_合計,".$disp_arr['pattype']."人数_病院,".$disp_arr['pattype']."人数_診療所\n"; fwrite($fp, $csv_header); $result = $db->Execute($sql_arr[0]); $result = $db->QueryEx($sql_arr[1]); $age_span = 0; while ($result) { $data_agespan = $result['AgeClass']-1; if( $data_agespan>14 ){ break; } for( $i = $age_span ; $i < $data_agespan ; $i++ ){ $disp_agespan = sprintf("%02d 〜 %02d 歳",$i*5,$i*5+4); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $age_span += 1; } $disp_agespan = sprintf("%02d 〜 %02d 歳",$data_agespan*5,$data_agespan*5+4); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $disp_agespan.","; $csv_data .= sprintf("%d,",$result['t_pat']); $csv_data .= sprintf("%d,",$result['hp_pat']); $csv_data .= sprintf("%d\n",$result['gp_pat']); fwrite($fp, $csv_data); $result = $db->QueryEx(); $age_span += 1; } $db->FreeResult(); for( $i = $age_span ; $i < 15 ; $i++ ){ $disp_agespan = sprintf("%02d 〜 %02d 歳",$i*5,$i*5+4); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $age_span += 1; } $ret .= '
年齢層".$disp_arr['patunit']."
合計病院診療所
$disp_agespan".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."
$disp_agespan".get_disp_num($result['t_pat'])."".get_disp_num($result['hp_pat'])."".get_disp_num($result['gp_pat'])."
$disp_agespan".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."

'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); $ret .= ''; $ret .= get_button_img('back','前のページに戻る'); $ret .= ''; $min_pat = 0; if( $_SESSION['DATATYPE'] == "ESTIMATE" ){ $min_pat = ESTIMATE_MIN_PAT; }else{ $min_pat = ACTUAL_MIN_PAT; } if( $_SESSION['CNT'] >= $min_pat ){ $ret .= ''; $ret .= get_button_img('medinfo','薬剤情報はこちら'); $ret .= ''; $ret .= ''; $ret .= get_button_img('discombi','併発情報はこちら'); $ret .= ''; } $ret .= '
'; break; case 'dis_icd_combination.php': $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_combination.csv"; $csvname = $_SESSION['LOGINID']."_dis_combination.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $sql_arr = get_dis_sql('dis_combination',$_SESSION['PERIOD']); $ret .= sprintf( "

%s %s %s %s %s %s

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['icd10'],$disp_arr['icdname'],$disp_arr['pattype']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $sql_arr = get_dis_sql('dis_combination2',$_SESSION['PERIOD']); $result = $db->Execute($sql_arr[0]); $result = $db->QueryEx($sql_arr[1]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ICD10,傷病名,"; $csv_header .= $disp_arr['pattype']."人数_合計,".$disp_arr['pattype']."人数_病院,".$disp_arr['pattype']."人数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $dis_name = convert_sjis($result['ICDName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$result['ICD10'].",".$dis_name.","; $csv_data .= sprintf("%d,",$result['t_pat']); $csv_data .= sprintf("%d,",$result['hp_pat']); $csv_data .= sprintf("%d\n",$result['gp_pat']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ICD10傷病名".$disp_arr['patunit']."
合計病院診療所
$rank"; $ret .= "".$result['ICD10']."".$dis_name."".get_disp_num($result['t_pat'])."".get_disp_num($result['hp_pat'])."".get_disp_num($result['gp_pat'])."

'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); $ret .= ''; $ret .= get_button_img('back','前のページに戻る'); $ret .= '
'; break; case 'dis_combination.php': $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_combination.csv"; $csvname = $_SESSION['LOGINID']."_dis_combination.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $sql_arr = get_dis_sql('dis_combination',$_SESSION['PERIOD']); $ret .= sprintf( "

%s %s %s %s %s

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['target'],$disp_arr['pattype']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $sql_arr = get_dis_sql('dis_combination',$_SESSION['PERIOD']); $result = $db->Execute($sql_arr[0]); $result = $db->QueryEx($sql_arr[1]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ICD10,傷病名,"; $csv_header .= $disp_arr['pattype']."人数_合計,".$disp_arr['pattype']."人数_病院,".$disp_arr['pattype']."人数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $dis_name = convert_sjis($result['ICDName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$result['ICD10'].",".$dis_name.","; $csv_data .= sprintf("%d,",$result['t_pat']); $csv_data .= sprintf("%d,",$result['hp_pat']); $csv_data .= sprintf("%d\n",$result['gp_pat']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ICD10傷病名".$disp_arr['patunit']."
合計病院診療所
$rank"; $ret .= "".$result['ICD10']."".$dis_name."".get_disp_num($result['t_pat'])."".get_disp_num($result['hp_pat'])."".get_disp_num($result['gp_pat'])."

'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); $ret .= ''; $ret .= get_button_img('back','前のページに戻る'); $ret .= '
'; break; case 'dis_icd_medlist.php': $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db); $sql_arr = get_dis_sql('dis_medlist2',$_SESSION['PERIOD']); ///////////////////////////内用開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_medlist1.csv"; $csvname = $_SESSION['LOGINID']."_dis_medlist1.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 関連内用薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['icd10'],$disp_arr['icdname'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[0]); $result = $db->Execute($sql_arr[1]); $result = $db->Execute($sql_arr[2]); $result = $db->QueryEx($sql_arr[3]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,"; $csv_header .= "処方日数_合計,処方日数_病院,処方日数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); $rank = 0; while ($result) { $rank += 1; $ret .= ""; $med_name = convert_sjis($result['BrandName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$med_name.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名".$disp_arr['internaltitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$med_name."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////注射開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_medlist2.csv"; $csvname = $_SESSION['LOGINID']."_dis_medlist2.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 関連注射薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['icd10'],$disp_arr['icdname'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download2','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[6]); $result = $db->Execute($sql_arr[7]); $result = $db->Execute($sql_arr[4]); $result = $db->Execute($sql_arr[8]); $result = $db->QueryEx($sql_arr[3]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,"; $csv_header .= "処方回数_合計,処方回数_病院,処方回数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); $rank = 0; while ($result) { $rank += 1; $ret .= ""; $med_name = convert_sjis($result['BrandName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$med_name.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名".$disp_arr['injectiontitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$med_name."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////内用開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_medlist3.csv"; $csvname = $_SESSION['LOGINID']."_dis_medlist3.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 関連外用薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['icd10'],$disp_arr['icdname'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download3','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[6]); $result = $db->Execute($sql_arr[7]); $result = $db->Execute($sql_arr[5]); $result = $db->Execute($sql_arr[8]); $result = $db->QueryEx($sql_arr[3]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,"; $csv_header .= "処方回数_合計,処方回数_病院,処方回数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); $rank = 0; while ($result) { $rank += 1; $ret .= ""; $med_name = convert_sjis($result['BrandName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$med_name.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名".$disp_arr['externaltitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$med_name."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= ''; $db->Close(); break; case 'dis_detail.php': $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_detail.csv"; $csvname = $_SESSION['LOGINID']."_dis_detail.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $ret .= sprintf( "

%s %s %s %s %s

",$disp_arr['period'],$disp_arr['datatype'],$disp_arr['visittype'],$disp_arr['target'],$disp_arr['pattype']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $ret .= ''; $ret .= ''; $ret .= ''; $sql_arr = get_dis_sql('dis_detail',$_SESSION['PERIOD']); $result = $db->Execute($sql_arr[0]); $db->FreeResult(); $result = $db->QueryEx($sql_arr[1]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "ICD10,傷病名,"; $csv_header .= $disp_arr['pattype']."人数_合計,".$disp_arr['pattype']."人数_病院,".$disp_arr['pattype']."人数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $ret .= ""; $ret .= ""; $dis_name = convert_sjis($result['ICDName']); $ret .= ''; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $result['ICD10'].",".$dis_name.","; $csv_data .= sprintf("%d,",$result['t_pat']); $csv_data .= sprintf("%d,",$result['hp_pat']); $csv_data .= sprintf("%d\n",$result['gp_pat']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
ICD10傷病名".$disp_arr['patunit']."
合計病院診療所
".$result['ICD10']."".get_disp_num($result['t_pat'])."".get_disp_num($result['hp_pat'])."".get_disp_num($result['gp_pat'])."

'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= ''; $ret .= ''; $ret .= get_button_img('medinfo','薬剤情報はこちら'); $ret .= ''; $ret .= ''; $ret .= get_button_img('discombi','併発情報はこちら'); $ret .= '
'; break; case 'dis_result.php': $csvfile = CSV_DIR.$_SESSION['LOGINID']."_dis_result.csv"; $csvname = $_SESSION['LOGINID']."_dis_result.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $db = new DB(); $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $ret .= sprintf( "

%s %s %s %s

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['listtype']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ''; $sql_arr = get_dis_sql('dis_result',$_SESSION['PERIOD']); $result = $db->QueryEx($sql_arr[0]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "ICD10,傷病名,"; $csv_header .= "患者人数_合計,患者人数_病院,患者人数_診療所,"; $csv_header .= "新患人数_合計,新患人数_病院,新患人数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $dis_icd = mb_convert_encoding($result['ICD'],"SJIS","UTF-8"); $ret .= ''; $dis_name = mb_convert_encoding($result['119Name'],"SJIS","UTF-8"); $ret .= ''; $t_pat = get_disp_num($result['T_PAT']); $hp_pat = get_disp_num($result['HP_PAT']); $gp_pat = get_disp_num($result['GP_PAT']); $t_new_pat = get_disp_num($result['T_NEW_PAT']); $hp_new_pat = get_disp_num($result['HP_NEW_PAT']); $gp_new_pat = get_disp_num($result['GP_NEW_PAT']); $ret .= ''; $ret .= ''; $ret .= ''; $ret .= ''; $ret .= ''; $ret .= ''; $csv_data = str_replace('
','',$dis_icd).",".$dis_name.","; $csv_data .= sprintf("%d,",$result['T_PAT']); $csv_data .= sprintf("%d,",$result['HP_PAT']); $csv_data .= sprintf("%d,",$result['GP_PAT']); $csv_data .= sprintf("%d,",$result['T_NEW_PAT']); $csv_data .= sprintf("%d,",$result['HP_NEW_PAT']); $csv_data .= sprintf("%d\n",$result['GP_NEW_PAT']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
ICD10傷病名".$disp_arr['pattitle']."".$disp_arr['newpattitle']."
合計病院診療所合計病院診療所
'.$dis_icd.''.$dis_name.''.$hp_pat.''.$gp_pat.''.$hp_new_pat.''.$gp_new_pat.'
'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); break; case 'med_agespan.php': $db = new DB(); $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_agespan.csv"; $csvname = $_SESSION['LOGINID']."_med_agespan.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $sql_arr = get_med_sql('med_agespan',$_SESSION['PERIOD']); $ret .= sprintf( "

%s %s %s %s %s 処方年齢層(5歳区切り)

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->QueryEx($sql_arr[0]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "年齢層,"; $csv_header .= $disp_arr['csv_freq']."_合計,".$disp_arr['csv_freq']."_病院,".$disp_arr['csv_freq']."_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_診療所,レセプト件数_病院\n"; fwrite($fp, $csv_header); $age_span = 0; while ($result) { $data_agespan = $result['AgeClass']-1; if( $data_agespan>14 ){ break; } for( $i = $age_span ; $i < $data_agespan ; $i++ ){ $disp_agespan = sprintf("%02d 〜 %02d 歳",$i*5,$i*5+4); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $age_span += 1; $csv_data = $disp_agespan.",0.0,0.0,0.0,0.0,0.0,0.0\n"; fwrite($fp, $csv_data); } $disp_agespan = sprintf("%02d 〜 %02d 歳",$data_agespan*5,$data_agespan*5+4); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $disp_agespan.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); $age_span += 1; } $db->FreeResult(); for( $i = $age_span ; $i < 15 ; $i++ ){ $disp_agespan = sprintf("%02d 〜 %02d 歳",$i*5,$i*5+4); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $age_span += 1; $csv_data = $disp_agespan.",0.0,0.0,0.0,0.0,0.0,0.0\n"; fwrite($fp, $csv_data); } $ret .= '
年齢層".$disp_arr['freq']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$disp_agespan".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."
$disp_agespan".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."
$disp_agespan".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."".get_disp_num(0)."

'; $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= '
'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); break; case 'med_specific.php': $db = new DB(); $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_specific1.csv"; $csvname = $_SESSION['LOGINID']."_med_specific1.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db); $sql_arr = get_med_sql('med_specific',$_SESSION['PERIOD']); ///////////////////////////////////////////Make Freq. List Start $ret .= sprintf( "

%s %s %s %s %s %s分布

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['medname'],$disp_arr['csv_freq']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[0]); $result = $db->QueryEx($sql_arr[1]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = $disp_arr['csv_freq']; $csv_header .= ",処方頻度_合計,処方頻度_病院,処方頻度_診療所\n"; fwrite($fp, $csv_header); while ($result) { $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = sprintf("%d,",$result['Freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $ret .= '
".$disp_arr['csv_freq']."".$disp_arr['cnttitle']."
合計病院診療所
".$result['Freq']."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."


'; $db->FreeResult(); flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////////////////////Make Freq. List End ///////////////////////////////////////////Make Qt. List Start $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_specific2.csv"; $csvname = $_SESSION['LOGINID']."_med_specific2.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 規格単位「%s」 処方量分布

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['medname'],$disp_arr['specunit']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download2','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->QueryEx($sql_arr[2]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "処方量,処方頻度_合計,処方頻度_病院,処方頻度_診療所\n"; fwrite($fp, $csv_header); while ($result) { $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = sprintf("%f,",$result['Qt']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $ret .= '
処方量".$disp_arr['cnttitle']."
合計病院診療所
".$result['Qt']."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; $db->FreeResult(); ///////////////////////////////////////////Make Qt. List End $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= '
'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); break; case 'med_combination.php': $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db); $sql_arr = get_med_sql('med_combination',$_SESSION['PERIOD']); ///////////////////////////内用開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_combination1.csv"; $csvname = $_SESSION['LOGINID']."_med_combination1.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 内用併用薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[0]); $result = $db->Execute($sql_arr[1]); $result = $db->Execute($sql_arr[2]); $result = $db->QueryEx($sql_arr[3]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,一般名,"; $csv_header .= "処方日数_合計,処方日数_病院,処方日数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $brand_name = convert_sjis($result['BrandName']); $ret .= ""; $generic_abbr = convert_sjis($result['GenericAbbr']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$brand_name.",".$generic_abbr.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名一般名".$disp_arr['internaltitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$brand_name."".$generic_abbr."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////内用終了 ///////////////////////////注射開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_combination2.csv"; $csvname = $_SESSION['LOGINID']."_med_combination2.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 注射併用薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download2','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[6]); $result = $db->Execute($sql_arr[7]); $result = $db->Execute($sql_arr[4]); $result = $db->Execute($sql_arr[8]); $result = $db->QueryEx($sql_arr[3]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,一般名,"; $csv_header .= "処方回数_合計,処方回数_病院,処方回数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $brand_name = convert_sjis($result['BrandName']); $ret .= ""; $generic_abbr = convert_sjis($result['GenericAbbr']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$brand_name.",".$generic_abbr.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名一般名".$disp_arr['injectiontitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$brand_name."".$generic_abbr."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////注射終了 ///////////////////////////外用開始 $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_combination3.csv"; $csvname = $_SESSION['LOGINID']."_med_combination3.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 外用併用薬剤 上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target'], LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download3','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[6]); $result = $db->Execute($sql_arr[7]); $result = $db->Execute($sql_arr[5]); $result = $db->Execute($sql_arr[8]); $result = $db->QueryEx($sql_arr[3]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,一般名,"; $csv_header .= "処方回数_合計,処方回数_病院,処方回数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $brand_name = convert_sjis($result['BrandName']); $ret .= ""; $generic_abbr = convert_sjis($result['GenericAbbr']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$brand_name.",".$generic_abbr.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名一般名".$disp_arr['externaltitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$brand_name."".$generic_abbr."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////外用終了 $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= ''; $db->Close(); break; case 'med_dislist.php': $db = new DB(); $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_dislist.csv"; $csvname = $_SESSION['LOGINID']."_med_dislist.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db); $sql_arr = get_med_sql('med_dislist',$_SESSION['PERIOD']); ///////////////////////////////////////////Make Disease List Start $ret .= sprintf( "

%s %s %s %s %s 関連傷病上位%s位

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target'],LISTRANK); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $ret .= ''; $result = $db->Execute($sql_arr[0]); $result = $db->Execute($sql_arr[1]); $result = $db->Execute($sql_arr[2]); $result = $db->Execute($sql_arr[3]); $result = $db->Execute($sql_arr[4]); $result = $db->QueryEx($sql_arr[5]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ICD10,傷病名,"; $csv_header .= "患者人数_合計,患者人数_病院,患者人数_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $ret .= ""; $dis_name = convert_sjis($result['ICDName']); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$result['ICD10'].",".$dis_name.","; $csv_data .= sprintf("%d,",$result['t_pat']); $csv_data .= sprintf("%d,",$result['hp_pat']); $csv_data .= sprintf("%d,",$result['gp_pat']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ICD10傷病名".$disp_arr['pattitle']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank".$result['ICD10']."".$dis_name."".get_disp_num($result['t_pat'])."".get_disp_num($result['hp_pat'])."".get_disp_num($result['gp_pat'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; ///////////////////////////////////////////Make Disease List End $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= '
'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); break; case 'med_detail.php': $db = new DB(); ///対象名称取得 $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); ///////////////////////////////////////////Make Graph Start $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_detail1.csv"; $csvname = $_SESSION['LOGINID']."_med_detail1.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); if( $_SESSION['PERIOD'] > 9999 ){ $sql = sprintf("SELECT * FROM M_Period WHERE PeriodID<=%s ORDER BY PeriodID DESC LIMIT 12 ",$_SESSION['PERIOD']); } else { $sql = sprintf("SELECT * FROM M_Period WHERE PeriodID<=%s ORDER BY PeriodID DESC LIMIT 12 ",strval($_SESSION['PERIOD']+1)."03"); } $result = $db->QueryEx( $sql ); $monthly_periodid = array(); $monthly_dispperiod = array(); $monthly_csvperiod = array(); $monthly_freq = array(); $max_freq = 0; $db2 = new DB(); while ( $result ) { $monthly_periodid[] = $result['PeriodID']; $monthly_csvperiod[] = convert_sjis($result['DispPeriod']); $monthly_dispperiod[] = sprintf("%s/%s",substr($result['PeriodID'],2,2),substr($result['PeriodID'],4,2)); $sql_arr = get_med_sql('med_detail1',$result['PeriodID']); $ret = $db2->QueryEx($sql_arr[0]); while ($ret) { $monthly_freq[] = $ret['t_freq']; if( $max_freq < $ret['t_freq'] ){ $max_freq = $ret['t_freq']; } $ret = $db2->QueryEx(); } $db2->FreeResult(); $result = $db->QueryEx(); } $db->FreeResult(); $db2->Close(); $ret .= sprintf( "

%s %s %s %s %s %s月次推移グラフ%s

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target'],$disp_arr['csv_freq'],$disp_arr['graphunit']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= '
'; $csv_header = "年月,".$disp_arr['csv_freq']."\n"; fwrite($fp, $csv_header); $cnt = count($monthly_periodid); $bar_len = 0; $td_num = ''; $td_bar = ''; $td_period = ''; for ($i = $cnt ; $i < 12 ; $i++) { $td_period .= ''; $td_num .= ''; $td_bar .= ''; } for ($i = $cnt-1 ; $i >= 0 ; $i--) { $bar_len = sprintf("%.1f",$monthly_freq[$i]/$max_freq*350); $td_period .= '"; $tmp_freq = get_disp_num($monthly_freq[$i]); $html_freq = ""; for ( $j = 0 ; $j < strlen($tmp_freq) ; $j++ ){ if( $j < strlen($tmp_freq)-1 ){ if( substr($tmp_freq,$j,1)=="," || substr($tmp_freq,$j,1)=="." ){ $html_freq .= '
'.substr($tmp_freq,$j,1).'

'; }else{ $html_freq .= substr($tmp_freq,$j,1).'
'; } }else{ $html_freq .= substr($tmp_freq,$j,1); } } $td_bar.= ""; $td_num .= ''; $csv_data = sprintf("%s,%d\n",$monthly_csvperiod[$i],$monthly_freq[$i]); fwrite($fp, $csv_data); } $td_num .= ""; $td_bar .= ""; $td_period .= ""; ///$ret .= $td_num; $ret .= $td_bar; $ret .= $td_period; $ret .= '
'.$monthly_dispperiod[$i]."
$html_freq
'.$tmp_freq.'


'; flock($fp, LOCK_UN); fclose( $fp ); ///////////////////////////////////////////Make Graph End ///////////////////////////////////////////List a Breakdown Start $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_detail2.csv"; $csvname = $_SESSION['LOGINID']."_med_detail2.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $ret .= sprintf( "

%s %s %s %s %s 内訳

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['medtype'],$disp_arr['target']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download2','CSVダウンロード'); $ret .= '

'; $ret .= "
"; $ret .= ""; $ret .= ""; $ret .= ''; $sql_arr = get_med_sql('med_detail2',$_SESSION['PERIOD']); $result = $db->Execute($sql_arr[0]); $db->FreeResult(); $result = $db->QueryEx($sql_arr[1]); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "医薬品名,レセ後発,販売会社,"; $csv_header .= $disp_arr['csv_freq']."_合計,".$disp_arr['csv_freq']."_病院,".$disp_arr['csv_freq']."_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $ret .= ""; $medicine_name = convert_sjis($result['MedicineName']); $ret .= ""; $geproduct = ""; if( $result['GenericProduct']>0 ){ $geproduct = "○"; $ret .= ""; }else{ $ret .= ""; } $maker = convert_sjis($result['Maker']); $maker = str_replace("\r","",$maker); $maker = str_replace("\n","",$maker); $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $medicine_name.",".$geproduct.",".$maker .","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
医薬品名レセ
後発
販売会社".$disp_arr['freq']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
".$medicine_name." ".$maker."".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."

'; ///////////////////////////////////////////List a Breakdown End flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); $ret .= '';$ret .= get_button_img('back','前のページに戻る'); $ret .= ''; $ret .= ''; $ret .= get_button_img('disinfo','傷病情報はこちら'); $ret .= ''; $ret .= ''; $ret .= get_button_img('medcombi','併用情報はこちら'); $ret .= ''; $ret .= ''; $ret .= get_button_img('agespan','年齢層別情報はこちら'); $ret .= '
'; break; case 'med_result.php': $csvfile = CSV_DIR.$_SESSION['LOGINID']."_med_result.csv"; $csvname = $_SESSION['LOGINID']."_med_result.csv"; $fp = fopen( $csvfile, "w" ); flock($fp, LOCK_EX); $db = new DB(); $disp_arr = get_disp_array( $_SESSION['PERIOD'], $_SESSION['LISTTOP'], $db ); $ret .= sprintf( "

%s %s %s %s %s %s %s

",$disp_arr['period'],$disp_arr['visittype'],$disp_arr['datatype'],$disp_arr['listtype'],$disp_arr['medtype'],$disp_arr['87cd'],$disp_arr['listtop']); $ret .= '
'; $ret .= ''; $ret .= '
'; $ret .= ''; $ret .= get_button_img('download','CSVダウンロード'); $ret .= '

'; $ret .= "
"; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ''; $sql_arr = get_med_sql('med_result',$_SESSION['PERIOD']); $result = $db->Execute($sql_arr[0]); $db->FreeResult(); $result = $db->QueryEx($sql_arr[1]); $rank = 0; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_header = "順位,ブランド名,一般名,"; $csv_header .= $disp_arr['csv_freq']."_合計,".$disp_arr['csv_freq']."_病院,".$disp_arr['csv_freq']."_診療所,"; $csv_header .= "レセプト件数_合計,レセプト件数_病院,レセプト件数_診療所\n"; fwrite($fp, $csv_header); while ($result) { $rank += 1; $ret .= ""; $brand_name = convert_sjis($result['BrandName']); $ret .= ''; $generic_abbr = convert_sjis($result['GenericAbbr']); $ret .= ''; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $csv_data = $rank.",".$brand_name.",".$generic_abbr.","; $csv_data .= sprintf("%d,",$result['t_freq']); $csv_data .= sprintf("%d,",$result['hp_freq']); $csv_data .= sprintf("%d,",$result['gp_freq']); $csv_data .= sprintf("%d,",$result['t_count']); $csv_data .= sprintf("%d,",$result['hp_count']); $csv_data .= sprintf("%d\n",$result['gp_count']); fwrite($fp, $csv_data); $result = $db->QueryEx(); } $db->FreeResult(); $ret .= '
順位ブランド名一般名".$disp_arr['freq']."".$disp_arr['rectitle']."
合計病院診療所合計病院診療所
$rank'.$brand_name.''.$generic_abbr.'".get_disp_num($result['t_freq'])."".get_disp_num($result['hp_freq'])."".get_disp_num($result['gp_freq'])."".get_disp_num($result['t_count'])."".get_disp_num($result['hp_count'])."".get_disp_num($result['gp_count'])."
'; flock($fp, LOCK_UN); fclose( $fp ); $db->Close(); break; default : break; } return $ret; } ?> Output has already been sent to the browser at /var/www/vhosts/jamm-net.com/httpsdocs/webdata/detail_data.php:1763. Please make sure the command $xajax->processRequest() is placed before this.