]> git.plutz.net Git - confetti/commitdiff
support for prescriptions
authorpaul <paul@plutz.net>
Thu, 25 Feb 2016 03:29:07 +0000 (03:29 +0000)
committerpaul <paul@plutz.net>
Thu, 25 Feb 2016 03:29:07 +0000 (03:29 +0000)
svn path=/trunk/; revision=81

13 files changed:
actions/new_prescription.sh
actions/update_prescription.sh [new file with mode: 0755]
pages/prescriptions.sh
templates/attendees.css.sh
templates/cards.html.sh
templates/clients.html.sh [new file with mode: 0755]
templates/edit_prescription.sh
templates/prescriptions.css.sh
templates/prescriptions.html.sh
templates/text_cards.sh
templates/text_prescriptions.sh
templates/view_client.sh
templates/view_prescription.sh [new file with mode: 0755]

index af99cd0457631e87077f26a6d391ba7f2d87591f..b777cec0d948957e047622bbba04421bae31b9a6 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-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" <<EOF
+prescription:${prescription}
+insurance:$(sed -nr 's;^X-HEALTH-INSURANCE:(.*)\;.*\;\r?$;\1;p' "$cardfile")
+bday:$(sed -nr 's;^BDAY:(.*)\r?$;\1;p' "$cardfile")
+name:$(sed -rn '/^N[\;:]/{s;^N(\;[^:]*)?:([^\;]*)(\;[^\;]*)(\;[^\;]*)?(\;[^\;]*)?(\;[^\;]*)?\r?$;\5 \3 \4 \2 \6;;s;[\;,]; ;g;s; +; ;g;s;^ | $;;g;p}' "$cardfile")\n$(sed -nr 's;^ADR:(.*)\r?$;\1;p' "$cardfile")
+date:$(date +%F)
 EOF
 
 echo -n "Location: ?p=prescriptions&edit=$prescription\n\n"
diff --git a/actions/update_prescription.sh b/actions/update_prescription.sh
new file mode 100755 (executable)
index 0000000..68cb7fd
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/zsh
+
+# 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 <http://www.gnu.org/licenses/>. 
+
+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}"
index b550d787641ca405621d483ea0272b3fa17a78f6..fbcd5065b117d3ea29bce72a1b31ff2820e3c97e 100755 (executable)
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
 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"
+}
index 1544d8682725e24e97b2e55345d58f913289574a..758b1d1a0f977e1f249cdad47a927fc347c131de 100755 (executable)
@@ -102,13 +102,10 @@ cat <<EOF
   border: 1px solid black;
   background: #FFF;
 }
