|
|
@@ -0,0 +1,254 @@
|
|
|
+<template>
|
|
|
+ <div class="page" data-name="home-patient-fix">
|
|
|
+
|
|
|
+ <div class="content flex column centerv centerh">
|
|
|
+
|
|
|
+ <form class="list no-hairlines-md" id="form-patient-fix" autocomplete="off" style="width: 800px; margin:16px 16px;">
|
|
|
+ <ul>
|
|
|
+ <div class="row">
|
|
|
+ {{#js_if "app.data.user.type=='physician'"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.patientID"}}: <b>{{js "this.patient.patientID"}}</b></div>
|
|
|
+ <input type="hidden" name="patientID" value="{{js "this.patient.patientID"}}">
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ {{#js_if "app.data.user.type=='investigator'"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ {{#js_if "app.data.user.type=='physician'"}}
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.patientID"}} <span class="required">*</span></div>
|
|
|
+ {{else}}
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.ctPatientID"}} <span class="required">*</span></div>
|
|
|
+ {{/js_if}}
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <input type="text" name="patientID" placeholder="{{js "global.tr[global.lang].existing.patientID"}}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ {{#js_if "global.lang=='en'"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-floating-label">{{js "global.tr[global.lang].race.title"}} <span class="required">*</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <select name="patientRace">
|
|
|
+ <option value="white" {{js "this.patient.race=='white'?'selected':''"}}>{{js "global.tr[global.lang].race.white"}}</option>
|
|
|
+ <option value="african" {{js "this.patient.race=='african'?'selected':''"}}>{{js "global.tr[global.lang].race.african"}}</option>
|
|
|
+ <option value="asian" {{js "this.patient.race=='asian'?'selected':''"}}>{{js "global.tr[global.lang].race.asian"}}</option>
|
|
|
+ <option value="other" {{js "this.patient.race=='other'?'selected':''"}}>{{js "global.tr[global.lang].race.other"}}</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{else}}
|
|
|
+ <input type="hidden" name="patientRace" value="white">
|
|
|
+ {{/js_if}}
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ {{#js_if "this.patientListFields.Firstname"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.firstname"}} <span class="required">{{js "this.patientListFields.Firstname_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <input type="text" name="firstname" placeholder="{{js "global.tr[global.lang].form.firstname"}}" autocomplete="off" value="{{js "this.patient.firstname?this.patient.firstname:''"}}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ {{#js_if "this.patientListFields.Lastname"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.lastname"}} <span class="required">{{js "this.patientListFields.Lastname_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <input type="text" name="lastname" placeholder="{{js "global.tr[global.lang].form.lastname"}}" autocomplete="off" value="{{js "this.patient.lastname?this.patient.lastname:''"}}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ {{#js_if "this.patientListFields.Sex"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.sex"}} <span class="required">{{js "this.patientListFields.Sex_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap input-dropdown-wrap">
|
|
|
+ <select name="gender" required validate>
|
|
|
+ <option value="M" {{js "this.patient.gender=='M'?'selected':''"}}>Male</option>
|
|
|
+ <option value="F" {{js "this.patient.gender=='F'?'selected':''"}}>Female</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ {{#js_if "this.patientListFields.Birthdate"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.birth"}} <span class="required">{{js "this.patientListFields.Birthdate_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <input autocomplete="false" type="date" placeholder="{{js "global.tr[global.lang].topLevel.dateFormat"}}" name="birthDate" value="{{js "this.patient.birthDate?this.patient.birthDate:''"}}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ {{#js_if "this.patientListFields.Height"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.height"}} <span class="required">{{js "this.patientListFields.Height_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <input type="number" name="height" autocomplete="off" placeholder="{{js "global.tr[global.lang].existing.height"}}" value="{{js "this.patient.height?this.patient.height:''"}}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ {{#js_if "this.patientListFields.Weight"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-label">{{js "global.tr[global.lang].existing.weight"}} <span class="required">{{js "this.patientListFields.Weight_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <input type="number" name="weight" autocomplete="off" placeholder="{{js "global.tr[global.lang].existing.weight"}}" value="{{js "this.patient.weight?this.patient.weight:''"}}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ {{#js_if "this.patientListFields.Birth_country"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-floating-label">{{js "global.tr[global.lang].existing.birthCountry"}} <span class="required">{{js "this.patientListFields.Birth_country_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <select name="birthCountry">
|
|
|
+ {{#each countries}}
|
|
|
+ <option value="{{ID}}" {{js "global.lang=='en'?(this.alpha2.toLowerCase()=='us'?'selected':''):(global.lang==this.alpha2.toLowerCase()?'selected':'')"}}>{{name}}</option>
|
|
|
+ {{/each}}
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ {{#js_if "this.patientListFields.Residence_country"}}
|
|
|
+ <li class="item-content item-input">
|
|
|
+ <div class="item-inner">
|
|
|
+ <div class="item-title item-floating-label">{{js "global.tr[global.lang].existing.residenceCountry"}} <span class="required">{{js "this.patientListFields.Residence_country_required?'*':''"}}</span></div>
|
|
|
+ <div class="item-input-wrap">
|
|
|
+ <select name="residenceCountry">
|
|
|
+ {{#each countries}}
|
|
|
+ <option value="{{ID}}" {{js "global.lang=='en'?(this.alpha2.toLowerCase()=='us'?'selected':''):(global.lang==this.alpha2.toLowerCase()?'selected':'')"}}>{{name}}</option>
|
|
|
+ {{/each}}
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ {{/js_if}}
|
|
|
+ </div>
|
|
|
+ </ul>
|
|
|
+ </form>
|
|
|
+
|
|
|
+ <div class="flex row centerh">
|
|
|
+ <a href="#" class="button iimt-button" @click="modify()">{{js "global.tr[global.lang].topLevel.save"}}</a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ export default {
|
|
|
+ on: {
|
|
|
+ pageInit: function() {
|
|
|
+ navigator.sayswho= (function(){
|
|
|
+ var ua= navigator.userAgent, tem,
|
|
|
+ M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
|
+ if(/trident/i.test(M[1])){
|
|
|
+ tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
|
|
|
+ return 'IE '+(tem[1] || '');
|
|
|
+ }
|
|
|
+ if(M[1]=== 'Chrome'){
|
|
|
+ tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
|
|
|
+ if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
|
|
|
+ }
|
|
|
+ M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
|
|
|
+ if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
|
|
|
+ return M.join(' ');
|
|
|
+ })();
|
|
|
+ let versionNameTab = navigator.sayswho.split(' ');
|
|
|
+ if(versionNameTab[0] == 'Safari') {
|
|
|
+ $$('input[name="birthDate"]').attr('type','text');
|
|
|
+ $$('input[name="birthDate"]').on('keydown', function(e) {
|
|
|
+ e.preventDefault();
|
|
|
+ return;
|
|
|
+ });
|
|
|
+ const birthDate_picker = datepicker('input[name="birthDate"]', {
|
|
|
+ //onShow: instance => {
|
|
|
+ //},
|
|
|
+ formatter: (input, date, instance) => {
|
|
|
+ // Date() + 1 to fix issue on Safari with js-datepicker 5.18
|
|
|
+ if(global.lang=='fr') {
|
|
|
+ input.value = global.tools.pad(date.getUTCDate() + 1) + '/' +
|
|
|
+ global.tools.pad(date.getUTCMonth() + 1) + '/' +
|
|
|
+ date.getUTCFullYear();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ input.value = date.getUTCFullYear() + '-' +
|
|
|
+ global.tools.pad(date.getUTCMonth() + 1) + '-' +
|
|
|
+ global.tools.pad(date.getUTCDate() + 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ modify: function() {
|
|
|
+ let patient = app.form.convertToData('#form-patient-fix');
|
|
|
+
|
|
|
+ // Post data
|
|
|
+ let data = {
|
|
|
+ apiKey: '',
|
|
|
+ patient: patient,
|
|
|
+ type: app.data.user.type
|
|
|
+ }
|
|
|
+ // convert date format?
|
|
|
+ if(data.patient.birthDate.indexOf('/')!==-1) {
|
|
|
+ let t = data.patient.birthDate.split('/');
|
|
|
+ data.patient.birthDate = t[2]+'-'+t[1]+'-'+t[0];
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ app.preloader.show();
|
|
|
+ app.request.post(app.data.config.apiBaseURL + '/patient/modify/', data, function (data) {
|
|
|
+ // Process response
|
|
|
+ console.log("patient/modify", data);
|
|
|
+ app.preloader.hide();
|
|
|
+ if (data.result == 'ERROR') {
|
|
|
+ switch (data.reason) {
|
|
|
+ case 'denied':
|
|
|
+ app.methods.signout(global.tr[global.lang].topLevel.warning.disconnected);
|
|
|
+ break;
|
|
|
+ case 'internal_error':
|
|
|
+ app.dialog.alert(global.tr[global.lang].topLevel.error.internal_error);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $$('#form-patient-fix [name="'+data.reason+'"]').focus();
|
|
|
+ app.dialog.alert(global.tr[global.lang].topLevel.error.missing_fields+" (\""+data.reason+"\").");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $$('#toolbar-patient').click();
|
|
|
+ }
|
|
|
+ }, function (data) {
|
|
|
+ console.log('error', data);
|
|
|
+ app.preloader.hide();
|
|
|
+ app.dialog.alert(global.tr[global.lang].topLevel.error.server_unavailable);
|
|
|
+ }, 'json');
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|