Hallo. Wir hatten früher auch perimed. Ich fand die Bögen aber nicht so gut und für uns Kinderchirurgen nicht passend genug.
Wir hatten das Aufrufen der Bögen mit diesem Skript durchgeführt:
property theUsername : "NUTZER"
property theUserpassword : "PASSWORT"
property theTempPath : "~/perimedfav.txt"
-- Favoritenliste abrufen
set theCurlCommand to ("curl --trace ~/trace.txt -X GET -u " & theUsername & ":" & theUserpassword & " " & (ASCII character 34) & "
https://www.perimed.de/portal/api/v1/meinaccount/favorit" & (ASCII character 34) & " -H " & (ASCII character 34) & "accept: application/json" & (ASCII character 34))
-- Fehlerhandling einbauen
set theCurlFav to do shell script theCurlCommand
--display dialog theCurlFav
--in Liste umwandeln
set myFavList to my theSplit(theCurlFav, "},{")
on theSplit(theString, theDelimiter)
-- save delimiters to restore old settings
set oldDelimiters to AppleScript's text item delimiters
-- set delimiters to delimiter to be used
set AppleScript's text item delimiters to theDelimiter
-- create the array
set theArray to every text item of theString
-- restore the old setting
set AppleScript's text item delimiters to oldDelimiters
-- return the result
return theArray
end theSplit
set mydialoglist to ""
--Zeichenkette für Auswahlliste basteln
repeat with theItem in myFavList
-- Position von id im String ermitteln
set hereistheid to (offset of "id" in theItem) + (4)
-- Anfangsposition von name im String ermitteln
set hereisthename to (offset of "name" in theItem) - (3)
-- Endosition von name im String ermitteln
set hereisthename1 to (offset of "name" in theItem) + (7)
-- Position von bogenCode im String ermitteln
set hereisthebogencode to (offset of "bogenCode" in theItem) - (4)
-- String mit Untersuchungsbeschreibung erstellen
set theProceduredesc to characters hereistheid through hereisthename of theItem as string
-- String mit Bogenid erstellen
set theDocumentid to characters hereisthename1 through hereisthebogencode of theItem as string
-- Auswahlstring erstellen mit § als späteres Trennzeichen
set mydialoglist to mydialoglist & theDocumentid & " # " & theProceduredesc & "§"
end repeat
--display dialog mydialoglist
-- entfernt die letzten Zeichen
set thedialog to (text items 1 thru -2 of mydialoglist) as string
--display dialog für Testzwecke
--display dialog thedialog with title "thedialog"
--verzweifelte Versuche die Zeilenümbrüche zu entfernen
set newdialog to do shell script "echo " & quoted form of thedialog & " | sed -e 's/x5cx72//g'"
set newdialog1 to do shell script "echo " & quoted form of newdialog & " | sed -e 's/x0d/ /g'"
set AppleScript's text item delimiters to {return & linefeed, return, linefeed, character id 8233, character id 8232}
set newText to text items of newdialog1
set AppleScript's text item delimiters to {" "}
set newText to newText as text
--display dialog newText with title "newtext neu"
-- Umwandeln des einzelnen Strings mit allen Favoriten in eine Liste
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to "§"
set myList to every text item of newText
set AppleScript's text item delimiters to oldDelimiters
get myList
-- Favoritenliste alphabetisch sortieren
set sortList to simple_sort(myList)
on simple_sort(my_list)
set the index_list to {}
set the sorted_list to {}
repeat (the number of items in my_list) times
set the low_item to ""
repeat with i from 1 to (number of items in my_list)
if i is not in the index_list then
set this_item to item i of my_list as text
if the low_item is "" then
set the low_item to this_item
set the low_item_index to i
else if this_item comes before the low_item then
set the low_item to this_item
set the low_item_index to i
end if
end if
end repeat
set the end of sorted_list to the low_item
set the end of the index_list to the low_item_index
end repeat
return the sorted_list
end simple_sort
-- Auswahldialog anzeigen
set theSelection to (choose from list sortList with title "Aufklärungsbogen auswählen:" with prompt "Bitte auswählen:")
if (theSelection is equal to "false") then display dialog "Kein Bogen ausgewählt"
--display dialog theFile with title "thefile"
-- suche Trennzeichen # in Auswahlstring
set position to (offset of " # " in theSelection) + (3)
-- macht string daraus - weshalb?
set docnumberstring to theSelection as string
-- ermittelt Länge
set theLength to count of docnumberstring
--set myselectionnumber to (characters posminus thru -2 of theFile) as string
set documentnumber to text position through -1 of docnumberstring as string
-- Befüllen der Felder
set theversichertennummer to ""
if ("$[patient_versichertenstatus]$" is equal to "gesetzlich") then
set theversichertennummer to "$[kbvVersnr]$"
end if
if ("$[patient_versichertenstatus]$" is equal to "privat") then
set theversichertennummer to "$[pversnr]$"
end if
--display dialog "zu benachrichtende(r) Angehörige(r):" default answer " "
--set dialogInfo to result
--set selectedButton to button returned of dialogInfo
--get selectedButton
set theAng to ""
--set theAng to text returned of dialogInfo
-- Verwandschaftsgrad
set theRel to ""
--set theRel to choose from list {"Vater", "Mutter", "Sohn", "Tochter", "Onkel", "Tante"} with title "Verwandschaftsgrad" with prompt "Bitte auswählen:"
--Telefonnummer Angehöriger
--display dialog "Telefonnummer Angehörige(r):" default answer " "
--set dialogInfo to result
--set selectedButton to button returned of dialogInfo
--get selectedButton
set theTel to ""
--set theTel to text returned of dialogInfo
--Mail Angehöriger
--display dialog "E-Mail Angehörige(r):" default answer " "
--set dialogInfo to result
--set selectedButton to button returned of dialogInfo
--get selectedButton
set theEmail to ""
--set theEmail to text returned of dialogInfo
--Anmerkungen
--display dialog "Anmerkungen" default answer " "
--set dialogInfo to result
--set selectedButton to button returned of dialogInfo
--get selectedButton
set theComment to "$[x RISK inf _ aq JJ NNNN NNNN invTime U 0]$"
--set theComment to text returned of dialogInfo
--todo Fallnummer
-- todo Logik für Versichertennummer,
set JSONString to ("curl -o ~/perimed.pdf -X POST -u " & theUsername & ":" & theUserpassword & " " & (ASCII character 34) & "
https://www.perimed.de/portal/api/v1/onlinedruck/" & documentnumber & "/drucken" & (ASCII character 34) & " -H " & (ASCII character 34) & "accept: application/pdf" & (ASCII character 34) & " -H " & (ASCII character 34) & "Content-Type: application/json" & (ASCII character 34) & " -d " & (ASCII character 34) & "{ " & (ASCII character 92) & (ASCII character 34) & "vorname" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[patient_vorname]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "nachname" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[patient_name]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "geburtsdatum" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[d G yyyy-MM-dd]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "krankenkasse" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[kasse_name]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "kassenNummer" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[kasse_ik]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "versichertenNummer" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & theversichertennummer & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "status" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[kasse_status]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "betriebsstaettenNummer" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[bsnr]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "arztNummer" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[lanr]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "fallNummer" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "patientenNummer" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[pid]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "behandlungsDatum" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & "$[d S yyyy-MM-dd]$" & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "angehoeriger" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & theAng & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "angehoerigerVerwandschaftsgrad" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & theRel & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "angehoerigerTelefon" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & theTel & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "angehoerigerEmail" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & theEmail & (ASCII character 92) & (ASCII character 34) & ", " & (ASCII character 92) & (ASCII character 34) & "anmerkungen" & (ASCII character 92) & (ASCII character 34) & ": " & (ASCII character 92) & (ASCII character 34) & theComment & (ASCII character 92) & (ASCII character 34) & "}" & (ASCII character 34))
--display dialog JSONString
set ret to do shell script JSONString
--display dialog ret
set ret to do shell script "lpr -o InputSlot=Tray3 -o media=a4 -o sides=two-sided-long-edge ~/perimed.pdf"
--display dialog ret
--display dialog ret