-.card .control a.item {
-  border-right: 3px double;
-  padding: .125em 1ex;
-}
-.card .control a.item:hover{
-  border-right: 1px solid;
-}
+.card .control a.item { padding: .25em .75ex 0 .75ex;}
+.card .control a.item:hover{ border-color: #888;}
+.card .control button.item { text-align: right;}
+.card .control button.item:hover{ border-color: #888;}
 .card .control .item[name=newfield] { width: 85%;}
 .card .control .item[value=addfield] { width: 15%;}
 
@@ -143,6 +140,13 @@ cat <<EOF
   word-wrap: break-word;
 }
 
+.card .section.prescriptions ul { margin: 0; padding: 0; }
+.card .section.prescriptions ul li {
+  display: inline-block;
+  word-wrap: break-word;
+  margin: 0 .25ex;
+}
+
 form.card .section input[type=text],
 form.card .section input:not([type]),
 form.card .section textarea,
index ff0058dcd1401c365a4a0829a089f2174637b696..149343715b9fa56d34c258cc377c924eee5a1be9 100755 (executable)
@@ -2,7 +2,7 @@ case $PROFILE in
 medical)
   view_card=${0%/*}/view_client.sh
   edit_card=${0%/*}/edit_client.sh
-  . ${0%/*}/attendees.html.sh
+  . ${0%/*}/clients.html.sh
 ;;
 circus)
   view_card=${0%/*}/view_attendee.sh
diff --git a/templates/clients.html.sh b/templates/clients.html.sh
new file mode 100755 (executable)
index 0000000..db8a4de
--- /dev/null
@@ -0,0 +1,78 @@
+# Copyright 2014 - 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 <http://www.gnu.org/licenses/>. 
+
+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 <<EOF
+<form class="filter" action="?action=filter_card" method="POST">
+  <h1>$(l10n filter_label)</h1>
+  <input type="hidden" name="page" value="cards"/>
+  <input type="text" name="filter" value="$_GET["filter"]" placeholder="$(l10n filter_placeholder)"/>
+  <br />
+  <fieldset>
+  <legend>$(l10n filter_type):</legend>
+    <label><input type="radio" name="filtertype" value="any"       $(check_type any)      >$(l10n filter_all)</label>
+    <label><input type="radio" name="filtertype" value="name"      $(check_type name)     >$(l10n filter_name)</label>
+    <label><input type="radio" name="filtertype" value="street"    $(check_type street)   >$(l10n filter_street)</label>
+    <label><input type="radio" name="filtertype" value="zip"       $(check_type zip)      >$(l10n filter_zip)</label>
+    <label><input type="radio" name="filtertype" value="telephone" $(check_type telephone)>$(l10n filter_phone)</label>
+    <label><input type="radio" name="filtertype" value="birth"     $(check_type birth)    >$(l10n filter_birthyear)</label>
+  </fieldset>
+  <fieldset>
+    <legend>$(l10n filter_order):</legend>
+    <label><input type="radio" name="order" value="firstname" $(check_order firstname)>$(l10n filter_firstname)</label>
+    <label><input type="radio" name="order" value="lastname"  $(check_order lastname) >$(l10n filter_lastname)</label>
+    <label><input type="radio" name="order" value="bdate"     $(check_order bdate)    >$(l10n filter_bdate)</label>
+  </fieldset>
+  <button type="submit" name="choice" value="new_filter">$(l10n filter_apply)</button>
+  <button type="submit" name="choice" value="del_filter">$(l10n filter_cancel)</button>
+</form>
+
+<form class="newcard" action="?action=new_card" method="POST">
+  <button type="submit">$(l10n newcard)</button>
+</form>
+
+${edit:+$(edit_card "$edit")}
+
+$(
+  listcards |grep ${edit:+-v} "$edit" \
+  | while read card; do
+    cat <<-ENDCARD
+       <div id="${card}" class="card">
+         $(view_card "$card")<!--
+         --><div class="control">
+           <a class="item" href="?action=edit_card&card=${card}">$(l10n edit)</a>
+           <a class="item" href="?action=export_vcard&card=${card}">$(l10n vcf_export)</a>
+           <a class="item" href="?action=new_prescription&client=${card}">$(l10n new_prescription)</a>
+         </div>
+       </div>
+       ENDCARD
+  done
+)
+EOF
+
+# vi:set filetype=html:
index d4dce32e36f9c50f8a065a48af86ec47c5e6996a..cfd2b5be8dcfd141cb263d659e5b62ddb87c8dbb 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
+check(){ [ "$1" = "$2" ] && printf checked}
+
 cat <<END_HTML
 <form class="prescription" action="?action=update_prescription" method="POST">
+<input type="hidden" name="prescription" value="${mpx[prescription]}">
+
+<h1>$(l10n therapy_prescription)</h1>
 
 <label for="insurance">$(l10n insurance)</label>
-<input id="insurance" name="insurance" value="" placeholder="$(l10n insurance)">
+<input id="insurance" name="insurance" value="${mpx[insurance]}" placeholder="$(l10n insurance)">
+<br>
 <label for="name">$(l10n name)</label>
-<textarea id="name" name="name" placeholder="$(l10n name)"></textarea>
+<textarea id="name" name="name" placeholder="$(l10n name)">${mpx[name]}</textarea>
+<br>
 <label for="bday">$(l10n bday)</label>
-<input id="bday" name="bday" value="" placeholder="$(l10n bday)">
+<input id="bday" name="bday" value="${mpx[bday]}" placeholder="$(l10n bday)">
 
+<br>
 <label for="date">$(l10n date)</label>
-<input id="date" name="date" value="" placeholder="$(l10n date)">
+<input id="date" name="date" value="${mpx[date]}" placeholder="$(l10n date)">
 
+<br>
 <label for="addcontrib">$(l10n addcontrib)</label>
-<input id="addcontrib" name="addcontrib" value="" placeholder="$(l10n addcontrib)">
-<input type="checkbox" id="contribconfirm" name="contribconfirm" value="true">
+<input id="addcontrib" name="addcontrib" value="${mpx[addcontrib]}" placeholder="$(l10n addcontrib)">
+<input type="checkbox" id="contribconfirm" name="contribconfirm" value="true" ${mpx[contribconfirm]:+checked}>
 <label for="contribconfirm">$(l10n contribconfirm)</label>
 
 <h2>$(l10n prescription_by_catalogue)</h2>
-<input type="radio" id="prescfirst" name="prescno" value="first">
+<input type="radio" id="prescfirst" name="prescno" value="first" $(check "$mpx[prescno]" first)>
 <label for="prescfirst">$(l10n prescfirst)</label>
-<input type="radio" id="prescfollow1" name="prescno" value="follow1">
+<br>
+<input type="radio" id="prescfollow1" name="prescno" value="follow1" $(check "$mpx[prescno]" follow1)>
 <label for="prescfollow1">$(l10n prescfollow1)</label>
-<input type="radio" id="prescfollow2" name="prescno" value="follow2">
+<br>
+<input type="radio" id="prescfollow2" name="prescno" value="follow2" $(check "$mpx[prescno]" follow2)>
 <label for="prescfollow2">$(l10n prescfollow2)</label>
-<input type="radio" id="prescother" name="prescno" value="other">
+<br>
+<input type="radio" id="prescother" name="prescno" value="other" $(check "$mpx[prescno]" other)>
 <label for="prescother">$(l10n prescother)</label>
-<input type="radio" id="presccontinual" name="prescno" value="continual">
+<br>
+<input type="radio" id="presccontinual" name="prescno" value="continual" $(check "$mpx[prescno]" continual)>
 <label for="presccontinual">$(l10n presccontinual)</label>
 
-<input type="checkbox" id="grouptherapy" name="grouptherapy" value="true">
+<br>
+<input type="checkbox" id="grouptherapy" name="grouptherapy" value="true" ${mpx[grouptherapy]:+checked}>
 <label for="grouptherapy">$(l10n grouptherapy)</label>
-<input type="checkbox" id="housecall" name="housecall" value="true">
+<br>
+<input type="checkbox" id="housecall" name="housecall" value="true" ${mpx[housecall]:+checked}>
 <label for="housecall">$(l10n housecall)</label>
-<input type="checkbox" id="report" name="report" value="true">
+<br>
+<input type="checkbox" id="report" name="report" value="true" ${mpx[report]:+checked}>
 <label for="report">$(l10n report)</label>
 
-<label for="quantity">$(l10n quantity)</label>
-<input id="quantity" name="quantity" value="" placeholder="$(l10n quantity)">
+<br>
 <label for="remidy">$(l10n remidy)</label>
-<textarea id="remidy" name="remidy" placeholder="$(l10n remidy)"></textarea>
+<textarea id="remidy" name="remidy" placeholder="$(l10n remidy)">${mpx[remidy]}</textarea>
+<br>
+<label for="quantity">$(l10n quantity)</label>
+<input id="quantity" name="quantity" value="${mpx[quantity]}" placeholder="$(l10n quantity)">
+<br>
 <label for="quantity_weekly">$(l10n quantity_weekly)</label>
-<input id="quantity_weekly" name="quantity_weekly" value="" placeholder="$(l10n quantity_weekly)">
+<input id="quantity_weekly" name="quantity_weekly" value="${mpx[quantity_weekly]}" placeholder="$(l10n quantity_weekly)">
+
+<br>
+<label for="remidy1">$(l10n remidy)</label>
+<textarea id="remidy1" name="remidy1" placeholder="$(l10n remidy)">${mpx[remidy1]}</textarea>
+<br>
+<label for="quantity1">$(l10n quantity)</label>
+<input id="quantity1" name="quantity1" value="${mpx[quantity1]}" placeholder="$(l10n quantity)">
+<br>
+<label for="quantity_weekly1">$(l10n quantity_weekly)</label>
+<input id="quantity_weekly1" name="quantity_weekly1" value="${mpx[quantity_weekly1]}" placeholder="$(l10n quantity_weekly)">
 
+<br>
 <label for="indicator">$(l10n indicator)</label>
-<input id="indicator" name="indicator" value="" placeholder="$(l10n indicator)">
+<input id="indicator" name="indicator" value="${mpx[indicator]}" placeholder="$(l10n indicator)">
+<br>
 <label for="icd10">$(l10n icd10)</label>
-<input id="icd10" name="icd10" value="" placeholder="$(l10n icd10)">
+<input id="icd10" name="icd10" value="${mpx[icd10]}" placeholder="$(l10n icd10)">
 
-<input type="checkbox" id="prescreviewed" name="prescreviewed" value="true">
+<br>
+<input type="checkbox" id="prescreviewed" name="prescreviewed" value="true" ${mpx[prescreviewed]:+checked}>
 <label for="prescreviewed">$(l10n prescreviewed)</label>
 
+<br>
+<button type="submit" name="action" value="save">$(l10n save)</button>
+<button type="submit" name="action" value="cancel">$(l10n cancel)</button>
+<button type="submit" name="action" value="delete">$(l10n delete)</button>
 
 </form>
 END_HTML
index 80e61ea889a2bf8de6e459009cbb5b8081f3bd1c..67b2c89df5726ccdcba70bd6fa45879be9a28341 100755 (executable)
 
 cat <<EOF
 /**/
-form.prescription {
+
+.prescription {
   display: inline-block;
   position: relative;
-  width: 30%; height: 30em;
-  min-width: 480px;
-  border: 1px solid #000;
-  background-color: #DEF;
+  width: 480px; height: 41em;
   color: #800;
-  margin: 1em 1ex;
-  padding: 0;
+  background-color: #CFF;
+  margin: 1em; padding: 0;
+  border: 1px solid #888;
+  overflow: hidden;
+}
+
+.newprescription {
+  display: block;
+  margin: 0 2em; padding: .5ex 2ex;
+  background-color: #CFF;
+  border: 1px solid #888;
+  border-radius: 0 0 1ex 1ex;
 }
+.prescription + .newprescription {display: none;}
 
-form.prescription * {
+.prescription * {
   position: absolute;
   display: inline-block;
-  left: -50em;
+  bottom: 0; right: 0;
   font-size: 1em;
   line-height: 1em;
   margin: 0; padding: 0;
 }
-form.prescription label {padding-left: .5ex;}
+.prescription label {padding-left: .5ex; font-size: .75em;}
+
+.prescription span,
+.prescription input,
+.prescription textarea {
+  height: 1.5em;
+  border: 1px solid #800;
+  padding: .25ex;
+  background-color: #FFF;
+}
+.prescription span{
+  background-color: #EEE;
+  padding: .5ex .25ex;
+  white-space: pre-wrap;
+}
 
-form.prescription input,
-form.prescription textarea {
-  height: 1em;
+input[type=checkbox],
+input[type=radio] { display: none;}
+label.checkbox, label.radio,
+input[type=checkbox] + label,
+input[type=radio] + label { padding-left: 1em; font-size: 1em; }
+label.checkbox:before, label.radio:before,
+input[type=checkbox] + label:before,
+input[type=radio] + label:before {
+  display: inline-block;
+  position: absolute; left: 0;
+  width: .75em; height: .75em;
+  background-color: #FFF;
   border: 1px solid #800;
+  content: ' ';
+}
+label.radio:before,
+input[type=radio] + label:before { border-radius: .5em;}
+label.checkbox.checked:before, label.radio.checked:before,
+input[type=checkbox]:checked + label:before,
+input[type=radio]:checked + label:before { content: "\2713";}
+
+a.button,
+.prescription input[type=submit],
+.prescription button {
+  height: 1.5em;
+  color: #FFF;
+  background-color: #800;
+  text-align: center;
+  text-decoration: none;
+  margin: 0; padding: .125em 0 0 0;
+  border: none;
+}
+a.button {padding: .5ex;}
+
+/* ======== Specific ========== */
+.prescription h1:nth-of-type(1) {
+  font-size: 1.25em;
+  font-weight: bold;
+  left: 62%; top: .5em;
+  width: 36%;
 }
 
 label[for=insurance], #insurance {
   width: 58%;
   left: 2%;
-  top: .5em;
+  top: 1em;
 }
 #insurance {top: 1.5em;}
 
 label[for=name], #name {
   width: 38%;
   left: 2%;
-  top: 3.25em;
+  top: 4.5em;
 }
-#name {top: 4.25em; height: 4em;}
+#name {top: 4.125em; height: 4em;}
 
 label[for=bday], #bday {
   width: 20%;
   left: 40%;
-  top: 3.25em;
+  top: 4.5em;
 }
-#bday {top: 4.25em; height: 4em;}
+#bday {top: 4.125em; height: 4em; text-align: center;}
 
 label[for=date], #date {
   width: 20%;
   left: 40%;
-  top: 8.5em;
+  top: 11.375em;
 }
