内視鏡データベース
電子内視鏡画像のファイリングと検査レポート作成を行うデータベースです。
当院で使用している機種では、画像ファイルはフロッピーディスクに、下図のようなフォルダ名、ファイル名で保存されているので、AppleScriptで患者名と日付を組み合わせたフォルダ名、ファイル名に変更します。
また、画像の表示は、Graphic Converterと連携を取って実現しています。

フロッピーディスクをMacにマウントしたらスクリプト・メニューからAppleScriptを実行。

tell application "Finder"
activate
copy folder "IMFIDX11" of disk "Unlabeled" to folder
"ES" of disk "ES&US"
open file "内視鏡データベース" of folder "文書保管用" of disk
"Macintosh HD"
end tell
画像がフォルダごとDVD-RAMにコピーされ、「内視鏡データベース」が起動します。

患者番号、その他必要事項を入力し「フォルダ名生成」ボタンを押すと名称が表示されます。
(カナ氏名からスペースを取り除いたもの)+(作成日YYMMDD形式)です。
検診等で、被験者が患者登録に未登録の場合には、カナ氏名を手入力してから「フォルダ名生成」ボタンを押します。
続いて「フォルダ名コピー」ボタンのスクリプトを実行。
コピー[選択、「保存フォルダ名」]
AppleScriptを実行[*]
* AppleScriptの処理内容は以下の通り
フォルダ名を「保存フォルダ名」フィールドの内容に変更し、ファイル名は「保存フォルダ名」+(001から始まるシリアル番号)+(.jpg)に変更します。
画像ファイルのファイル・クリエータをGraphic Converterのもの(GKON)に変更します。
Graphic Converterを起動して画像フォルダを読み込んで画像ブラウザに一覧表示します。
下図は処理が終わったところ。

AppleScriptのコードは以下の通り
set txt to the clipboard
display dialog "フォルダ名、ファイル名を「" & txt & "」を使った名称に変更します。"
tell application "Finder"
activate
set name of folder "IMFIDX11" of folder "ES" of disk
"ES&US" to txt
set gazousuu to number of file of folder txt of folder "ES"
of disk "ES&US"
if gazousuu < 10 then
repeat with i from 1 to gazousuu
set targetfile to "DSC0000" & i & ".JPG"
set obj to file targetfile of folder txt of folder "ES"
of disk "ES&US"
set Str1 to i as string
set Str1 to text from character 1 to character (3 - (length of Str1))
of "000" & Str1
set creator type of obj to "GKON"
set name of obj to txt & Str1 & ".jpg"
end repeat
open folder txt of folder "ES" of disk "ES&US"
using application file "GraphicConverter.app" of folder "GraphicConverter
Carbon 4.9J" of disk "Macintosh HD"
else
repeat with i from 1 to 9
set targetfile to "DSC0000" & i & ".JPG"
set obj to file targetfile of folder txt of folder "ES"
of disk "ES&US"
set Str1 to i as string
set Str1 to text from character 1 to character (3 - (length of Str1))
of "000" & Str1
set creator type of obj to "GKON"
set name of obj to txt & Str1 & ".jpg"
end repeat
repeat with i from 10 to gazousuu
set targetfile to "DSC000" & i & ".JPG"
set obj to file targetfile of folder txt of folder "ES"
of disk "ES&US"
set Str1 to i as string
set Str1 to text from character 1 to character (3 - (length of Str1))
of "000" & Str1
set creator type of obj to "GKON"
set name of obj to txt & Str1 & ".jpg"
end repeat
end if
open folder txt of folder "ES" of disk "ES&US"
using application file "GraphicConverter.app" of folder "GraphicConverter
Carbon 4.9J" of disk "Macintosh HD"
end tell
2枚目のFD処理用のAppleScriptはこちら。101からのシリアル番号をつけます。
set txt to the clipboard
display dialog "「" & txt & "」フォルダに画像を追加します。"
tell application "Finder"
activate
set gazousuu to number of file of folder "IMFIDX11" of folder
"ES" of disk "ES&US"
if gazousuu < 10 then
repeat with i from 1 to gazousuu
set targetfile to "DSC0000" & i & ".JPG"
set obj to file targetfile of folder "IMFIDX11" of folder
"ES" of disk "ES&US"
set Str1 to i as string
set Str1 to text from character 1 to character (2 - (length of Str1))
of "00" & Str1
set creator type of obj to "GKON"
set name of obj to txt & "1" & Str1 & ".jpg"
end repeat
else
repeat with i from 1 to 9
set targetfile to "DSC0000" & i & ".JPG"
set obj to file targetfile of folder "IMFIDX11" of folder
"ES" of disk "ES&US"
set Str1 to i as string
set Str1 to text from character 1 to character (2 - (length of Str1))
of "00" & Str1
set creator type of obj to "GKON"
set name of obj to txt & "1" & Str1 & ".jpg"
end repeat
repeat with i from 10 to gazousuu
set targetfile to "DSC000" & i & ".JPG"
set obj to file targetfile of folder "IMFIDX11" of folder
"ES" of disk "ES&US"
set Str1 to i as string
set Str1 to text from character 1 to character (2 - (length of Str1))
of "00" & Str1
set creator type of obj to "GKON"
set name of obj to txt & "1" & Str1 & ".jpg"
end repeat
end if
empty trash
move every file of folder "IMFIDX11" of folder "ES"
of disk "ES&US" to folder txt of folder "ES" of
disk "ES&US"
move folder "IMFIDX11" of folder "ES" of disk "ES&US"
to trash
open folder txt of folder "ES" of disk "ES&US" using application file "GraphicConverter.app" of folder "GraphicConverter Carbon 4.9J" of disk "Macintosh HD"
end tell
現在の対象レコードの画像を開くAppleScriptはこちら。
set txt to the clipboard
--display dialog "フォルダ「" & txt & "」を開きます。"
tell application "Finder"
open folder txt of folder "ES" of disk "ES&US"
using application file "GraphicConverter.app" of folder "GraphicConverter
Carbon 4.9J" of disk "Macintosh HD"
end tell
レポートへの挿入画像の選択と印刷指示の画面

時系列表示

下図が検査レポートの印刷イメージです。

HOME TOP↑ ORCAのページのTOP