This commit is contained in:
Jiang Yio 2022-09-24 00:42:06 -04:00
parent 7f42be2e64
commit 426d50d5f7
4 changed files with 28 additions and 44 deletions

View File

@ -18,7 +18,7 @@
<tbody>
<tr v-for="row in patients_lost" :style="{ backgroundColor: strHashHSL(row.Clinic, '90%') }">
<td v-if="production"><router-link :to="'/patient/$' + row.key">{{row.Name}} ${{row.key}}</router-link></td>
<td v-else><router-link :title="unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.key.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.key}}</router-link></td>
<td v-else><router-link :title="strtr_unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.key.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.key}}</router-link></td>
<td>{{datefmt(row.TimeLast)}} {{dow[row.TimeLast.getDay()]}}</td>
<td>{{row.Clinic}}</td>
<td>{{Math.round(row.TimeLastDiff/86400000)}}</td>
@ -32,7 +32,7 @@
<tbody>
<tr v-for="row in patients_outstanding" :style="{ backgroundColor: strHashHSL(row.Clinic, '90%') }">
<td v-if="production"><router-link :to="'/patient/$' + row.key">{{row.Name}} ${{row.key}}</router-link></td>
<td v-else><router-link :title="unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.key.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.key}}</router-link></td>
<td v-else><router-link :title="strtr_unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.key.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.key}}</router-link></td>
<td>{{datefmt(row.TimeNext)}} {{dow[row.TimeNext.getDay()]}}</td>
<td>{{row.Clinic}}</td>
<td>{{Math.round(row.TimeNextDiff/86400000)}}</td>
@ -46,7 +46,7 @@
<script>
import cookie from './cookie.mjs';
import { groupByArray, strHashHSL, strftime_vista, debounce } from './util.mjs';
import { groupByArray, strtr_unscramble, strHashHSL, strftime_vista, debounce } from './util.mjs';
import ViewResourceLookup from './ViewResourceLookup.vue';
@ -54,15 +54,6 @@
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
function strtr(s, a, b) {
var res = '';
for(var i = 0; i < s.length; ++i) {
var j = a.indexOf(s.charAt(i));
res += j >= 0 ? b.charAt(j) : s.charAt(i);
}
return res;
}
export default {
components: {
ViewResourceLookup
@ -97,9 +88,7 @@
},
methods: {
strHashHSL,
unscramble(name) {
return name.length > 0 ? (name.charAt(0) + strtr(name.substring(1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'LKJIHGFEDCBAZYXWVUTSRQPONM')) : name;
},
strtr_unscramble,
datefmt(date) {
return date ? date.toLocaleDateString('en-CA') : '';
}

View File

@ -12,7 +12,7 @@
<DateRangePicker range="1D" direction="+1" v-model:date="date" v-model:date_end="date_end" />
</div>
<div class="card-body">
<ViewSchedule :client="client" :selection="selection" :date_begin="datefmt(date)" :date_end="datefmt(new Date(date_end.getTime() - 1))" />
<ViewSchedule :client="client" :selection="selection" :date_begin="date" :date_end="new Date(date_end.getTime() - 1)" />
</div>
</div>
</div>
@ -48,11 +48,6 @@
selection(value, oldvalue) {
cookie.set('vista.resources', value.join(','), 7);
}
},
methods: {
datefmt(date) {
return date ? date.toLocaleDateString('en-CA') : '';
}
}
};
</script>

View File

@ -8,7 +8,7 @@
<td>{{row.ApptDate}}</td>
<td>{{row.Clinic}}</td>
<td v-if="production"><router-link :to="'/patient/$' + row.HRN">{{row.Name}} ${{row.HRN}}</router-link></td>
<td v-else><router-link :title="unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.HRN.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.HRN}}</router-link></td>
<td v-else><router-link :title="strtr_unscramble(row.Name)" :to="'/patient/$' + row.Name.charAt(0) + row.HRN.slice(-4) + '?name=' + row.Name">{{row.Name}} ${{row.HRN}}</router-link></td>
<td>{{row.NOTE}} [{{row.APPT_MADE_BY}} on {{row.DATE_APPT_MADE}}]</td>
<td><Autocomplete :value="practitioner[row.Name]" @update:value="x => set_practitioner(row.Name, x)" :items="practitioner_list" /></td>
</tr>
@ -18,25 +18,10 @@
<script>
import cookie from './cookie.mjs';
import { uniq, strHashHSL, debounce } from './util.mjs';
import { uniq, strtr_unscramble, strHashHSL, strfdate_vista, debounce } from './util.mjs';
import Autocomplete from './Autocomplete.vue';
function datefm(datestr) {
var date = datestr ? new Date(datestr) : new Date();
date = new Date(date.getTime() + date.getTimezoneOffset()*60000);
return 10000*(date.getFullYear() - 1700) + 100*(date.getMonth() + 1) + date.getDate();
}
function strtr(s, a, b) {
var res = '';
for(var i = 0; i < s.length; ++i) {
var j = a.indexOf(s.charAt(i));
res += j >= 0 ? b.charAt(j) : s.charAt(i);
}
return res;
}
export default {
components: {
Autocomplete
@ -47,8 +32,8 @@
type: Array,
default: []
},
date_begin: String,
date_end: String
date_begin: Date,
date_end: Date
},
data() {
return {
@ -72,16 +57,14 @@
},
methods: {
strHashHSL,
unscramble(name) {
return name.length > 0 ? (name.charAt(0) + strtr(name.substring(1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'LKJIHGFEDCBAZYXWVUTSRQPONM')) : name;
},
strtr_unscramble,
set_practitioner(patient, practitioner) {
this.practitioner[patient] = practitioner;
cookie.set('vista.practitioner', JSON.stringify(this.practitioner), 1);
}
},
created() {
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', datefm(value.date_begin), datefm(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', strfdate_vista(value.date_begin), strfdate_vista(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
},
async mounted() {
var practitioner = cookie.get('vista.practitioner');

View File

@ -35,6 +35,19 @@ export function quantile_sorted(arr_sorted, quantile) {
return arr_sorted[base + 1] !== undefined ? arr_sorted[base] + rest * (arr_sorted[base + 1] - arr_sorted[base]) : arr_sorted[base];
}
export function strtr(s, a, b) {
var res = '';
for(var i = 0; i < s.length; ++i) {
var j = a.indexOf(s.charAt(i));
res += j >= 0 ? b.charAt(j) : s.charAt(i);
}
return res;
}
export function strtr_unscramble(name) {
return name.length > 0 ? (name.charAt(0) + strtr(name.substring(1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'LKJIHGFEDCBAZYXWVUTSRQPONM')) : name;
}
export function strHashCode(str) {
var hash = 0;
for(var i = 0; i < str.length; ++i) hash = str.charCodeAt(i) + ((hash << 5) - hash);
@ -63,6 +76,10 @@ export function strftime_vista(date) {
return 10000*(date.getFullYear() - 1700) + 100*(date.getMonth() + 1) + date.getDate() + date.getHours()/100 + date.getMinutes()/10000 + date.getSeconds()/1000000 + date.getMilliseconds()/1000000000;
}
export function strfdate_vista(date) {
return 10000*(date.getFullYear() - 1700) + 100*(date.getMonth() + 1) + date.getDate();
}
export function strptime_vista(s) {
s = +s;
var date = Math.floor(s), time = s - date;