-#date {top: 9.5em;}
+#date {top: 9.25em; text-align: right;}
 
 label[for=addcontrib], #addcontrib {
   width: 18%;
   left: 62%;
   top: 6.25em;
 }
-#addcontrib {top: 7.25em;}
+#addcontrib {top: 5.5em; text-align: right;}
+label[for=contribconfirm] { top: 7.25em; left: 62%;}
 
-form.prescription h2 {
-  font-weight: normal;
+.prescription h2:nth-of-type(1) {
+  font-weight: bold;
+  left: 2%; top: 12em;
   width: 50%;
+}
+
+label[for=prescfirst]    { left:  2%; top: 14.5em; width: 30%; }
+label[for=prescfollow1]  { left:  2%; top: 16em;   width: 30%; }
+label[for=prescfollow2]  { left:  2%; top: 17.5em; width: 30%; }
+label[for=presccontinual]{ left: 33%; top: 14.5em; width: 30%; }
+label[for=prescother  ]  { left: 33%; top: 16em;   width: 30%; }
+
+label[for=grouptherapy] { left:  2%; top: 20em; width: 30%; }
+label[for=housecall]    { left: 33%; top: 20em; width: 30%; }
+label[for=report]       { left:  2%; top: 21.5em; width: 30%; }
+
+
+label[for=quantity], #quantity, #quantity1 {
+  width: 18%;
   left: 2%;
-  top: 11em;
+  top: 32em;
+}
+#quantity {top: 25.5em; height: 3em; text-align: center;}
+#quantity1 {top: 28.5em; height: 3em; text-align: center;}
+label[for=remidy], #remidy, #remidy1 {
+  width: 60%;
+  left: 20%;
+  top: 33em;
+}
+#remidy {top: 25.5em; height: 3em;}
+#remidy1 {top: 28.5em; height: 3em;}
+label[for=quantity_weekly], #quantity_weekly, #quantity_weekly1 {
+  width: 18%;
+  left: 80%;
+  top: 32em;
 }
