]> git.plutz.net Git - confetti/blobdiff - templates/view_client.sh
data retriever for therapy section, some prescription improvements
[confetti] / templates / view_client.sh
index 47d6d219b5ce8eb1ae2757b64b0b22986f454c89..c1e3987c09dc7807fdc8ae92d637004b6754fddc 100755 (executable)
@@ -21,8 +21,10 @@ n=$(printf %s "$values[N]" \
    )
 fullname="${n:-${values[FN]:-${values[NICKNAME]}}}"
 
-hi_number="${values[X-HEALTH-INSURANCE]%;*}"
-hi_company="${values[X-HEALTH-INSURANCE]#*;}"
+hi_company="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f1)"
+hi_number="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f2)"
+hi_status="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f3)"
+
 
 cat <<END_HTML
   <div class="section basic">
@@ -71,6 +73,7 @@ cat <<END_HTML
     <h3>$(l10n X-HEALTH-INSURANCE)</h3>
     ${hi_company:+<span class="item hi_comapany">${hi_company}</span>}
     ${hi_number:+<span class="item hi_number"><label>$(l10n hi_number):</label> ${hi_number}</span>}
+    ${hi_status:+<span class="item hi_status"><label>$(l10n hi_status):</label> ${hi_status}</span>}
   </div><!--
 
   --><div class="section note">
@@ -87,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