From: paul Date: Thu, 25 Feb 2016 03:29:07 +0000 (+0000) Subject: support for prescriptions X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=afdc06688cc51a168011da48adbafcba238d3ae1;p=lobster support for prescriptions svn path=/trunk/; revision=81 --- diff --git a/actions/new_prescription.sh b/actions/new_prescription.sh index af99cd0..b777cec 100755 --- a/actions/new_prescription.sh +++ b/actions/new_prescription.sh @@ -17,17 +17,22 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -cgi_post cgi_refdata -client="${_POST[client]}" +client="${_POST[client]:-${_GET[client]}}" uid=$(uuidgenerator) prescription="${client%.vcf}.${uid}.mpx" +cardfile="$_DATA/vcard/$client" tempfile="$_DATA/temp/$prescription" cat >"$tempfile" <. + +BR=' +' +prescription="${_POST[prescription]}" + +tempfile="$_DATA/temp/$prescription" +prescfile="$_DATA/prescriptions/$prescription" +client="${prescription%.*.mpx}.vcf" +clientfile="$_DATA/vcard/$client" + +if [ -z "$prescription" -o \! -f "$clientfile" ]; then + redirect "?p=error" + exit 0 +fi + +# serialize POST array into file +for key in ${(k)_POST}; do + printf %s:%s\\n "$key" "${_POST[$key]//$BR/\\n}" +done >"$tempfile" + +case "${_POST[action]}" in + save) + mv "$tempfile" "$prescfile" + touch "$clientfile" + ;; + cancel) + rm "$tempfile" + ;; + delete) + rm "$tempfile" "$prescfile" + touch "$clientfile" + ;; +esac + +redirect "?p=prescriptions&client=${client}" diff --git a/pages/prescriptions.sh b/pages/prescriptions.sh index b550d78..fbcd506 100755 --- a/pages/prescriptions.sh +++ b/pages/prescriptions.sh @@ -18,14 +18,44 @@ # along with Confetti. If not, see . source "$_EXEC/pages/cards.sh" +declare -A mpx -list_prescriptions(){} +BR=' +' + +list_prescriptions(){ + client="$1" + find "$_DATA/prescriptions/" -name "${client%.vcf}.*.mpx" \ + | while read pfile; do + printf '%s\t%s\n' "$(grep '^date' "$pfile")" "${pfile##*/}" + done \ + | sort -r | cut -f2 +} edit_prescription(){ id="$1" prescfile="$_DATA/prescriptions/$id" tempfile="$_DATA/temp/$id" - [ -f "$tempfile" ] && prescfile="$tempfile" + [ -f "$tempfile" ] || cp "$prescfile" "$tempfile" + + mpx=() + cat "$tempfile" |while read -r line; do + val="${line#*:}" + mpx[${line%%:*}]="${val//\\n/$BR}" + done . "$_EXEC/templates/edit_prescription.sh" } + +view_prescription(){ + id="$1" + prescfile="$_DATA/prescriptions/$id" + + mpx=() + cat "$prescfile" |while read -r line; do + val="${line#*:}" + mpx[${line%%:*}]="${val//\\n/$BR}" + done + + . "$_EXEC/templates/view_prescription.sh" +} diff --git a/templates/attendees.css.sh b/templates/attendees.css.sh index 1544d86..758b1d1 100755 --- a/templates/attendees.css.sh +++ b/templates/attendees.css.sh @@ -102,13 +102,10 @@ cat <. + +check_type(){ + [ "${_GET[filtertype]}" = "$1" ] && echo 'checked="checked"' +} +check_order(){ + [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"' +} + +edit="${_GET[edit]}" +[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit='' +[ -z "${_GET[filtertype]}" ] && _GET[filtertype]="any" +[ -z "${_GET[order]}" ] && _GET[order]="firstname" + +cat < +

$(l10n filter_label)

+ + +
+
+ $(l10n filter_type): + + + + + + +
+
+ $(l10n filter_order): + + + +
+ + + + +
+ +
+ +${edit:+$(edit_card "$edit")} + +$( + listcards |grep ${edit:+-v} "$edit" \ + | while read card; do + cat <<-ENDCARD +
+ $(view_card "$card") +
+ ENDCARD + done +) +EOF + +# vi:set filetype=html: diff --git a/templates/edit_prescription.sh b/templates/edit_prescription.sh index d4dce32..cfd2b5b 100755 --- a/templates/edit_prescription.sh +++ b/templates/edit_prescription.sh @@ -15,58 +15,94 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . +check(){ [ "$1" = "$2" ] && printf checked} + cat < + + +