+#quantity_weekly {top: 25.5em; height: 3em; text-align: center;}
+#quantity_weekly1 {top: 28.5em; height: 3em; text-align: center;}
+
+label[for=quantity1], label[for=remidy1], label[for=quantity_weekly1] {display: none}
+
+label[for=indicator], #indicator {
+  width: 20%;
+  left: 2%;
+  top: 42.5em;
+}
+#indicator {top: 33.375em; text-align: right;}
+label[for=icd10], #icd10 {
+  width: 20%;
+  left: 2%;
+  top: 47em;
+}
+#icd10 {top: 36em; text-align: right;}
+
+label[for=prescreviewed] { left:  62%; top: 36em; width: 36%; }
+
+a.button,
+button[value=save]   { top: 39em; left:  2%; width: 18%;}
+button[value=cancel] { top: 39em; left: 21%; width: 18%;}
+button[value=delete] { top: 39em; left: 42%; width: 18%;}
 
 EOF
 
index 9a0dd480912145e0cf6e5f7f79b77c52c3fc2187..a3db3a7d879157a24982c309ca357f5f2d58a76e 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-edit="${_GET[edit]}"
 client="${_GET[client]}"
-[ -z "$client" ] && client="${edit%.*.mpx}.vcf"
+edit="${_GET[edit]}"
+[ -n "$edit" ] && client="${edit%.*.mpx}.vcf"
 
 cat <<EOF
 
 <div id="${card}" class="card">$(view_card "$client")</div>
 
