From 9b13f7013dd882029ab3cf106d659a48243d910d Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 18 Jun 2016 17:04:11 +0000 Subject: [PATCH] allow additional remedies to be prescribed svn path=/trunk/; revision=115 --- templates/edit_prescription.sh | 24 ++++++++++++++++++------ templates/prescriptions.css.sh | 32 +++++++++++++++++++++++--------- templates/text_therapy.sh | 1 + templates/therapy.html.sh | 10 ++++++---- templates/view_client.sh | 22 +++++++++++++--------- templates/view_prescription.sh | 29 ++++++++++++++--------------- 6 files changed, 75 insertions(+), 43 deletions(-) diff --git a/templates/edit_prescription.sh b/templates/edit_prescription.sh index 8ac9bb7..285739a 100755 --- a/templates/edit_prescription.sh +++ b/templates/edit_prescription.sh @@ -113,16 +113,28 @@ cat <$(l10n quantity) +

+

+ +$( for n in {0..10}; do + if [ "$n" -eq 0 -o -n "${mpx[quantity$n]}" -o -n "${mpx[remidy$n]}" -o -n "${mpx[quantity_weekly$n]}" ]; then + printf '' + else + printf '' + fi + printf '

+ + + +

+ ' "$(l10n quantity)" "${mpx[quantity$n]}" \ + "$(l10n remidy)" "${mpx[remidy$n]}" \ + "$(l10n quantity_weekly)" "${mpx[quantity_weekly$n]}" +done ) - - - - - -

diff --git a/templates/prescriptions.css.sh b/templates/prescriptions.css.sh index 49db497..9d1baf8 100755 --- a/templates/prescriptions.css.sh +++ b/templates/prescriptions.css.sh @@ -16,10 +16,11 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -. ${0%/*}/attendees.css.sh +. ${0%/*}/cards.css.sh cat <$(l10n housecall)} ${mpx[report]:+$(l10n report)} -

+ ${mpx[indicator]:+${mpx[indicator]}} ${mpx[icd10]:+ ${mpx[icd10]}} diff --git a/templates/view_client.sh b/templates/view_client.sh index ef214c5..c83fac9 100755 --- a/templates/view_client.sh +++ b/templates/view_client.sh @@ -86,16 +86,20 @@ cat <

$(l10n prescriptions)

    - $(find "$_DATA/prescriptions/" -name "${id%.vcf}.*.mpx" \ + $(declare -A mpx + find "$_DATA/prescriptions/" -name "${id%.vcf}.*.mpx" \ | while read pfile; do - printf '%s\t%s\t%s\n' - printf '
  • %s: %s - %s%s
  • ' \ - "${id}" \ - "${id}" \ - "$(sed -nr 's;^date:(.+)$;\1;p' "$pfile")" \ - "$(sed -nr 's;^indicator:(.+)$;\1;p' "$pfile")" \ - "$(sed -nr 's;^quantity:(.+) ?$;\1x ;p' "$pfile")$(sed -nr 's;^remidy:(.+)$;\1;p' "$pfile")" \ - "$(sed -nr 's;^quantity1:(.+) ?$;,\1x ;p' "$pfile")$(sed -nr 's;^remidy1:(.+)$;\1;p' "$pfile")" + mpx=(); cat "$pfile" |while read -r line; do + val="${line#*:}" + mpx[${line%%:*}]="$(htmlsafe "${val//\\n/$BR}")" + done + printf '
  • %s: %s - %s
  • ' \ + "${id}" "${pfile##*/}" "${mpx[date]}" "${mpx[indicator]}" \ + "$([ -n "${mpx[remidy]}" ] && printf '%s %s' "${mpx[quantity]}" "${mpx[remidy]}" + for n in {0..10}; do + [ -n "${mpx[remidy${n}]}" ] && printf ', %s %s' "${mpx[quantity${n}]}" "${mpx[remidy${n}]}" + done + )" done |sort -r )
diff --git a/templates/view_prescription.sh b/templates/view_prescription.sh index ce2b496..78f995b 100755 --- a/templates/view_prescription.sh +++ b/templates/view_prescription.sh @@ -69,21 +69,20 @@ cat <
- - - - -${mpx[quantity]} -${mpx[remidy]} -${mpx[quantity_weekly]} - - - - -${mpx[quantity1]} -${mpx[remidy1]} -${mpx[quantity_weekly1]} - + + + + ${mpx[quantity]} + ${mpx[remidy]} + ${mpx[quantity_weekly]} +$( for n in {0..10}; do + [ -n "${mpx[quantity$n]}" -o -n "${mpx[remidy$n]}" -o -n "${mpx[quantity_weekly$n]}" ] \ + && printf ' + %s + %s + %s + ' "${mpx[quantity$n]}" "${mpx[remidy$n]}" "${mpx[quantity_weekly$n]}" +done )

-- 2.39.2