$(l10n therapy_prescription)

- + +
- + +
- + +
- + +
- - + +

$(l10n prescription_by_catalogue)

- + - +
+ - +
+ - +
+ - +
+ - +
+ - +
+ - +
+ - - +
- + +
+ + +
- + + +
+ + +
+ + +
+ + +
- + +
- + - +
+ +
+ + + END_HTML diff --git a/templates/prescriptions.css.sh b/templates/prescriptions.css.sh index 80e61ea..67b2c89 100755 --- a/templates/prescriptions.css.sh +++ b/templates/prescriptions.css.sh @@ -20,75 +20,189 @@ cat <. -edit="${_GET[edit]}" client="${_GET[client]}" -[ -z "$client" ] && client="${edit%.*.mpx}.vcf" +edit="${_GET[edit]}" +[ -n "$edit" ] && client="${edit%.*.mpx}.vcf" cat <$(view_card "$client") -

$(l10n prescriptions_current)

+ ${edit:+$(edit_prescription "$edit")} -
@@ -36,11 +35,11 @@ ${edit:+$(edit_prescription "$edit")} $(list_prescriptions "$client" \ |while read pre; do - view_prescription "$pre" + [ "$pre" = "$edit" ] || view_prescription "$pre" done ) -

$(l10n prescriptions_past)

+ EOF diff --git a/templates/text_cards.sh b/templates/text_cards.sh index 2e36446..53d8489 100755 --- a/templates/text_cards.sh +++ b/templates/text_cards.sh @@ -65,16 +65,20 @@ item_name[UID]="" item_name[VERSION]="" item_name[XML]="" -item_name[X-HEALTH-INSURANCE]="Krankenversicherung" -item_name[hi_company]="Versicherungsgesellschaft" -item_name[hi_number]="Versichertennummer" -item_name[hi_status]="Versichertenstatus" -item_name[X-HEALTH-INSURANCE-NOCONTRIB]="Zuzahlungsbefreiung" -item_name[X-CLIENT-REFERRAL]="Empfehlung durch" +item_name[X-HEALTH-INSURANCE]="Kran­ken­ver­sich­er­ung" +item_name[hi_from_list]="Aus Liste" +item_name[hi_other]="Andere" +item_name[hi_company]="Ver­sich­er­ungs­ge­sell­schaft" +item_name[hi_number]="Ver­sich­er­ten­num­mer" +item_name[hi_status]="Ver­sich­er­ten­sta­tus" +item_name[X-HEALTH-INSURANCE-NOCONTRIB]="Zu­zahl­ungs­be­frei­ung" +item_name[X-CLIENT-REFERRAL]="Empfehl­ung durch" item_name[prescriptions]="Verordnungen" +item_name[new_prescription]="Neue Verordnung" +item_name[no_icd]="Kein ICD Code" -item_name[X-ZACK-JOINDATE]="Anmeldedatum" -item_name[X-ZACK-LEAVEDATE]="Abmeldedatum" +item_name[X-ZACK-JOINDATE]="An­mel­de­da­tum" +item_name[X-ZACK-LEAVEDATE]="Ab­mel­de­da­tum" item_name[label_join]="Anm." item_name[label_leave]="Abm." diff --git a/templates/text_prescriptions.sh b/templates/text_prescriptions.sh index bdcdef3..83acef4 100755 --- a/templates/text_prescriptions.sh +++ b/templates/text_prescriptions.sh @@ -17,28 +17,32 @@ . $_EXEC/templates/text_cards.sh -item_name[prescriptions_current]="Aktuelle Verschreibungen" -item_name[prescriptions_past]="Vergangene Verschreibungen" -item_name[newprescription]="Neue Verschreibung" +item_name[therapy_prescription]="Heil­mit­tel­ver­ord­nung" +item_name[prescriptions_current]="Aktuelle Verordnungen" +item_name[prescriptions_past]="Frühere Verordnungen" +item_name[newprescription]="Neue Verordnung" item_name[date]="Datum" item_name[name]="Name d. Versicherten" item_name[bday]="geb. am" item_name[addcontrib]="Zuzahlung" item_name[contribconfirm]="Zuzahlung erfolgt" item_name[prescreviewed]="Verordnung geprüft" -item_name[quantity]="Verordnungmenge" -item_name[remidy]="Heilmittel nach Maßgabe des Kataloges" -item_name[prescfirst]="Erstverordnung" -item_name[prescfollow1]="1. Folgeverordnung" -item_name[prescfollow2]="2. Folgeverordnung" -item_name[prescother]="Verordnung außerhalb des Regelfalls" -item_name[presccontinual]="Langfristverordnung" -item_name[grouptherapy]="Gruppentherapie" -item_name[housecall]="Hausbesuch" -item_name[report]="Therapiebericht" -item_name[indicator]="Indikationsschlüssel" +item_name[quantity]="Ver­ord­nungs­men­ge" +item_name[remidy]="Heil­mit­tel nach Maß­ga­be des Ka­ta­lo­ges" +item_name[prescfirst]="Erst­ver­ord­nung" +item_name[prescfollow1]="1. Folge­ver­ord­nung" +item_name[prescfollow2]="2. Folge­ver­ord­nung" +item_name[prescother]="Ver­ord­nung außer­halb des Re­gel­falls" +item_name[presccontinual]="Lang­frist­ver­ord­nung" +item_name[grouptherapy]="Grup­pen­the­ra­pie" +item_name[housecall]="Haus­be­such" +item_name[report]="The­ra­pie­be­richt" +item_name[indicator]="In­di­ka­tions­schlüssel" item_name[icd10]="ICD-10-Code" item_name[insurance]="Krankenkasse bzw. Kostenträger" item_name[prescription_by_catalogue]="Verordnung nach Maßgabe des Kataloges (Regelfall)" -item_name[therapy_start]="Behandlungsbeginn spätest. am" -item_name[quantity_weekly]="Anzahl pro Woche" +item_name[therapy_start]="Be­hand­lungs­be­ginn spä­test. am" +item_name[quantity_weekly]="An­zahl pro Wo­che" +item_name[save]="Speichern" +item_name[cancel]="Abbrechen" +item_name[delete]="Löschen" diff --git a/templates/view_client.sh b/templates/view_client.sh index 4860e85..c1e3987 100755 --- a/templates/view_client.sh +++ b/templates/view_client.sh @@ -90,10 +90,14 @@ cat <