-<h1>$(l10n prescriptions_current)</h1>
+<!--h1>$(l10n prescriptions_current)</h1-->
 
 ${edit:+$(edit_prescription "$edit")}
-
 <div class="newprescription">
   <form action="?action=new_prescription" method="POST">
     <input type="hidden" name="client" value="$client">
@@ -36,11 +35,11 @@ ${edit:+$(edit_prescription "$edit")}
 
 $(list_prescriptions "$client" \
   |while read pre; do 
-    view_prescription "$pre"
+    [ "$pre" = "$edit" ] || view_prescription "$pre"
   done
 )
 
-<h1>$(l10n prescriptions_past)</h1>
+<!--h1>$(l10n prescriptions_past)</h1-->
 
 EOF
 
index 2e364461d9855125176d7d34d7e26b7a72badd21..53d8489a4d1d504a7824b2ca93cac72f5f6e9891 100755 (executable)
@@ -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&shy;ken&shy;ver&shy;sich&shy;er&shy;ung"
+item_name[hi_from_list]="Aus Liste"
+item_name[hi_other]="Andere"
+item_name[hi_company]="Ver&shy;sich&shy;er&shy;ungs&shy;ge&shy;sell&shy;schaft"
+item_name[hi_number]="Ver&shy;sich&shy;er&shy;ten&shy;num&shy;mer"
+item_name[hi_status]="Ver&shy;sich&shy;er&shy;ten&shy;sta&shy;tus"
+item_name[X-HEALTH-INSURANCE-NOCONTRIB]="Zu&shy;zahl&shy;ungs&shy;be&shy;frei&shy;ung"
+item_name[X-CLIENT-REFERRAL]="Empfehl&shy;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&shy;mel&shy;de&shy;da&shy;tum"
+item_name[X-ZACK-LEAVEDATE]="Ab&shy;mel&shy;de&shy;da&shy;tum"
 item_name[label_join]="Anm."
 item_name[label_leave]="Abm."
 
