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

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');