$(l10n prescriptions)

    - $(sed -rn 's:(.*)\t'$id'$:\1:p' "$_DATA/mappings/attendance" |while read each; do - cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")" - echo '
  • '$cname'
  • ' - done) + $(find "$_DATA/prescriptions/" -name "${id%.vcf}.*.mpx" \ + | while read pfile; do + printf '%s\t%s\t%s\n' "$(grep '^date' "$pfile")" "$(sed -nr 's;^icd10:(.*)$;\1;p' "$pfile")" + done \ + | sort -r | cut -f2 \ + | while read icd; do + printf '
  • %s
  • ' "${id}" "${icd:-$(l10n no_icd)}" + done)
END_HTML diff --git a/templates/view_prescription.sh b/templates/view_prescription.sh new file mode 100755 index 0000000..d31acca --- /dev/null +++ b/templates/view_prescription.sh @@ -0,0 +1,95 @@ +# Copyright 2016 Paul Hänsch +# +# This file is part of Confetti. +# +# Confetti is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Confetti is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Confetti. If not, see . + +check(){ [ "$1" = "$2" ] && printf checked} + +cat < +

$(l10n therapy_prescription)

+ + +${mpx[insurance]} +
+ +${mpx[name]} +
+ +${mpx[bday]} + +
+ +${mpx[date]} + +
+ +${mpx[addcontrib]} + + +

$(l10n prescription_by_catalogue)

+ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +${mpx[remidy]} +
+ +${mpx[quantity]} +
+ +${mpx[quantity_weekly]} + +
+ +${mpx[remidy1]} +
+ +${mpx[quantity1]} +
+ +${mpx[quantity_weekly1]} + +
+ +${mpx[indicator]} +
+ +${mpx[icd10]} + +
+ + +
+$(l10n edit) + +
+END_HTML