index bdcdef33390f84ed5cd07e26b7e3a27c926a3a1b..83acef470fafe62c8fced87d36aeaa851b01c666 100755 (executable)
 
 . $_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&shy;mit&shy;tel&shy;ver&shy;ord&shy;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&shy;ord&shy;nungs&shy;men&shy;ge"
+item_name[remidy]="Heil&shy;mit&shy;tel nach Maß&shy;ga&shy;be des Ka&shy;ta&shy;lo&shy;ges"
+item_name[prescfirst]="Erst&shy;ver&shy;ord&shy;nung"
+item_name[prescfollow1]="1. Folge&shy;ver&shy;ord&shy;nung"
+item_name[prescfollow2]="2. Folge&shy;ver&shy;ord&shy;nung"
+item_name[prescother]="Ver&shy;ord&shy;nung außer&shy;halb des Re&shy;gel&shy;falls"
+item_name[presccontinual]="Lang&shy;frist&shy;ver&shy;ord&shy;nung"
+item_name[grouptherapy]="Grup&shy;pen&shy;the&shy;ra&shy;pie"
+item_name[housecall]="Haus&shy;be&shy;such"
+item_name[report]="The&shy;ra&shy;pie&shy;be&shy;richt"
+item_name[indicator]="In&shy;di&shy;ka&shy;tions&shy;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&shy;hand&shy;lungs&shy;be&shy;ginn spä&shy;test. am"
+item_name[quantity_weekly]="An&shy;zahl pro Wo&shy;che"
+item_name[save]="Speichern"
+item_name[cancel]="Abbrechen"
+item_name[delete]="Löschen"
index 4860e853ff91c87534dcfa42ef207eba2f6fe0a3..c1e3987c09dc7807fdc8ae92d637004b6754fddc 100755 (executable)
@@ -90,10 +90,14 @@ cat <<END_HTML
   --><div class="section prescriptions">
     <h3>$(l10n prescriptions)</h3>
     <ul>
-    $(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 '   <li><a class="item attendance" href="?p=courses#'$each'">'$cname'</a></li>'
-    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 '<li><a href="?p=prescriptions&amp;client=%s" >%s</a></li>' "${id}" "${icd:-$(l10n no_icd)}"
+      done)
     </ul>
   </div>
 END_HTML
diff --git a/templates/view_prescription.sh b/templates/view_prescription.sh
new file mode 100755 (executable)
index 0000000..d31acca
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>. 
+
+check(){ [ "$1" = "$2" ] && printf checked}
+
+cat <<END_HTML
+<div class="prescription">
+<h1>$(l10n therapy_prescription)</h1>
+
+<label for="insurance">$(l10n insurance)</label>
+<span id="insurance">${mpx[insurance]}</span>
+<br>
+<label for="name">$(l10n name)</label>
+<span id="name">${mpx[name]}</span>
+<br>
+<label for="bday">$(l10n bday)</label>
+<span id="bday">${mpx[bday]}</span>
+
+<br>
+<label for="date">$(l10n date)</label>
+<span id="date">${mpx[date]}</span>
+
+<br>
+<label for="addcontrib">$(l10n addcontrib)</label>
+<span id="addcontrib">${mpx[addcontrib]}</span>
+<label class="checkbox ${mpx[contribconfirm]:+checked}" for="contribconfirm">$(l10n contribconfirm)</label>
+
+<h2>$(l10n prescription_by_catalogue)</h2>
+<label class="radio $(check "$mpx[prescno]" first)" for="prescfirst">$(l10n prescfirst)</label>
+<br>
+<input type="radio" id="prescfollow1" name="prescno" value="follow1" $(check "$mpx[prescno]" follow1)>
+<label class="radio $(check "$mpx[prescno]" follow1)" for="prescfollow1">$(l10n prescfollow1)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" follow2)" for="prescfollow2">$(l10n prescfollow2)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" other)" for="prescother">$(l10n prescother)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" continual)" for="presccontinual">$(l10n presccontinual)</label>
+
+<br>
+<label class="checkbox ${mpx[grouptherapy]:+checked}" for="grouptherapy">$(l10n grouptherapy)</label>
+<br>
+<label class="checkbox ${mpx[housecall]:+checked}" for="housecall">$(l10n housecall)</label>
+<br>
+<label class="checkbox ${mpx[report]:+checked}" for="report">$(l10n report)</label>
+
+<br>
+<label for="remidy">$(l10n remidy)</label>
+<span id="remidy">${mpx[remidy]}</span>
+<br>
+<label for="quantity">$(l10n quantity)</label>
+<span id="quantity">${mpx[quantity]}</span>
+<br>
+<label for="quantity_weekly">$(l10n quantity_weekly)</label>
+<span id="quantity_weekly">${mpx[quantity_weekly]}</span>
+
+<br>
+<label for="remidy1">$(l10n remidy)</label>
+<span id="remidy1">${mpx[remidy1]}</span>
+<br>
+<label for="quantity1">$(l10n quantity)</label>
+<span id="quantity1">${mpx[quantity1]}</span>
+<br>
+<label for="quantity_weekly1">$(l10n quantity_weekly)</label>
+<span id="quantity_weekly1">${mpx[quantity_weekly1]}</span>
+
+<br>
+<label for="indicator">$(l10n indicator)</label>
+<span id="indicator">${mpx[indicator]}</span>
+<br>
+<label for="icd10">$(l10n icd10)</label>
+<span id="icd10">${mpx[icd10]}</span>
+
+<br>
+<label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">$(l10n prescreviewed)</label>
+
+<br>
+<a class="button" href="?p=prescriptions&amp;edit=${mpx[prescription]}">$(l10n edit)</a>
+
+</div>
+END_HTML