first commit
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
$(document).ready(function () {
|
||||
function get_file_info(image_id, reload){
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/2_0/get_file_info/'+image_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
async: true,
|
||||
success: (data) => {
|
||||
console.log(data)
|
||||
tag_id = null;
|
||||
if (reload == true)
|
||||
$('#diagnoses_select').data('img', data['data']['hash_name']);
|
||||
if (data['data']['user'] == 'Neural Network')
|
||||
$('#nn_diagnos').text(data['data']['tag']);
|
||||
else
|
||||
{
|
||||
if(data['data']['tag_id'])
|
||||
{
|
||||
if (reload == true){
|
||||
$('#diagnoses_select').val(data['data']['tag_id']);
|
||||
$('#diagnoses_select').trigger('change');
|
||||
}
|
||||
}
|
||||
if (data['data']['nn'])
|
||||
$('#nn_diagnos').text(data['data']['nn']['tag']);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function save_select(element){
|
||||
if(element.value == 0)
|
||||
return;
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_name: $(element).data('img'),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/2.0/save_pic_diagnos',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
console.log(data);
|
||||
show_success('Данные сохранены', false);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('Не удалось сохранить данные', false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function select_fill(){
|
||||
lang = getUrlParameter('lang');
|
||||
$('#diagnoses_select').empty();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/'+$('#profarea').val()+'?lang='+lang,
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#diagnoses_select').append('<option value="0" disabled selected>Диагноз</option>');
|
||||
for(tag_num in data)
|
||||
{
|
||||
var tag = data[tag_num]
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
$('#diagnoses_select').append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function get_pics(){
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_new_files',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
let last_group = data['result']['groups'][0]
|
||||
let last_file = data['result'][last_group][data['result'][last_group].length-1]
|
||||
console.log(data['result'][last_group])
|
||||
let path = last_file['hash_name']
|
||||
if (last_file['id'] != $('#last_file').val()){
|
||||
$("#exam_time").text(' от '+last_file['index_date'])
|
||||
$('#nn_diagnos').text('');
|
||||
$('#diagnoses_select').val(0);
|
||||
$('#diagnoses_select').trigger('change');
|
||||
$('#last_file').val(last_file['id']);
|
||||
$('#video_play_file').hide();
|
||||
$('#video_controls').hide();
|
||||
$('#current_img').show();
|
||||
$('#current_img').attr('src', '/img/'+path);
|
||||
get_file_info(last_file['id'], true);
|
||||
select_fill();
|
||||
$('#diagnoses_select').on('change', function() {
|
||||
save_select(this);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($('#nn_diagnos').text() == '')
|
||||
{
|
||||
get_file_info(last_file['id'], false)
|
||||
}
|
||||
console.log('Nothing new')
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#diagnoses_select').select2();
|
||||
get_pics();
|
||||
setInterval(() => get_pics(), 5000);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,110 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
function update_pics(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/nikio/pics_list',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
async: !1,
|
||||
success: (data) => {
|
||||
$('#report_table').empty();
|
||||
$('#total_pics').text(data['desc']['total_pics']);
|
||||
$('#nn_true').text(data['desc']['nn_true']);
|
||||
$('#nn_err').text(data['desc']['nn_err']);
|
||||
$('#accuracy').text(Math.round(100/(data['desc']['nn_true']+data['desc']['nn_err'])*data['desc']['nn_true']));
|
||||
for(num in data['data'])
|
||||
{
|
||||
let btn = ''
|
||||
if (data['data'][num]['included'] == true){
|
||||
btn = '<div class="btn btn-danger x-icn exclude" data-pic_id="'+data['data'][num]['pic_id']+'"></div>'
|
||||
}
|
||||
else
|
||||
{
|
||||
btn = '<div class="btn btn-success check-icn include" data-pic_id="'+data['data'][num]['pic_id']+'"></div>'
|
||||
}
|
||||
let html_text = '<tr style="background-color:'+data['data'][num]['color']+'">'//
|
||||
html_text += '<td>'+data['data'][num]['init_user']+'</td><td><img src=/img/'+data['data'][num]['pic_src']+' style="max-width:256px;"></img></td>'+
|
||||
'<td>'+data['data'][num]['doctor_dianosis']+'</td>'+'<td>'+data['data'][num]['expert_dianosis']+'</td>'+
|
||||
'<td class="recalc" data-pic_id="'+data['data'][num]['pic_id']+'">'+data['data'][num]['nn_diagnosis']+'</td>'+
|
||||
'<td>'+btn+'</td>'
|
||||
html_text += '</tr>'
|
||||
$('#report_table').append(html_text);
|
||||
}
|
||||
exclude_pic();
|
||||
include_pic();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
update_pics();
|
||||
|
||||
$('#recalculate').click(function(){
|
||||
$.each($('.recalc'), function(e) {
|
||||
console.log($(this).data('pic_id'));
|
||||
var message = {
|
||||
pic_id: $(this).data('pic_id')
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/nikio/recalculate',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
console.log(data);
|
||||
$(this).text(data['data']['nn_diagnosis']);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
function exclude_pic(){
|
||||
$('.exclude').click(function(){
|
||||
console.log($(this).data('pic_id'));
|
||||
var message = {
|
||||
pic_id: $(this).data('pic_id')
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/nikio/exclude',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
update_pics()
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function include_pic(){
|
||||
$('.include').click(function(){
|
||||
console.log($(this).data('pic_id'));
|
||||
var message = {
|
||||
pic_id: $(this).data('pic_id')
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/nikio/include',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
console.log('OK')
|
||||
update_pics()
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
$(document).ready(function () {
|
||||
$('#clinic_select').on('change', function(){
|
||||
console.log('change')
|
||||
$('#answ_cards').append('<div class="col-xl-3 col-lg-4 col-md-6 clinic-card" data-clinic_id='+$(this).val()+'>' +
|
||||
'<div class="card mb-2">' +
|
||||
'<div class="modal-header px-3 py-2">' +
|
||||
'<p class="my-auto fw-bold">'+$("#clinic_select option:selected").text()+'</p>' +
|
||||
'<button type="button" data-bs-dismiss="modal" aria-label="Close" class="btn-close"></button>' +
|
||||
'</div>' +
|
||||
'<div class="card-body">' +
|
||||
'<p>Снимков за период: <span class="total fw-bold"></span></p>' +
|
||||
'<p>Изображения: <span class="images fw-bold"></span></p>' +
|
||||
'<p>Видео: <span class="videos fw-bold"></span></p>' +
|
||||
'<p>Другие: <span class="others fw-bold"></span></p>' +
|
||||
'<button class="btn btn-sm btn-primary" data-clinic_id='+$(this).val()+'>Просмотр</button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>')
|
||||
$('.btn-close').click(function(){
|
||||
$(this).parent().parent().parent().remove()
|
||||
})
|
||||
update();
|
||||
}
|
||||
)
|
||||
|
||||
function update(time_param){
|
||||
$.each($('.clinic-card'), function(e) {
|
||||
var start_date = $('#start_date').val();
|
||||
var end_date = $('#end_date').val();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/project_report/' + $(this).attr('data-clinic_id') + '?time_param='+time_param +'&start_date='+start_date +'&end_date='+end_date,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
console.log(data)
|
||||
$(this).find('.total').text(data['total']);
|
||||
$(this).find('.images').text(data['images']);
|
||||
$(this).find('.videos').text(data['videos']);
|
||||
$(this).find('.others').text(data['others']);
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
show_error('Не удалось загрузить данные',0);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
$('#today').on('click', function() {update('today')});
|
||||
$('#7days').on('click', function() {update('7days')});
|
||||
$('#30days').on('click', function() {update('30days')});
|
||||
$('#start_date').on('change', function() {update(null)});
|
||||
$('#end_date').on('change', function() {update(null)});
|
||||
// setInterval(() => update(), 1000);
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#add_patient').on('click', function(){add_patient(false)});
|
||||
$('#add_and_start_visit').on('click', function(){add_patient(true)});
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function add_patient(redirect){
|
||||
|
||||
fio = $('#fio').val();
|
||||
dob = $('#dob').val();
|
||||
med_card = $('#med_card').val();
|
||||
sex = $('#sex').val();
|
||||
telephone = $('#telephone').val();
|
||||
email = $('#email').val();
|
||||
false_form = false
|
||||
lang = getUrlParameter('lang');
|
||||
if(false_form==false)
|
||||
{
|
||||
var message = {
|
||||
fio: fio,
|
||||
dob:dob,
|
||||
med_card:med_card,
|
||||
sex:sex,
|
||||
telephone:telephone,
|
||||
email:email
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/add_patient',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
|
||||
if(redirect == true){
|
||||
if(lang == 'en')
|
||||
window.location.href = '/visit/new_visit?patient_id='+data['id']+'?lang=en';
|
||||
else
|
||||
window.location.href = '/visit/new_visit?patient_id='+data['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
fio = $('#fio').val('');
|
||||
dob = $('#dob').val('');
|
||||
med_card = $('#med_card').val('');
|
||||
sex = $('#sex').val('');
|
||||
telephone = $('#telephone').val('');
|
||||
email = $('#email').val('');
|
||||
// show_success('Пациент добавлен', false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.toast').toast({autohide:false});
|
||||
var cookie_life = new Date();
|
||||
cookie_life.setTime(cookie_life.getTime() + (20 * 60 * 1000));
|
||||
// $.cookie('adm_msg_timestamp', 2, { expires: cookie_life });
|
||||
// console.log($.cookie('adm_msg_timestamp'));
|
||||
check_cookies();
|
||||
setInterval(() => check_cookies(), 5000);
|
||||
|
||||
function check_cookies()
|
||||
{
|
||||
var url = '/adm_monitoring'
|
||||
if ($.cookie('adm_msg_timestamp'))
|
||||
url = '/adm_monitoring?timestamp='+$.cookie('adm_msg_timestamp')
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for (msg_num in data['result'])
|
||||
{
|
||||
if (data['result'][msg_num]['msg_timestamp'] > $.cookie('adm_msg_timestamp')){
|
||||
$('#msg_toast').toast('show');
|
||||
$('#toast_message').append('<span style="display: block; height: 50px;">'+data['result'][msg_num]['msg']+'</span>')
|
||||
}
|
||||
}
|
||||
$.cookie('adm_msg_timestamp', data['timestamp'], { expires: cookie_life });
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.toast').on('show.bs.toast', function () {
|
||||
this.hidden = false;
|
||||
}).on('hidden.bs.toast', function () {
|
||||
this.hidden = true;
|
||||
});
|
||||
|
||||
$('.close_toast').on('click', function () {
|
||||
this.hidden = false;
|
||||
$('#toast_message').empty()
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,136 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
function update_table(patient_id){
|
||||
$('#patient_routings').empty();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/routing/get_patient_routings/' + patient_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for(i in data['result'])
|
||||
{
|
||||
$('#patient_routings').append('<div class="col-4"><p>' +data['result'][i][1]+ '</p></div><div class="col-8"><p>' +data['result'][i][0]+ '</p></div>')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#complete').click(function(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/route/' + $('#visit_id').val(),
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
console.log(data);
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$.each($('.direction-modal'), function(e) {
|
||||
if($(this).data('visit_id') == $('#visit_id').val())
|
||||
{
|
||||
$(this).children('.complete_status').empty();
|
||||
$(this).children('.complete_status').append('<span style="color: #530FAD;" class="v-icn"></span>');
|
||||
$(this).data('completed', true);
|
||||
}
|
||||
});
|
||||
update_table($('#patient_id').val());
|
||||
$('#completed').show();
|
||||
$('#complete').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('Не удалось завершить визит',0);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
show_error('Не удалось завершить визит',0);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$('.direction-modal').click(function(){
|
||||
$('#patient_routings').empty();
|
||||
$('#direction_info').modal('toggle');
|
||||
let visit_id = $(this).data('visit_id');
|
||||
let patient_id = $(this).data('patient_id');
|
||||
let completed = $(this).data('completed');
|
||||
$('#add_reception').data('visit_id', visit_id);
|
||||
$('#add_reception').data('patient_id', patient_id);
|
||||
lang = getUrlParameter('lang');
|
||||
if(visit_id)
|
||||
{
|
||||
$('#user_report').show();
|
||||
$('#user_report').attr('href', '/medical_report/'+visit_id+'?nn_diagnos=true&lang='+lang);
|
||||
$('#visit_id').val(visit_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#user_report').hide();
|
||||
$('#visit_id').val('');
|
||||
}
|
||||
console.log('completed', completed)
|
||||
if(completed != undefined)
|
||||
{
|
||||
$('#completed').show();
|
||||
$('#complete').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#complete').show();
|
||||
$('#completed').hide();
|
||||
}
|
||||
if(patient_id)
|
||||
{
|
||||
$('#patient_info').show();
|
||||
$('#patient_info').attr('href', '/patient/'+patient_id+'?lang='+lang);
|
||||
$('#patient_id').val(patient_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#patient_info').hide();
|
||||
$('#patient_id').val('');
|
||||
}
|
||||
$('#patient_full_name').text('');
|
||||
$('#patient_dob').text('');
|
||||
$('#patient_telephone').text('');
|
||||
$('#patient_email').text('');
|
||||
$('#patient_visit_date').text('');
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/get_patient_info/' + patient_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#patient_full_name').text(data['full_name']);
|
||||
$('#patient_dob').text(data['dob']);
|
||||
$('#patient_telephone').text(data['telephone']);
|
||||
$('#patient_email').text(data['email']);
|
||||
}
|
||||
})
|
||||
update_table(patient_id);
|
||||
})
|
||||
|
||||
$('#add_reception').click(function(){
|
||||
patient_id = $(this).data('patient_id');
|
||||
clinic_rt_id = $('#reception_pat').val();
|
||||
var message = {
|
||||
patient_id: patient_id,
|
||||
clinic_rt_id: clinic_rt_id,
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/internal_route_patient',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType\
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
update_table(patient_id);
|
||||
$('#reception_pat').prop('selectedIndex',0);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
});
|
||||
@@ -0,0 +1,88 @@
|
||||
$(document).ready(function () {
|
||||
$('#submit_form').on("click", function()
|
||||
{
|
||||
var name = $('#form_name').val();
|
||||
var company = $('#form_company').val();
|
||||
var tel = $('#form_tel').val();
|
||||
var email = $('#form_email').val();
|
||||
var text = $('#form_text').val();
|
||||
$('#successAlert').hide(1000);
|
||||
$('#failAlert').hide(1000);
|
||||
var success = true;
|
||||
if(name.length == 0)
|
||||
{
|
||||
$('#form_name').css("background-color", "#ffaaaa");
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#form_name').css("background-color", "#fff");
|
||||
}
|
||||
if(company.length == 0)
|
||||
{
|
||||
$('#form_company').css("background-color", "#ffaaaa");
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#form_company').css("background-color", "#fff");
|
||||
}
|
||||
if(tel.length == 0)
|
||||
{
|
||||
$('#form_tel').css("background-color", "#ffaaaa");
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#form_tel').css("background-color", "#fff");
|
||||
}
|
||||
if(email.length == 0)
|
||||
{
|
||||
$('#form_email').css("background-color", "#ffaaaa");
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#form_email').css("background-color", "#fff");
|
||||
}
|
||||
if(text.length == 0)
|
||||
{
|
||||
$('#form_text').css("background-color", "#ffaaaa");
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#form_text').css("background-color", "#fff");
|
||||
}
|
||||
if(success==true)
|
||||
{
|
||||
console.log('sending');
|
||||
var message = {
|
||||
name: name,
|
||||
company:company,
|
||||
tel:tel,
|
||||
email:email,
|
||||
text:text
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/api/mail/send',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
|
||||
if(data=='True'){
|
||||
$('#successAlert').show(1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#failAlert').show(1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#callback_form')[0].reset();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,265 @@
|
||||
$(document).ready(function () {
|
||||
$("#gen_pass").click(function () {
|
||||
$("#password").val(makePassword(8));
|
||||
return false;
|
||||
});
|
||||
|
||||
function makePassword(length) {
|
||||
var result = '';
|
||||
var characters_g = 'AEIOUYaeiouy';
|
||||
var characters_s = 'BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz';
|
||||
var characters_g_Length = characters_g.length;
|
||||
var characters_s_Length = characters_s.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (i % 2 == 0) {
|
||||
result += characters_g.charAt(Math.floor(Math.random() * characters_g_Length));
|
||||
} else {
|
||||
result += characters_s.charAt(Math.floor(Math.random() * characters_s_Length));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
$('#add_user').on('click', function(){
|
||||
$('#username').css('background-color', '#fff');
|
||||
$('#password').css('background-color', '#fff');
|
||||
$('#full_name').css('background-color', '#fff');
|
||||
clinic_manager = $('#clinic_manager').prop("checked");
|
||||
examiner = $('#examiner').prop("checked");
|
||||
doctor = $('#doctor').prop("checked");
|
||||
directions = $('#directions').prop("checked");
|
||||
prof_doctor = $('#prof_doctor').prop("checked");
|
||||
username = $('#username').val();
|
||||
password = $('#password').val();
|
||||
notification_email = $('#notification_email').val();
|
||||
full_name = $('#full_name').val();
|
||||
false_form = false;
|
||||
if(!(directions))
|
||||
{
|
||||
directions = false;
|
||||
}
|
||||
|
||||
if(!(prof_doctor))
|
||||
{
|
||||
prof_doctor = false;
|
||||
}
|
||||
|
||||
|
||||
if(!(full_name))
|
||||
{
|
||||
$('#full_name').css('background-color', '#f55');
|
||||
full_name = true;
|
||||
}
|
||||
|
||||
if(!(username))
|
||||
{
|
||||
$('#username').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if(!(password))
|
||||
{
|
||||
$('#password').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
|
||||
if(false_form==false)
|
||||
{
|
||||
var message = {
|
||||
clinic_manager: clinic_manager,
|
||||
examiner: examiner,
|
||||
username:username,
|
||||
password:password,
|
||||
full_name:full_name,
|
||||
directions:directions,
|
||||
doctor:doctor,
|
||||
prof_doctor:prof_doctor,
|
||||
notification_email:notification_email
|
||||
}
|
||||
$.each($('.area_check'), function(e) {
|
||||
if($(this).prop('checked') == true)
|
||||
message['area'] = $(this).data('area_id');
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/ca_add_user',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#username').val('');
|
||||
$('#password').val('');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
$('#username').css('background-color', '#f55');
|
||||
if(data.hasOwnProperty('message'))
|
||||
{
|
||||
show_error(data.message,0);
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
if(data.hasOwnProperty('message'))
|
||||
{
|
||||
show_error('Ошибка при добавлении пользователя',0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
$('#edit_user').on('click', function(){
|
||||
$('#username').css('background-color', '#fff');
|
||||
$('#password').css('background-color', '#fff');
|
||||
$('#full_name').css('background-color', '#fff');
|
||||
manager_role = $('#manager_role').prop("checked");
|
||||
admin_role = $('#admin_role').prop("checked");
|
||||
examiner = $('#examiner').prop("checked");
|
||||
doctor = $('#doctor').prop("checked");
|
||||
directions = $('#directions').prop("checked");
|
||||
prof_doctor = $('#prof_doctor').prop("checked");
|
||||
password = $('#password').val();
|
||||
full_name = $('#full_name').val();
|
||||
notification_email = $('#notification_email').val();
|
||||
user_id = $('#user_id').val();
|
||||
false_form = false;
|
||||
if(!directions)
|
||||
directions = false
|
||||
if(!(prof_doctor))
|
||||
{
|
||||
prof_doctor = false;
|
||||
}
|
||||
|
||||
if(false_form==false)
|
||||
{
|
||||
var message = {
|
||||
password:password,
|
||||
full_name:full_name,
|
||||
examiner:examiner,
|
||||
manager:manager_role,
|
||||
admin: admin_role,
|
||||
user_id:user_id,
|
||||
directions:directions,
|
||||
doctor:doctor,
|
||||
prof_doctor:prof_doctor,
|
||||
notification_email:notification_email
|
||||
}
|
||||
console.log(message)
|
||||
$.each($('.area_check'), function(e) {
|
||||
if($(this).prop('checked') == true)
|
||||
message['area'] = $(this).data('area_id');
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/ca_update_user',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#username').val('');
|
||||
$('#password').val('');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
$('#username').css('background-color', '#f55');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
$('#recover_user').click(function(){
|
||||
|
||||
user_id = $('#user_id').val()
|
||||
var message = {
|
||||
user_id: user_id,
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/ca_recover_user',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#recover_user').hide();
|
||||
$('#delete_user').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Saving error')
|
||||
if(data['self_delete'] == true)
|
||||
$('#exception').html('Ошибка, действие не применимо к своему пользователю');
|
||||
else
|
||||
$('#exception').html('Ошибка, не удалось обновить информацию');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#delete_user').click(function(){
|
||||
user_id = $('#user_id').val()
|
||||
var message = {
|
||||
user_id: user_id,
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/ca_delete_user',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#recover_user').show();
|
||||
$('#delete_user').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
console.log('Saving error')
|
||||
if(data['self_delete'] == true)
|
||||
$('#exception').html('Ошибка, действие не применимо к своему пользователю');
|
||||
else
|
||||
$('#exception').html('Ошибка, не удалось обновить информацию');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,277 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#new_only').on('change', function() {
|
||||
view_new();
|
||||
});
|
||||
|
||||
function view_new(){
|
||||
if($('#new_only').prop('checked') == true)
|
||||
{
|
||||
$.each($('.accordion-item'), function(e) {
|
||||
if($(this).attr('data-answer') == 1)
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
else{
|
||||
$('.accordion-item').show();
|
||||
}
|
||||
}
|
||||
|
||||
function reload(){
|
||||
$('.diagnoses_select').on('change', function() {
|
||||
save_select(this);
|
||||
});
|
||||
|
||||
function save_select(element){
|
||||
var visit_id = $(element).data('visit_id');
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_id: $(element).data('pic_id'),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/save_pic_control_diagnos',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
|
||||
if(data['success'] == true)
|
||||
{
|
||||
console.log($('#uncf'+visit_id).text())
|
||||
$('#uncf'+visit_id).text($('#uncf'+visit_id).text()-1);
|
||||
if ($('#uncf'+visit_id).text() == 0)
|
||||
$('#uncf'+visit_id).hide()
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('.diagnoses_select').select2();
|
||||
|
||||
$('.close-modal').on('click', function(){
|
||||
$('#img_modal').modal('toggle');
|
||||
})
|
||||
|
||||
$('.zoom-img').on('click', function(){
|
||||
$('#img_modal').modal('toggle');
|
||||
$('#zoomed_img').attr('src', $(this).attr('src'));
|
||||
})
|
||||
}
|
||||
|
||||
$('#accordion_visits').on('hide.bs.collapse', function () {
|
||||
// console.log('hide');
|
||||
});
|
||||
|
||||
$('#accordion_visits').on('show.bs.collapse', function () {
|
||||
// console.log('show');
|
||||
});
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$('.accordion-collapse').on('show.bs.collapse', function () {
|
||||
var visit_id = $(this).data("visit_id");
|
||||
var tab_id = '#collapse_body_'+visit_id;
|
||||
var lang = getUrlParameter('lang');
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/get_clinic_select/"+visit_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var select = $("#select_diagnos")
|
||||
console.log(select.attr('id', "#select_diagnos"+visit_id))
|
||||
for (cln in data['clinic']) {
|
||||
select.append('<option value='+data['clinic'][cln]['id']+'>'+data['clinic'][cln]['clinic_name']+'</option>')
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$(tab_id).empty();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_control_visit_info/'+visit_id+'?lang=' + lang,
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var row = $('<div class="row"></div>').appendTo($(tab_id));
|
||||
var col2 = $('<div class="col-2"></div>').appendTo(row);
|
||||
var col10 = $('<div class="col-10"></div>').appendTo(row);
|
||||
col2.append('<h5>'+data['dict']['complaints']+'</h5>');
|
||||
col10.append('<p>'+data['complaints']+'</p>')
|
||||
var col2 = $('<div class="col-2"></div>').appendTo(row);
|
||||
var col10 = $('<div class="col-10"></div>').appendTo(row);
|
||||
col2.append('<h5>'+data['dict']['anamnesis']+'</h5>')
|
||||
col10.append('<p>'+data['anamnesis']+'</p>')
|
||||
var col2 = $('<div class="col-2"></div>').appendTo(row);
|
||||
var col10 = $('<div class="col-10"></div>').appendTo(row);
|
||||
col2.append('<h5>'+data['dict']['telephone']+'</h5>')
|
||||
col10.append('<p>'+data['telephone']+'</p>')
|
||||
var col2 = $('<div class="col-2"></div>').appendTo(row);
|
||||
var col10 = $('<div class="col-10"></div>').appendTo(row);
|
||||
col2.append('<h5>Email</h5>')
|
||||
col10.append('<p>'+data['email']+'</p>')
|
||||
var col2 = $('<div class="col-2"></div>').appendTo(row);
|
||||
var col10 = $('<div class="col-10"></div>').appendTo(row);
|
||||
col2.append('<h5>'+data['dict']['dob']+'</h5>')
|
||||
col10.append('<p>'+data['dob']+'</p>')
|
||||
|
||||
if (data['pics'].length > 0){
|
||||
var col4_1 = $('<div class="col-4"></div>').appendTo(row);
|
||||
var col4_2 = $('<div class="col-4"></div>').appendTo(row);
|
||||
var col4_3 = $('<div class="col-4"></div>').appendTo(row);
|
||||
col4_1.append('<p>'+data['dict']['snapshot']+'</p>')
|
||||
col4_2.append('<p>'+data['dict']['doctors_diagnosis']+'</p>')
|
||||
col4_3.append('<p>'+data['dict']['expert_diagnosis']+'</p>')
|
||||
}
|
||||
for(pic in data['pics'])
|
||||
{
|
||||
var col4_1 = $('<div class="col-4"></div>').appendTo(row);
|
||||
var col4_2 = $('<div class="col-4"></div>').appendTo(row);
|
||||
var col4_3 = $('<div class="col-4"></div>').appendTo(row);
|
||||
let path = data['pics'][pic]['src']
|
||||
let type = 'image'
|
||||
parts = path.split('.')
|
||||
if (['avi', 'mp4', 'webm', 'mkv', 'flv', 'wmv', 'mpeg'].includes(parts[parts.length - 1])) {
|
||||
type = 'video'
|
||||
}
|
||||
col4_1.append('<img src=/img/' + path + ' class="preview_img" style="padding: 10px;" data-type_file=' + type + ' data-path_file=' + path + '></img>')
|
||||
col4_2.append('<p>'+data['pics'][pic]['doctors_diagnosis']+'</p>')
|
||||
select = $('<select class="diagnoses_select form-control", id='+data['pics'][pic]['id']+' data-pic_id='+data['pics'][pic]['id']+' data-visit_id='+visit_id+'></select>').appendTo(col4_3);
|
||||
select.css('width','100%')
|
||||
select.append('<option value=0, selected, disabled>'+data['dict']['diagnosis']+'</option>')
|
||||
for(tag in data['tags'])
|
||||
{
|
||||
if(data['tags'][tag]['id'] == data['pics'][pic]['expert_diagnosis_id'])
|
||||
{
|
||||
select.append('<option selected, value='+data['tags'][tag]['id']+'>'+data['tags'][tag]['icd']+" "+data['tags'][tag]['name']+'</option>');
|
||||
}
|
||||
else
|
||||
{
|
||||
select.append('<option value='+data['tags'][tag]['id']+'>'+data['tags'][tag]['icd']+" "+data['tags'][tag]['name']+'</option>');
|
||||
}
|
||||
}
|
||||
select.val(data['pics'][pic]['expert_diagnosis_id']).trigger('change');
|
||||
}
|
||||
if(data['pirogov_answer'] == false)
|
||||
{
|
||||
|
||||
var col12 = $('<div class="row"></div>').appendTo(row);
|
||||
var button_route = $('<button class="btn btn-primary mt-5 col-3 offset-5" id="verify_routing_btn" data-visit_id="'+visit_id+'"data-patient_id='+ data.patient_id +'">'+data['dict']['verify_routing']+'</button>').appendTo(col12);
|
||||
|
||||
button_route.on('click', function() {
|
||||
|
||||
$('#direct_modal').modal('toggle');
|
||||
$('#dm_patinet').html(data['patient']);
|
||||
$('#send_direction').data('visit_id', visit_id);
|
||||
});
|
||||
var button = $('<button class="btn btn-success mt-5 col-3 offset-1" id="verify_control_btn" data-visit_id="'+visit_id+'">'+data['dict']['verify_control']+'</button>').appendTo(col12);
|
||||
button.on('click', function(){
|
||||
$('#conclusion_modal_visit_id').val($(this).data('visit_id'));
|
||||
$('#conclusion_modal').modal('show');
|
||||
});
|
||||
var row_s = $('<div class="row row_s"></div>').appendTo(row);
|
||||
|
||||
}
|
||||
|
||||
reload();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#conclusion_modal_verify_control_btn').click(function(){
|
||||
|
||||
var visit_id = $('#conclusion_modal_visit_id').val();
|
||||
message = {
|
||||
confirm_control: true,
|
||||
next_visit: $('#next_visit').val(),
|
||||
conclusion: $('#conclusion').val()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/2_0/visit_conclusion/'+visit_id,
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
$("#verify_routing_btn").hide();
|
||||
$("#verify_control_btn").hide();
|
||||
$('#badge'+visit_id).hide();
|
||||
$('#item_'+visit_id).attr('data-answer', 1);
|
||||
$('#conclusion_modal').modal('hide');
|
||||
view_new();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#send_direction').on('click', function() {
|
||||
var params = {
|
||||
visit_id: $(this).data('visit_id'),
|
||||
clinic_id: $('.direct_patient').val()
|
||||
};
|
||||
console.log(params);
|
||||
if (params['clinic_id'] == null) {
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/verify_route',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(params),
|
||||
success: (data) => {
|
||||
if (data['success'] == true) {
|
||||
$("#direct_modal").modal('hide');
|
||||
var smaul = $('<p class=" col-3 offset-5 text-success" id="dir_patient">Пациент перенаправлен в клинику "'+ $('.direct_patient option:selected').text() +'"<p>').appendTo($('.row_s'));
|
||||
|
||||
smaul.slideDown(500);
|
||||
smaul.delay(2000).slideUp();
|
||||
$("#verify_routing_btn").delay(5000).hide()
|
||||
$("#verify_control_btn").delay(5000).hide()
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,146 @@
|
||||
$(document).ready(function () {
|
||||
//https://medium.com/swlh/how-to-access-webcam-and-take-picture-with-javascript-b9116a983d78
|
||||
const webcamElement = document.getElementById('webcam');
|
||||
const canvasElement = document.getElementById('canvas');
|
||||
const snapSoundElement = document.getElementById('snapSound');
|
||||
const webcam = new Webcam(webcamElement, 'user', canvasElement, snapSoundElement);
|
||||
|
||||
webcam.start()
|
||||
.then(result =>{
|
||||
console.log("webcam started");
|
||||
$('#take_picture').focus();
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
$('#live_endocscopy_link').on('click', function(){
|
||||
if ($('#live_endocscopy_link').hasClass('active'))
|
||||
{
|
||||
webcam.start()
|
||||
.then(result =>{
|
||||
console.log("webcam started");
|
||||
$('#take_picture').focus();
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$(document).keypress(function(event){
|
||||
take_picture();
|
||||
});
|
||||
|
||||
$('#take_picture').on('click', function(){
|
||||
take_picture();
|
||||
})
|
||||
|
||||
$('.nav-link').on('click', function(){
|
||||
if ($(this).attr('id') != 'live_endocscopy_link')
|
||||
webcam.stop()
|
||||
});
|
||||
|
||||
function makeblob(dataURL) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',');
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = decodeURIComponent(parts[1]);
|
||||
return new Blob([raw], { type: contentType });
|
||||
}
|
||||
var parts = dataURL.split(BASE64_MARKER);
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = window.atob(parts[1]);
|
||||
var rawLength = raw.length;
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength);
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uInt8Array], { type: contentType });
|
||||
}
|
||||
|
||||
function loadWOrec(from, blob){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var organ = 0
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
organ = 1
|
||||
if($('#btnradio_throat').is(":checked"))
|
||||
organ = 2
|
||||
if($('#btnradio_nose').is(":checked"))
|
||||
organ = 3
|
||||
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
if (from == 'webcam')
|
||||
// $.each($('.endo_image'), function(e) {
|
||||
formData.append("files", makeblob(blob));
|
||||
i += 1;
|
||||
// });
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/device_test_img_upload',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
// $('#photos').empty();
|
||||
// $('#imgs_preview').empty();
|
||||
// $('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
for(fnum in data['files'])
|
||||
$('#photos').append('<div class="col-3 my-2"><button type="button" aria-label="Close" class="btn-close remove-picture" style="background-color: #0d6efd; display: block; position: absolute; margin: 5px;"></button><img class="endo_image" data-type="saved" data-name=' + data['files'][fnum] + ' id="rrr" src="/img/'+data['files'][fnum]+'" style="width: 100%;"></div>')
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
// after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
// after_error();
|
||||
}
|
||||
}
|
||||
|
||||
function take_picture(){
|
||||
let picture = webcam.snap();
|
||||
|
||||
// $('#download-photo').attr('src', picture);
|
||||
// $('#download').attr('href', picture);
|
||||
if($('#eleps').is(':checked'))
|
||||
loadWOrec('webcam', picture);
|
||||
else
|
||||
$('#photos').append('<div class="col-3 my-2"><button type="button" aria-label="Close" class="btn-close remove-picture" style="background-color: #0d6efd; display: block; position: absolute; margin: 5px;"></button><img class="endo_image" data-type="blob" id="rrr" src="'+picture+'" style="width: 100%;"></div>')
|
||||
$('.remove-picture').on('click', function(){
|
||||
$(this).parent().remove();
|
||||
})
|
||||
}
|
||||
|
||||
$('.remove-picture').on('click', function(){
|
||||
$(this).parent.remove();
|
||||
})
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,207 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
function clear_form(){
|
||||
$('#telephone').val('');
|
||||
$('#fio').val('');
|
||||
$('#dob').val('');
|
||||
$('#sex').val('');
|
||||
$('#complaints_input').val('');
|
||||
$('#anamnesis_input').val('');
|
||||
$('#short_endo_history').empty();
|
||||
$('#email').val('');
|
||||
$('#file_input').val(null);
|
||||
$('#imgs_preview').empty();
|
||||
}
|
||||
|
||||
function previewIMG(input, preview) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$(preview).attr('src', e.target.result);
|
||||
}
|
||||
reader.readAsDataURL(input);
|
||||
}
|
||||
|
||||
$('#add_direction').click(
|
||||
function(){startLoad(null)}
|
||||
);
|
||||
|
||||
$("#file_input").change(function(){
|
||||
$('#imgs_preview').empty();
|
||||
$('#file-input-greenspan').html('');
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#pre_load').hide();
|
||||
$('#file-input-greenspan').html('Загружено снимков: ' + $(this)[0].files.length);
|
||||
for(i=0;i<$(this)[0].files.length;i++)
|
||||
{
|
||||
if (($(this)[0].files[i].type.includes('image')))
|
||||
{
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-3 p-1 m-0');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'preview_img');
|
||||
previewIMG($(this)[0].files[i], $(img));
|
||||
div.appendChild(img);
|
||||
document.getElementById("imgs_preview").appendChild(div);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function update_select(profarea_update)
|
||||
{
|
||||
var lang = getUrlParameter('lang');
|
||||
var params = {
|
||||
clinic_id:$("#clinic_id").val(),
|
||||
profarea_id:$('#profarea_id').val(),
|
||||
lang:lang
|
||||
};
|
||||
var str_params = jQuery.param( params );
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_doctors_profiles?' + str_params,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#user_id').empty();
|
||||
if(profarea_update==false)
|
||||
{
|
||||
$('#profarea_id').empty();
|
||||
if(lang=='en')
|
||||
$('#profarea_id').append('<option value="0">Profile</option>');
|
||||
else
|
||||
$('#profarea_id').append('<option value="0">Профиль</option>');
|
||||
for(pa_i in data['profareas'])
|
||||
$('#profarea_id').append('<option value="'+data['profareas'][pa_i]['id']+'">'+data['profareas'][pa_i]['name']+'</option>');
|
||||
}
|
||||
for(pa_i in data['users'])
|
||||
$('#user_id').append('<option value="'+data['users'][pa_i]['id']+'">'+data['users'][pa_i]['name']+'</option>');
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#clinic_id").change(function(){
|
||||
update_select(false);
|
||||
});
|
||||
|
||||
$("#profarea_id").change(function(){
|
||||
update_select(true);
|
||||
});
|
||||
|
||||
function getId(str)
|
||||
{
|
||||
return(str.replaceAll(' ','').replaceAll(',','').replaceAll('.','').replaceAll(';','').replaceAll(':','').replaceAll('(','').replaceAll(')','').replaceAll('-','').replaceAll('/','').replaceAll('\\',''))
|
||||
}
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
function startLoad(nic_src){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Сохранение');
|
||||
var lang = getUrlParameter('lang');
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
console.log($('#clinic_id').val())
|
||||
if ($('#clinic_id').val() == 0 || $('#clinic_id').val() == null){
|
||||
$('#exception').html('Укажите клинику для направления');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
return
|
||||
}
|
||||
if ($('#profarea_id').val() == 0 || $('#clinic_id').val() == null){
|
||||
$('#exception').html('Укажите профиль направления');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
return
|
||||
}
|
||||
if ($('#telephone').val() == '' && $('#fio').val() == '' && $('#email').val() == ''){
|
||||
$('#exception').html('Укажите данные пациента');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
return
|
||||
}
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
var params = {
|
||||
telephone:$('#telephone').val(),
|
||||
fio:$('#fio').val(),
|
||||
email:$('#email').val(),
|
||||
dob:$('#dob').val(),
|
||||
sex:$('#sex').val(),
|
||||
complaints:$('#complaints_input').val(),
|
||||
anamnesis:$('#anamnesis_input').val(),
|
||||
lang:lang,
|
||||
clinic_id:$('#clinic_id').val(),
|
||||
profarea_id:$('#profarea_id').val(),
|
||||
user_id:$('#user_id').val()
|
||||
};
|
||||
if (nic_src){
|
||||
params['src'] = nic_src;
|
||||
}
|
||||
var str_params = jQuery.param( params );
|
||||
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/save_direction?' + str_params,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
async: true,
|
||||
success: (data) => {
|
||||
$('#success').html('Направление отправлено');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
clear_form();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
// after_error();
|
||||
$('#exception').html('Не удалось отправить направление');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,653 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.close-modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
});
|
||||
|
||||
$('#short_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), false, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').hide();
|
||||
$('#long_std').show();
|
||||
});
|
||||
|
||||
$('#long_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), true, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').show();
|
||||
$('#long_std').hide();
|
||||
});
|
||||
|
||||
$('.custom-input').on('focus focusout', function(){
|
||||
if($(this).val() == null || $(this).val() == '')
|
||||
{
|
||||
$($(this).parent()).removeClass('hastext');
|
||||
}
|
||||
else
|
||||
{
|
||||
$($(this).parent()).addClass('hastext');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function previewIMG(input, preview) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$(preview).attr('src', e.target.result);
|
||||
}
|
||||
reader.readAsDataURL(input);
|
||||
}
|
||||
|
||||
$("#file_input").change(function(){
|
||||
$('#imgs_preview').empty();
|
||||
$('#file-input-greenspan').html('');
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#pre_load').hide();
|
||||
$('#file-input-greenspan').html('Загружено снимков: ' + $(this)[0].files.length);
|
||||
for(i=0;i<$(this)[0].files.length;i++)
|
||||
{
|
||||
if (($(this)[0].files[i].type.includes('image')))
|
||||
{
|
||||
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-3 p-1 m-0');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'preview_img');
|
||||
previewIMG($(this)[0].files[i], $(img));
|
||||
|
||||
div.appendChild(img);
|
||||
document.getElementById("imgs_preview").appendChild(div);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#endo_tab_link').on('click', function()
|
||||
{
|
||||
load__endo_history(true);
|
||||
});
|
||||
|
||||
$('#nn_tab_link').on('click', function()
|
||||
{
|
||||
load__endo_history(true);
|
||||
});
|
||||
|
||||
function reload_visit_info(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/reload_visit_info/' + $('#visit_id').val() + '?task=off'+'&lang='+lang,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
load__endo_history(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function load__endo_history(rvn){
|
||||
$('#endo_history').empty();
|
||||
if(rvn)
|
||||
{
|
||||
reload_visit_info();
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_visit_info_alt/'+$('#visit_id').val(),
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentTypestatus
|
||||
success: (data) => {
|
||||
$('#endo_history').empty();
|
||||
var label_id = 0
|
||||
console.log(data['pics'])
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
organ = ''
|
||||
if (pic['organ'])
|
||||
{
|
||||
organ = pic['organ']
|
||||
}
|
||||
type = 'image'
|
||||
parts = pic['hash_name'].split('.')
|
||||
if (['avi', 'mp4', 'webm', 'mkv', 'flv', 'wmv', 'mpeg'].includes(parts[parts.length - 1])) {
|
||||
type = 'video'
|
||||
}
|
||||
if(pic.hasOwnProperty('nn_tag'))
|
||||
{
|
||||
//Нейросеть
|
||||
if($('#language').val() == 'ru')
|
||||
$('#endo_history').append('<tr><td scope="col" id="click"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'>'+pic['nn_icd']+' '+pic['nn_tag']+'</span><span class="standart_modal btn btn-primary btn-sm" data-code="'+pic['nn_icd']+'">Стандарт</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт<span></td></tr>');
|
||||
else
|
||||
$('#endo_history').append('<tr><td scope="col" id="click"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'>'+pic['nn_icd']+' '+pic['nn_tag']+'</span><span class="standart_modal btn btn-primary btn-sm" data-code="'+pic['nn_icd']+'">Standart</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart<span></td></tr>');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Без описания
|
||||
if($('#language').val() == 'ru')
|
||||
$('#endo_history').append('<tr><td scope="col"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'></span><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td></tr>');
|
||||
else
|
||||
$('#endo_history').append('<tr><td scope="col"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'></span><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td></tr>');
|
||||
}
|
||||
|
||||
label_id = label_id + 1
|
||||
}
|
||||
select_fill();
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
if(pic.hasOwnProperty('confirmed')){
|
||||
if(pic['confirmed'] == true)
|
||||
{
|
||||
$.each($('.expert_diagnos'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
console.log(pic[0]['icd']);
|
||||
$(this).html(pic[0]['icd']+' '+pic[0]['tag'])
|
||||
$(this).parent().children('.standart_modal').data('tag_id', pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
if($(this).data('img') == pic['hash_name'])
|
||||
{
|
||||
$(this).val(pic['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
$('.standart_modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
standart_load($(this).data('code'), false, $(this).data('tag_id'));
|
||||
})
|
||||
$('.diagnoses_select').on('change', function() {
|
||||
save_select(this);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
});
|
||||
$('.diagnoses_select').select2();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//saving on select change OK FOR MULTIPROFILE
|
||||
function save_select(element){
|
||||
// console.log(element.value);
|
||||
// console.log($(element).data('img'));
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_name: $(element).data('img'),
|
||||
visit_id: $('#visit_id').val(),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/save_pic_diagnos',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$(element).parent().children('.standart_modal').data('code', data['icd']);
|
||||
$(element).parent().children('.standart_modal').data('tag_id', data['tag_id']);
|
||||
$('#success').html('Диагноз сохранен');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getId(str)
|
||||
{
|
||||
return(str.replaceAll(' ','').replaceAll(',','').replaceAll('.','').replaceAll(';','').replaceAll(':','').replaceAll('(','').replaceAll(')','').replaceAll('-','').replaceAll('/','').replaceAll('\\',''))
|
||||
}
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function standart_load(code, full, tag_id){
|
||||
$('#cur_modal_std').val(code);
|
||||
$('#cur_modal_tag_id').val(tag_id);
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_standart?icd='+code+'&tag_id='+tag_id+'&lang='+lang,
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html(data['standart_name']);
|
||||
if(lang == 'en'){
|
||||
$('#standart_diagnos').html('Diagnosis: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Type of standard: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('ICD-10 code: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Treatment time (days): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
try{
|
||||
if(data['standart_text_en'] != undefined){
|
||||
$('#standart_body').append('<hr>');
|
||||
$('#standart_body').append('<p class="mt-3">'+data['standart_text_en']+'</p>');
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.log('error_standart_text_en')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#standart_diagnos').html('Диагноз: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Вид стандарта: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('Код по МКБ-10: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Сроки лечения (дней): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
try{
|
||||
if(data['standart_text'] != undefined)
|
||||
{
|
||||
$('#standart_body').append('<hr>');
|
||||
$('#standart_body').append('<p class="mt-3">'+data['standart_text']+'</p>');
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.log('error_standart_text')
|
||||
}
|
||||
}
|
||||
var groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if (!(groups.includes(std['service_type'])))
|
||||
{
|
||||
groups.push(std['service_type'])
|
||||
$('#standart_body').append('<h5>'+std['service_type']+'</h5><div id="group'+getId(std['service_type'])+'"></div>');
|
||||
}
|
||||
}
|
||||
var sub_groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
for (group in groups){
|
||||
if(!($('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype'])) == true))
|
||||
{
|
||||
$('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype']), true);
|
||||
$('#group'+getId(std['service_type'])).append('<p>'+std['service_subtype']+'</p>');
|
||||
if(lang == 'en')
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Medical Service Code</th><th scope="col">Name</th><th scope="col">Approximate frequency of presentation</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
else
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Код медицинской услуги</th><th scope="col">Наименование</th><th scope="col">Примерная частота представления</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
if(full == true){
|
||||
var std = data['standart'][std_num]
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if(std['periodicity'] == '1'){
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$('#copy_text').data('text', data['for_copy'])
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html('');
|
||||
$('#standart_diagnos').html('');
|
||||
$('#standart_type').html('');
|
||||
$('#standart_icd_code').html('');
|
||||
$('#standart_time').html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#copy_text').on("click", function(){
|
||||
$('#text_to_copy').html($('#copy_text').data('text'));
|
||||
function listener(e) {
|
||||
str = document.getElementById('text_to_copy').innerHTML
|
||||
e.clipboardData.setData("text/html", str);
|
||||
e.clipboardData.setData("text/plain", str);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
$('#copy_text').addClass('check-icn');
|
||||
setTimeout(function() {
|
||||
$('#copy_text').removeClass('check-icn');
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
$('#start_rec').on("click", function()
|
||||
{
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
startRec('source');
|
||||
else
|
||||
loadWOrec('source');
|
||||
});
|
||||
|
||||
$('#save_picture').on("click", function()
|
||||
{
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
startRec('webcam');
|
||||
else
|
||||
loadWOrec('webcam');
|
||||
});
|
||||
|
||||
function makeblob(dataURL) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',');
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = decodeURIComponent(parts[1]);
|
||||
return new Blob([raw], { type: contentType });
|
||||
}
|
||||
var parts = dataURL.split(BASE64_MARKER);
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = window.atob(parts[1]);
|
||||
var rawLength = raw.length;
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength);
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uInt8Array], { type: contentType });
|
||||
}
|
||||
|
||||
function loadWOrec(from){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var organ = 0
|
||||
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
$.each($('.endo_image'), function(e) {
|
||||
formData.append("files", makeblob($(this).attr('src')));
|
||||
i += 1;
|
||||
});
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/save_images?patient_id='+$('#patient_id').val()+'&organ='+organ+'&visit_id='+$('#visit_id').val()+'&profarea_id='+'2',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function startRec(from){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var lang = getUrlParameter('lang');
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
var img_in_params = ''
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
$.each($('.endo_image'), function(e) {
|
||||
if($(this).data('type') == "blob")
|
||||
formData.append("files", makeblob($(this).attr('src')));
|
||||
else
|
||||
{
|
||||
formData.append("files", $(this).attr('src'));
|
||||
img_in_params = img_in_params + $(this).data('name') + ','
|
||||
}
|
||||
i += 1;
|
||||
});
|
||||
let searchParams = new URLSearchParams(window.location.search)
|
||||
force_ear = searchParams.has('force_ear');
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/start_flebo_image_diagnostics?patient_id='+$('#patient_id').val()+'&visit_id='+$('#visit_id').val() + '&imgs='+img_in_params + '&force_ear='+force_ear+'&lang=' + lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#progress_text').html('Распознание диагноза');
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3)
|
||||
after_error();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
|
||||
function check_image_output(task_id)
|
||||
{
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/flebo_status/'+task_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
// console.log(data);
|
||||
if('status_id' in data){
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3)
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select_fill(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/2'+'?lang='+lang,
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
// console.log(data);
|
||||
for(tag_num in data)
|
||||
{
|
||||
var tag = data[tag_num]
|
||||
// console.log(tag);
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
// console.log(icd);
|
||||
$(this).append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
// $('#diagnoses_tags').append('<div class="custom-control custom-checkbox my-1 mr-sm-2 checktag"><input type="checkbox" id="tag'+tag['id']
|
||||
// +'" data-name="'+tag['name']+'" class="custom-control-input checkitem"><label for="tag'+tag['id']+'" class="custom-control-label">'+icd+tag['name']+'</label></div>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#receptions').select2({tags: true});
|
||||
|
||||
function update_table()
|
||||
{
|
||||
$('#receptions_table').empty();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/get_clinic_receptions/' + $('#clinic').val(),
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for(i in data['receptions'])
|
||||
{
|
||||
console.log(data['receptions'][i])
|
||||
$('#receptions_table').append('<tr><td>'+data['receptions'][i]['name']+'</td><td><input class="reception-price" data-rt_id='+data['receptions'][i]['id']+' type="number", value=' +data['receptions'][i]['price']+ '></input></td><tr>')
|
||||
|
||||
$('.reception-price').change(function(){
|
||||
update_price($(this).data('rt_id'), $(this).val())
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function update_price(rt_id, price){
|
||||
var message = {
|
||||
rt_id: rt_id,
|
||||
price: price
|
||||
}
|
||||
console.log(message)
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/internal_route/update_price',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType\
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#clinic').change(function(){
|
||||
update_table();
|
||||
})
|
||||
|
||||
$('#add_reception').click(function(){
|
||||
$('#receptions_table').empty();
|
||||
var message = {
|
||||
reception: $('#receptions').val(),
|
||||
price: $('#price').val(),
|
||||
clinic_id: $('#clinic').val(),
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/internal_route/add',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType\
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
update_table();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
function set_lang(lang){
|
||||
var cookie_life = new Date();
|
||||
cookie_life.setTime(cookie_life.getTime() + (20 * 60 * 1000));
|
||||
$.cookie('lang', lang, { expires: cookie_life });
|
||||
}
|
||||
|
||||
$('#to_ru_lang').click(function(){
|
||||
set_lang('ru');
|
||||
window.location.href = window.location.origin + window.location.pathname;
|
||||
})
|
||||
|
||||
$('#to_en_lang').click(function(){
|
||||
set_lang('en');
|
||||
window.location.href = window.location.origin + window.location.pathname;
|
||||
})
|
||||
|
||||
|
||||
|
||||
//Для DEMO
|
||||
$('#demo_modal').modal('show');
|
||||
|
||||
if($('#demo_password').length == 0)
|
||||
setTimeout(function() { $('#demo_modal').modal('hide'); }, 3000);
|
||||
|
||||
|
||||
|
||||
$('.close_modal').click(function(){
|
||||
$('#'+$(this).data('dismiss')).modal('hide');
|
||||
})
|
||||
|
||||
$('#full_vers').click(function () {
|
||||
$('#feedbackModal').modal('show');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,664 @@
|
||||
$(document).ready(function () {
|
||||
$("#fio").select2({
|
||||
tags: true
|
||||
});
|
||||
$("#fio").on("change", function() {
|
||||
id = this.value;
|
||||
text = $( "#fio option:selected" ).text();
|
||||
if (id == text)
|
||||
{
|
||||
console.log('New Patient');
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/get_patient_clinic/' + id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$("#med_card").val(data['card_number']);
|
||||
$("#telephone").val(data['telephone']);
|
||||
$("#dob").val(data['dob']);
|
||||
$("#sex").val(data['sex']);
|
||||
$("#email").val(data['email']);
|
||||
updateInfo();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
load__endo_history(true);
|
||||
|
||||
function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$('.close-modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
});
|
||||
|
||||
$('#short_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), false, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').hide();
|
||||
$('#long_std').show();
|
||||
});
|
||||
|
||||
$('#long_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), true, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').show();
|
||||
$('#long_std').hide();
|
||||
});
|
||||
|
||||
$('#med_card').on('change', function(){updateInfo()});
|
||||
$('#telephone').on('change', function(){updateInfo()});
|
||||
// $('#fio').on('change', function(){updateInfo()});
|
||||
$('#dob').on('change', function(){updateInfo()});
|
||||
$('#sex').on('change', function(){updateInfo()});
|
||||
$('#complaints_input').on('change', function(){updateInfo()});
|
||||
$('#anamnesis_input').on('change', function(){updateInfo()});
|
||||
|
||||
function complete_med_exam(visit_id){
|
||||
var message = {
|
||||
visit_id : visit_id
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/complete_med_exam',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
show_success('Профосмотр сохранён', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('Не удалось завершить профосмотр' ,0);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('Не удалось завершить профосмотр' ,0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.clear_med_exam').click(function(){
|
||||
if($( "#fio option:selected" ).text() == '')
|
||||
{
|
||||
show_error('none_patient', 0)
|
||||
return;
|
||||
}
|
||||
$('#med_card').val('');
|
||||
$('#telephone').val('');
|
||||
$("#fio").val('0').prop('selected', true);
|
||||
$('#fio').select2({tags: true});
|
||||
$('#dob').val('');
|
||||
$('#sex').val('');
|
||||
$('#complaints_input').val('');
|
||||
$('#anamnesis_input').val('');
|
||||
$('#short_endo_history').empty();
|
||||
let visit_id = $('#visit_id').val();
|
||||
complete_med_exam(visit_id);
|
||||
updateStatus();
|
||||
location.reload();
|
||||
// $.ajax({
|
||||
// type:'GET',
|
||||
// url: '/get_new_visit_id',
|
||||
// processData: false, // tell jQuery not to process the data
|
||||
// contentType: false, // tell jQuery not to set contentType
|
||||
// success: (data) => {
|
||||
// $('#visit_id').val(data['visit_id']);
|
||||
// },
|
||||
// error:function (jqXHR, exception) {
|
||||
// after_error();
|
||||
// }
|
||||
// });
|
||||
|
||||
})
|
||||
|
||||
function updateInfo(){
|
||||
updateStatus();
|
||||
if ($('#visit_id').val())
|
||||
startLoad(null)
|
||||
else
|
||||
console.log('no visit')
|
||||
}
|
||||
|
||||
function previewIMG(input, preview) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$(preview).attr('src', e.target.result);
|
||||
}
|
||||
reader.readAsDataURL(input);
|
||||
}
|
||||
|
||||
$("#file_input").change(function(){
|
||||
$('#imgs_preview').empty();
|
||||
$('#file-input-greenspan').html('');
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#pre_load').hide();
|
||||
$('#file-input-greenspan').html('Загружено снимков: ' + $(this)[0].files.length);
|
||||
for(i=0;i<$(this)[0].files.length;i++)
|
||||
{
|
||||
if (($(this)[0].files[i].type.includes('image')))
|
||||
{
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-3 p-1 m-0');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'preview_img');
|
||||
previewIMG($(this)[0].files[i], $(img));
|
||||
div.appendChild(img);
|
||||
document.getElementById("imgs_preview").appendChild(div);
|
||||
startLoad(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function reload_visit_info(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/reload_visit_info/' + $('#visit_id').val() + '?task=off'+'&lang='+lang,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
//load__endo_history(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function load__endo_history(rvn){
|
||||
$('#short_endo_history').empty();
|
||||
if(rvn)
|
||||
reload_visit_info();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_visit_info/' + $('#visit_id').val() + '?task=off',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentTypestatus
|
||||
success: (data) => {
|
||||
$('#short_endo_history').empty();
|
||||
var label_id = 0
|
||||
for (untask_num in data['untask_pics'])
|
||||
{
|
||||
pic = data['untask_pics'][untask_num]
|
||||
organ = ''
|
||||
if (pic['organ'])
|
||||
{
|
||||
organ = pic['organ']
|
||||
}
|
||||
if($('#language').val() == 'ru')
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+pic['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+pic['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td></tr>');
|
||||
else
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+pic['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+pic['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Diagnosis</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td></tr>');
|
||||
label_id = label_id + 1
|
||||
}
|
||||
for (task_num in data['tasks'])
|
||||
{
|
||||
task = data['tasks'][task_num]
|
||||
|
||||
if ('task' in task)
|
||||
if (task['task'])
|
||||
if ('result' in task['task'])
|
||||
for (result_num in task['task']['result'])
|
||||
{
|
||||
result = task['task']['result'][result_num]
|
||||
var code = ''
|
||||
var name = ''
|
||||
var probability = 0
|
||||
if ('diseases' in result)
|
||||
for (d_num in result['diseases'])
|
||||
{
|
||||
disease = result['diseases'][d_num]
|
||||
if(disease['probability'] > probability)
|
||||
{
|
||||
probability = disease['probability']
|
||||
code = disease['code']
|
||||
name = disease['name']
|
||||
}
|
||||
}
|
||||
var organ = result['organ']
|
||||
if (organ == undefined)
|
||||
organ = 'Ошибка - '+task['task']['status']
|
||||
if (probability > 0)
|
||||
if($('#language').val() == 'ru')
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт<span></td></tr>');
|
||||
else
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart<span></td></tr>');
|
||||
else
|
||||
if($('#language').val() == 'ru')
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт<span></td></tr>');
|
||||
else
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100" ><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart<span></td></tr>');
|
||||
label_id = label_id + 1
|
||||
}
|
||||
}
|
||||
select_fill();
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
if (pic.length > 0){
|
||||
if(pic.length > 1)
|
||||
{
|
||||
console.log('Обнаружены снимки с дублирующимся описанием')
|
||||
}
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
$(this).val(pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for (pic_num in data['expert_pics'])
|
||||
{
|
||||
pic = data['expert_pics'][pic_num]
|
||||
if (pic.length > 0){
|
||||
if(pic.length > 1)
|
||||
{
|
||||
console.log('Обнаружены снимки с дублирующимся экспертым описанием')
|
||||
}
|
||||
|
||||
$.each($('.expert_diagnos'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
$(this).html(pic[0]['icd']+' '+pic[0]['tag'])
|
||||
$(this).parent().children('.standart_modal').data('tag_id', pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
$('.standart_modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
standart_load($(this).data('code'), false, $(this).data('tag_id'));
|
||||
})
|
||||
$('.preview_img').click(function(){
|
||||
$(this).attr('src', $(this).attr('src')+getRandomInt(99));
|
||||
})
|
||||
$('.diagnoses_select').on('change', function() {
|
||||
save_select(this);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
});
|
||||
$('.diagnoses_select').select2();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//saving on select change
|
||||
function save_select(element){
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_name: $(element).data('img'),
|
||||
visit_id: $('#visit_id').val(),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/save_pic_diagnos',
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$(element).parent().children('.standart_modal').data('code', data['icd']);
|
||||
$(element).parent().children('.standart_modal').data('tag_id', data['tag_id']);
|
||||
$('#success').html('Диагноз сохранен');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getId(str)
|
||||
{
|
||||
return(str.replaceAll(' ','').replaceAll(',','').replaceAll('.','').replaceAll(';','').replaceAll(':','').replaceAll('(','').replaceAll(')','').replaceAll('-','').replaceAll('/','').replaceAll('\\',''))
|
||||
}
|
||||
|
||||
function standart_load(code, full, tag_id){
|
||||
$('#cur_modal_std').val(code);
|
||||
$('#cur_modal_tag_id').val(tag_id);
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_standart?icd='+code+'&tag_id='+tag_id+'&lang='+lang,
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html(data['standart_name']);
|
||||
if(lang == 'en'){
|
||||
$('#standart_diagnos').html('Diagnosis: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Type of standard: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('ICD-10 code: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Treatment time (days): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#standart_diagnos').html('Диагноз: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Вид стандарта: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('Код по МКБ-10: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Сроки лечения (дней): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
var groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if (!(groups.includes(std['service_type'])))
|
||||
{
|
||||
groups.push(std['service_type'])
|
||||
$('#standart_body').append('<h5>'+std['service_type']+'</h5><div id="group'+getId(std['service_type'])+'"></div>');
|
||||
}
|
||||
}
|
||||
var sub_groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
for (group in groups){
|
||||
if(!($('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype'])) == true))
|
||||
{
|
||||
$('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype']), true);
|
||||
$('#group'+getId(std['service_type'])).append('<p>'+std['service_subtype']+'</p>');
|
||||
if(lang == 'en')
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Medical Service Code</th><th scope="col">Name</th><th scope="col">Approximate frequency of presentation</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
else
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Код медицинской услуги</th><th scope="col">Наименование</th><th scope="col">Примерная частота представления</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
if(full == true){
|
||||
var std = data['standart'][std_num]
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if(std['periodicity'] == '1'){
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$('#copy_text').data('text', data['for_copy'])
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html('');
|
||||
$('#standart_diagnos').html('');
|
||||
$('#standart_type').html('');
|
||||
$('#standart_icd_code').html('');
|
||||
$('#standart_time').html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('#copy_text').on("click", function(){
|
||||
$('#text_to_copy').html($('#copy_text').data('text'));
|
||||
function listener(e) {
|
||||
str = document.getElementById('text_to_copy').innerHTML
|
||||
e.clipboardData.setData("text/html", str);
|
||||
e.clipboardData.setData("text/plain", str);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
$('#copy_text').addClass('check-icn');
|
||||
setTimeout(function() {
|
||||
$('#copy_text').removeClass('check-icn');
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
//Мониторинг новых снимков
|
||||
if ($('#visit_profarea').val() == 1){
|
||||
var cookie_life = new Date();
|
||||
cookie_life.setTime(cookie_life.getTime() + (20 * 60 * 1000));
|
||||
check_cookies();
|
||||
setInterval(() => check_cookies(), 5000);
|
||||
|
||||
function check_cookies()
|
||||
{
|
||||
if (!document.hidden) {
|
||||
var url = '/new_images_monitoring'
|
||||
if ($.cookie('images_timestamp'))
|
||||
url = '/new_images_monitoring?timestamp='+$.cookie('images_timestamp')
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for (msg_num in data['result'])
|
||||
{
|
||||
if (data['result'][msg_num]['timestamp'] > $.cookie('images_timestamp'))
|
||||
{
|
||||
if ($('#nic_saving').length > 0)
|
||||
{
|
||||
$('#request_waiting').show();
|
||||
startLoad(data['result'][msg_num]['src']);
|
||||
}
|
||||
// $('#request_waiting').hide();
|
||||
}
|
||||
}
|
||||
$.cookie('images_timestamp', data['timestamp'], { expires: cookie_life });
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatus(){
|
||||
var piece = 100/8;
|
||||
var width = 0;
|
||||
if ($('#med_card').val())
|
||||
width = width + piece;
|
||||
if ($('#telephone').val())
|
||||
width = width + piece;
|
||||
if ($('#fio').val())
|
||||
width = width + piece;
|
||||
if ($('#dob').val())
|
||||
width = width + piece;
|
||||
if ($('#sex').val())
|
||||
width = width + piece;
|
||||
if ($('#email').val())
|
||||
width = width + piece;
|
||||
// if ($('#visit_id').val())
|
||||
// width = width + piece;
|
||||
if ($('#complaints_input').val())
|
||||
width = width + piece;
|
||||
if ($('#anamnesis_input').val())
|
||||
width = width + piece;
|
||||
$('#exam_progress').css('width', width+'%');
|
||||
}
|
||||
|
||||
function startLoad(nic_src){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Сохранение');
|
||||
var lang = getUrlParameter('lang');
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
var params = {
|
||||
profarea:$('#visit_profarea').val(),
|
||||
med_card:$('#med_card').val(),
|
||||
telephone:$('#telephone').val(),
|
||||
fio:$('#fio').val(),
|
||||
dob:$('#dob').val(),
|
||||
sex:$('#sex').val(),
|
||||
email:$('#email').val(),
|
||||
visit_id:$('#visit_id').val(),
|
||||
complaints:$('#complaints_input').val(),
|
||||
anamnesis:$('#anamnesis_input').val(),
|
||||
lang:lang
|
||||
};
|
||||
fio_id = $("#fio").val();
|
||||
fio_text = $( "#fio option:selected" ).text();
|
||||
if (fio_id == fio_text)
|
||||
{
|
||||
params['fio'] = fio_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
params['patient_id'] = fio_id;
|
||||
}
|
||||
if (nic_src){
|
||||
params['src'] = nic_src;
|
||||
}
|
||||
var str_params = jQuery.param( params );
|
||||
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/save_med_exam?' + str_params,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
async: true,
|
||||
success: (data) => {
|
||||
$('#visit_id').val(data['visit_id']);
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
updateStatus();
|
||||
if(i > 0)
|
||||
load__endo_history(true);
|
||||
if(nic_src)
|
||||
load__endo_history(true);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select_fill(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/'+$('#visit_profarea').val()+'?lang='+lang,
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
for(tag_num in data) {
|
||||
var tag = data[tag_num]
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
$(this).append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,603 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#fio").select2({
|
||||
tags: true
|
||||
});
|
||||
$("#fio").on("change", function() {
|
||||
id = this.value;
|
||||
text = $( "#fio option:selected" ).text();
|
||||
if (id == text)
|
||||
{
|
||||
console.log('New Patient');
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/get_patient_clinic/' + id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$("#med_card").val(data['card_number']);
|
||||
$("#telephone").val(data['telephone']);
|
||||
$("#dob").val(data['dob']);
|
||||
$("#sex").val(data['sex']);
|
||||
updateInfo();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
load__endo_history(true);
|
||||
|
||||
function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$('.close-modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
});
|
||||
|
||||
$('#short_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), false, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').hide();
|
||||
$('#long_std').show();
|
||||
});
|
||||
|
||||
$('#long_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), true, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').show();
|
||||
$('#long_std').hide();
|
||||
});
|
||||
|
||||
$('#med_card').on('change', function(){updateInfo()});
|
||||
$('#telephone').on('change', function(){updateInfo()});
|
||||
// $('#fio').on('change', function(){updateInfo()});
|
||||
$('#dob').on('change', function(){updateInfo()});
|
||||
$('#sex').on('change', function(){updateInfo()});
|
||||
$('#complaints_input').on('change', function(){updateInfo()});
|
||||
$('#anamnesis_input').on('change', function(){updateInfo()});
|
||||
|
||||
function complete_med_exam(visit_id){
|
||||
var message = {
|
||||
visit_id : visit_id
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/complete_med_exam',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
show_success('Профосмотр сохранён', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('Не удалось завершить профосмотр' ,0);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('Не удалось завершить профосмотр' ,0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#clear_med_exam').click(function(){
|
||||
|
||||
$('#med_card').val('');
|
||||
$('#telephone').val('');
|
||||
$('#fio').val('');
|
||||
$('#dob').val('');
|
||||
$('#sex').val('');
|
||||
$('#complaints_input').val('');
|
||||
$('#anamnesis_input').val('');
|
||||
$('#short_endo_history').empty();
|
||||
let visit_id = $('#visit_id').val();
|
||||
complete_med_exam(visit_id);
|
||||
updateStatus();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_new_visit_id',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#visit_id').val(data['visit_id']);
|
||||
console.log('New visit ID');
|
||||
console.log($('#visit_id').val());
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
function updateInfo(){
|
||||
updateStatus();
|
||||
if ($('#visit_id').val())
|
||||
startLoad(null)
|
||||
else
|
||||
console.log('no visit')
|
||||
}
|
||||
|
||||
function previewIMG(input, preview) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$(preview).attr('src', e.target.result);
|
||||
}
|
||||
reader.readAsDataURL(input);
|
||||
}
|
||||
|
||||
$("#file_input").change(function(){
|
||||
$('#imgs_preview').empty();
|
||||
$('#file-input-greenspan').html('');
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#pre_load').hide();
|
||||
$('#file-input-greenspan').html('Загружено снимков: ' + $(this)[0].files.length);
|
||||
for(i=0;i<$(this)[0].files.length;i++)
|
||||
{
|
||||
if (($(this)[0].files[i].type.includes('image')))
|
||||
{
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-3 p-1 m-0');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'preview_img');
|
||||
previewIMG($(this)[0].files[i], $(img));
|
||||
div.appendChild(img);
|
||||
document.getElementById("imgs_preview").appendChild(div);
|
||||
startLoad(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function reload_visit_info(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/reload_visit_info/' + $('#visit_id').val() + '?task=off'+'&lang='+lang,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
//load__endo_history(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function load__endo_history(rvn){
|
||||
$('#short_endo_history').empty();
|
||||
if(rvn)
|
||||
reload_visit_info();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_visit_info/' + $('#visit_id').val() + '?task=off',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentTypestatus
|
||||
success: (data) => {
|
||||
var label_id = 0
|
||||
for (untask_num in data['untask_pics'])
|
||||
{
|
||||
pic = data['untask_pics'][untask_num]
|
||||
organ = ''
|
||||
if (pic['organ'])
|
||||
{
|
||||
organ = pic['organ']
|
||||
}
|
||||
if($('#language').val() == 'ru')
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+pic['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+pic['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td></tr>');
|
||||
else
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+pic['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+pic['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Diagnosis</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td></tr>');
|
||||
label_id = label_id + 1
|
||||
}
|
||||
for (task_num in data['tasks'])
|
||||
{
|
||||
task = data['tasks'][task_num]
|
||||
|
||||
if ('task' in task)
|
||||
if (task['task'])
|
||||
if ('result' in task['task'])
|
||||
for (result_num in task['task']['result'])
|
||||
{
|
||||
result = task['task']['result'][result_num]
|
||||
var code = ''
|
||||
var name = ''
|
||||
var probability = 0
|
||||
if ('diseases' in result)
|
||||
for (d_num in result['diseases'])
|
||||
{
|
||||
disease = result['diseases'][d_num]
|
||||
if(disease['probability'] > probability)
|
||||
{
|
||||
probability = disease['probability']
|
||||
code = disease['code']
|
||||
name = disease['name']
|
||||
}
|
||||
}
|
||||
var organ = result['organ']
|
||||
if (organ == undefined)
|
||||
organ = 'Ошибка - '+task['task']['status']
|
||||
if (probability > 0)
|
||||
if($('#language').val() == 'ru')
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт<span></td></tr>');
|
||||
else
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart<span></td></tr>');
|
||||
else
|
||||
if($('#language').val() == 'ru')
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт<span></td></tr>');
|
||||
else
|
||||
$('#short_endo_history').append('<tr><td scope="col"><img src=/img/'+result['file']+'?va'+getRandomInt(100)+' class="preview_img"></td><td scope="col"><select data-img='+result['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select w-100" ><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart<span></td></tr>');
|
||||
label_id = label_id + 1
|
||||
}
|
||||
}
|
||||
select_fill();
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
if (pic.length > 0){
|
||||
if(pic.length > 1)
|
||||
{
|
||||
console.log('Обнаружены снимки с дублирующимся описанием')
|
||||
}
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
$(this).val(pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for (pic_num in data['expert_pics'])
|
||||
{
|
||||
pic = data['expert_pics'][pic_num]
|
||||
if (pic.length > 0){
|
||||
if(pic.length > 1)
|
||||
{
|
||||
console.log('Обнаружены снимки с дублирующимся экспертым описанием')
|
||||
}
|
||||
|
||||
$.each($('.expert_diagnos'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
$(this).html(pic[0]['icd']+' '+pic[0]['tag'])
|
||||
$(this).parent().children('.standart_modal').data('tag_id', pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
$('.standart_modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
standart_load($(this).data('code'), false, $(this).data('tag_id'));
|
||||
})
|
||||
$('.preview_img').click(function(){
|
||||
$(this).attr('src', $(this).attr('src')+getRandomInt(99));
|
||||
})
|
||||
$('.diagnoses_select').on('change', function() {
|
||||
save_select(this);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
});
|
||||
$('.diagnoses_select').select2();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//saving on select change
|
||||
function save_select(element){
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_name: $(element).data('img'),
|
||||
visit_id: $('#visit_id').val(),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/save_pic_diagnos',
|
||||
async: false ,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$(element).parent().children('.standart_modal').data('code', data['icd']);
|
||||
$(element).parent().children('.standart_modal').data('tag_id', data['tag_id']);
|
||||
$('#success').html('Диагноз сохранен');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getId(str)
|
||||
{
|
||||
return(str.replaceAll(' ','').replaceAll(',','').replaceAll('.','').replaceAll(';','').replaceAll(':','').replaceAll('(','').replaceAll(')','').replaceAll('-','').replaceAll('/','').replaceAll('\\',''))
|
||||
}
|
||||
|
||||
function standart_load(code, full, tag_id){
|
||||
$('#cur_modal_std').val(code);
|
||||
$('#cur_modal_tag_id').val(tag_id);
|
||||
lang = getUrlParameter('lang');
|
||||
console.log('lang - '+lang);
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_standart?icd='+code+'&tag_id='+tag_id+'&lang='+lang,
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html(data['standart_name']);
|
||||
if(lang == 'en'){
|
||||
$('#standart_diagnos').html('Diagnosis: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Type of standard: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('ICD-10 code: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Treatment time (days): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#standart_diagnos').html('Диагноз: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Вид стандарта: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('Код по МКБ-10: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Сроки лечения (дней): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
var groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if (!(groups.includes(std['service_type'])))
|
||||
{
|
||||
groups.push(std['service_type'])
|
||||
$('#standart_body').append('<h5>'+std['service_type']+'</h5><div id="group'+getId(std['service_type'])+'"></div>');
|
||||
}
|
||||
}
|
||||
var sub_groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
for (group in groups){
|
||||
if(!($('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype'])) == true))
|
||||
{
|
||||
$('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype']), true);
|
||||
$('#group'+getId(std['service_type'])).append('<p>'+std['service_subtype']+'</p>');
|
||||
if(lang == 'en')
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Medical Service Code</th><th scope="col">Name</th><th scope="col">Approximate frequency of presentation</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
else
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Код медицинской услуги</th><th scope="col">Наименование</th><th scope="col">Примерная частота представления</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
if(full == true){
|
||||
var std = data['standart'][std_num]
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if(std['periodicity'] == '1'){
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$('#copy_text').data('text', data['for_copy'])
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html('');
|
||||
$('#standart_diagnos').html('');
|
||||
$('#standart_type').html('');
|
||||
$('#standart_icd_code').html('');
|
||||
$('#standart_time').html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('#copy_text').on("click", function(){
|
||||
$('#text_to_copy').html($('#copy_text').data('text'));
|
||||
function listener(e) {
|
||||
str = document.getElementById('text_to_copy').innerHTML
|
||||
e.clipboardData.setData("text/html", str);
|
||||
e.clipboardData.setData("text/plain", str);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
$('#copy_text').addClass('check-icn');
|
||||
setTimeout(function() {
|
||||
$('#copy_text').removeClass('check-icn');
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
function updateStatus(){
|
||||
var piece = 100/7;
|
||||
var width = 0;
|
||||
if ($('#med_card').val())
|
||||
width = width + piece;
|
||||
if ($('#telephone').val())
|
||||
width = width + piece;
|
||||
if ($('#fio').val())
|
||||
width = width + piece;
|
||||
if ($('#dob').val())
|
||||
width = width + piece;
|
||||
if ($('#sex').val())
|
||||
width = width + piece;
|
||||
// if ($('#visit_id').val())
|
||||
// width = width + piece;
|
||||
if ($('#complaints_input').val())
|
||||
width = width + piece;
|
||||
if ($('#anamnesis_input').val())
|
||||
width = width + piece;
|
||||
$('#exam_progress').css('width', width+'%');
|
||||
}
|
||||
|
||||
function startLoad(nic_src){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Сохранение');
|
||||
var lang = getUrlParameter('lang');
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
var params = {
|
||||
profarea:$('#visit_profarea').val(),
|
||||
med_card:$('#med_card').val(),
|
||||
telephone:$('#telephone').val(),
|
||||
fio:$('#fio').val(),
|
||||
dob:$('#dob').val(),
|
||||
sex:$('#sex').val(),
|
||||
visit_id:$('#visit_id').val(),
|
||||
complaints:$('#complaints_input').val(),
|
||||
anamnesis:$('#anamnesis_input').val(),
|
||||
lang:lang
|
||||
};
|
||||
if (nic_src){
|
||||
params['src'] = nic_src;
|
||||
}
|
||||
var str_params = jQuery.param( params );
|
||||
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/save_med_exam?' + str_params,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
async: true,
|
||||
success: (data) => {
|
||||
$('#visit_id').val(data['visit_id']);
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
updateStatus();
|
||||
if(i > 0)
|
||||
load__endo_history(true);
|
||||
if(nic_src)
|
||||
load__endo_history(true);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select_fill(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/'+$('#visit_profarea').val()+'?lang='+lang,
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
for(tag_num in data)
|
||||
{
|
||||
|
||||
var tag = data[tag_num]
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
$(this).append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,318 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#nic_new_img_btn').click(function(){
|
||||
$('#nic_new_img_modal').modal('show');
|
||||
get_new_db_images();
|
||||
$('#nic_images_to_visit').attr("disabled", false);
|
||||
$('#nic_images_to_exam').attr("disabled", false);
|
||||
});
|
||||
|
||||
$('.close').click(function(){
|
||||
$('#' + $(this).data('target')).hide();
|
||||
});
|
||||
|
||||
var cookie_life = new Date();
|
||||
cookie_life.setTime(cookie_life.getTime() + (20 * 60 * 1000));
|
||||
$.cookie('images_timestamp', null, { expires: 0 });
|
||||
check_cookies();
|
||||
setInterval(() => check_cookies(), 5000);
|
||||
|
||||
|
||||
function check_cookies()
|
||||
{
|
||||
if (!document.hidden) {
|
||||
if ($('#nic_saving').length == 0)
|
||||
{
|
||||
var url = '/new_images_monitoring'
|
||||
if ($.cookie('images_timestamp'))
|
||||
url = '/new_images_monitoring?timestamp='+$.cookie('images_timestamp')
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for (msg_num in data['result'])
|
||||
{
|
||||
if (data['result'][msg_num]['timestamp'] > $.cookie('images_timestamp'))
|
||||
{
|
||||
startRemoteUnvRec(data['result'][msg_num]['src']);
|
||||
}
|
||||
if($.cookie('images_timestamp') == null)
|
||||
{
|
||||
startRemoteUnvRec(data['result'][msg_num]['src']);
|
||||
}
|
||||
}
|
||||
$.cookie('images_timestamp', data['timestamp'], { expires: cookie_life });
|
||||
if (data['length'] > 0)
|
||||
{
|
||||
$('#nic_new_img_btn').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#nic_new_img_btn').hide();
|
||||
}
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startRemoteUnvRec(src){
|
||||
// console.log('start_remote_unvisit_image_diagnostics');
|
||||
var message = {
|
||||
src: src
|
||||
}
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: JSON.stringify(message),
|
||||
url: '/start_remote_unvisit_image_diagnostics'+'?lang='+lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
|
||||
//Если модалка активна
|
||||
if($('#nic_new_img_modal').hasClass('show'))
|
||||
{
|
||||
get_new_db_images();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$('#nic_images_to_exam').click(function(){
|
||||
$('#nic_images_to_exam').attr("disabled", true);
|
||||
var image_ids = [];
|
||||
$.each($('.img-checkbox'), function(e) {
|
||||
if($(this).is(':checked'))
|
||||
image_ids.push($(this).data('id'));
|
||||
});
|
||||
var message = {
|
||||
'image_ids': image_ids
|
||||
}
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: JSON.stringify(message),
|
||||
url: '/nic_images_to_exam'+'?lang='+lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
if(lang == 'en')
|
||||
window.location.href = '/med_exam?visit_id='+data['visit_id']+'&lang=en';
|
||||
else
|
||||
window.location.href = '/med_exam?visit_id='+data['visit_id']+'&lang=ru';
|
||||
}
|
||||
else
|
||||
$('#nic_images_to_exam').attr("disabled", false);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#nic_images_to_exam').attr("disabled", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#nic_images_to_visit').click(function(){
|
||||
$('#nic_images_to_visit').attr("disabled", true);
|
||||
var image_ids = [];
|
||||
$.each($('.img-checkbox'), function(e) {
|
||||
if($(this).is(':checked'))
|
||||
image_ids.push($(this).data('id'));
|
||||
});
|
||||
var message = {
|
||||
'image_ids': image_ids
|
||||
}
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: JSON.stringify(message),
|
||||
url: '/nic_images_to_visit'+'?lang='+lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
// if(lang == 'en')
|
||||
// window.location.href = '/visit/'+data['patient_id']+'?lang=en&nic_visit=true';
|
||||
// else
|
||||
// window.location.href = '/visit/'+data['patient_id']+'?nic_visit=true';
|
||||
if(lang == 'en')
|
||||
window.location.href = '/visit/new_visit'+'?lang=en&nic_visit=true&visit_id='+data['visit_id'];
|
||||
else
|
||||
window.location.href = '/visit/new_visit'+'?nic_visit=true&visit_id='+data['visit_id'];
|
||||
}
|
||||
else
|
||||
$('#nic_images_to_visit').attr("disabled", false);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#nic_images_to_visit').attr("disabled", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#nic_remove_images').click(function(){
|
||||
var image_ids = [];
|
||||
$.each($('.img-checkbox'), function(e) {
|
||||
if($(this).is(':checked'))
|
||||
image_ids.push($(this).data('id'));
|
||||
});
|
||||
var message = {
|
||||
'image_ids': image_ids
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: JSON.stringify(message),
|
||||
url: '/remove_nic_images',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
get_new_db_images();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function get_new_db_images(){
|
||||
// Доделать чекбоксы для
|
||||
$('#new_images_selector').empty();
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_new_db_images'+'?lang='+lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#new_images_selector').empty();
|
||||
for(i in data['result']['groups'])
|
||||
{
|
||||
form_check = document.createElement('div');
|
||||
form_check.setAttribute('class', 'form_check');
|
||||
checkbox = document.createElement('input');
|
||||
checkbox.setAttribute('type', 'checkbox');
|
||||
checkbox.setAttribute('class', 'form-check-input check-group me-2');
|
||||
checkbox.setAttribute('data-id', 'group_' + data['result']['groups'][i]);
|
||||
checkbox.setAttribute('data-group', data['result']['groups'][i]);
|
||||
|
||||
label = document.createElement('label');
|
||||
label.setAttribute('for', 'group_' + data['result']['groups'][i]);
|
||||
label.setAttribute('class', 'form-check-label');
|
||||
|
||||
h3 = document.createElement('h3');
|
||||
h3.innerHTML = data['result']['groups'][i]
|
||||
label.appendChild(h3);
|
||||
form_check.appendChild(checkbox);
|
||||
form_check.appendChild(label);
|
||||
document.getElementById("new_images_selector").appendChild(form_check);
|
||||
|
||||
pics = data['result'][data['result']['groups'][i]];
|
||||
for(j in pics){
|
||||
var pic = pics[j];
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-xs-4 col-md-3 col-lg-2 col-4 p-1 m-0');
|
||||
|
||||
custom_control = document.createElement('div');
|
||||
custom_control.setAttribute('class', 'custom-control custom-checkbox image-checkbox');
|
||||
|
||||
checkbox = document.createElement('input');
|
||||
checkbox.setAttribute('type', 'checkbox');
|
||||
checkbox.setAttribute('class', 'custom-control-input img-checkbox');
|
||||
checkbox.setAttribute('id', 'chk' + pic['id']);
|
||||
checkbox.setAttribute('data-id', pic['id']);
|
||||
checkbox.setAttribute('data-group', data['result']['groups'][i]);
|
||||
|
||||
label = document.createElement('label');
|
||||
label.setAttribute('for', 'chk' + pic['id']);
|
||||
label.setAttribute('class', 'custom-control-label image-checkbox-label');
|
||||
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'img-fluid');
|
||||
img.setAttribute('alt', '#');
|
||||
img.setAttribute('src', '/img/'+pic['hash_name']);
|
||||
label.appendChild(img);
|
||||
custom_control.appendChild(checkbox);
|
||||
custom_control.appendChild(label);
|
||||
div.appendChild(custom_control);
|
||||
document.getElementById("new_images_selector").appendChild(div);
|
||||
}
|
||||
$('#new_images_selector').append('<hr>');
|
||||
|
||||
}
|
||||
$('.check-group').click(function(){
|
||||
var group = $(this).data('group');
|
||||
if($(this).is(':checked'))
|
||||
$.each($('.img-checkbox'), function(e) {
|
||||
if($(this).data('group') == group)
|
||||
$(this).prop('checked', true);
|
||||
});
|
||||
else
|
||||
$.each($('.img-checkbox'), function(e) {
|
||||
if($(this).data('group') == group)
|
||||
$(this).prop('checked', false);
|
||||
});
|
||||
});
|
||||
$('.img-checkbox').click(function(){
|
||||
var group = $(this).data('group');
|
||||
var all_checked = true;
|
||||
if($(this).is(':checked'))
|
||||
$.each($('.img-checkbox'), function(e) {
|
||||
if($(this).data('group') == group)
|
||||
if($(this).is(':checked') == false)
|
||||
{
|
||||
all_checked = false
|
||||
}
|
||||
|
||||
});
|
||||
else
|
||||
{
|
||||
$.each($('.check-group'), function(e) {
|
||||
if($(this).data('group') == group)
|
||||
$(this).prop('checked', false);
|
||||
});
|
||||
all_checked = false
|
||||
}
|
||||
if (all_checked == true)
|
||||
{
|
||||
$.each($('.check-group'), function(e) {
|
||||
if($(this).data('group') == group)
|
||||
$(this).prop('checked', true);
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,160 @@
|
||||
$(document).ready(function () {
|
||||
$("#modal_create_news").on('click', function() {
|
||||
$("#create_news_modal").modal('toggle')
|
||||
});
|
||||
$("#create_news").on("click", function() {
|
||||
let news = {
|
||||
title: $("#title_news").val(),
|
||||
text: $("#text_news").val(),
|
||||
image: '',
|
||||
file: ''
|
||||
}
|
||||
|
||||
//img = $('#image_news_file')[0].files[0]
|
||||
//if (img) {
|
||||
//
|
||||
// var reader = new FileReader();
|
||||
// reader.readAsDataURL(img);
|
||||
// reader.onload = function() {
|
||||
// let url=this.result.substring(this.result.indexOf(',')+1);
|
||||
// news.file = 'data:image/png;base64,' + url
|
||||
// console.log(news)
|
||||
// }
|
||||
//}
|
||||
|
||||
var stav = true
|
||||
if ($("#image_news").val() != '') {
|
||||
var RegExp = /^((ftp|http|https):\/\/)?(www\.)?([A-Za-zА-Яа-я0-9]{1}[A-Za-zА-Яа-я0-9\-]*\.?)*\.{1}[A-Za-zА-Яа-я0-9-]{2,8}(\/([\w#!:.?+=&%@!\-\/])*)?/;
|
||||
|
||||
if(RegExp.test($("#image_news").val())){
|
||||
news.image = $("#image_news").val()
|
||||
stav = true
|
||||
} else {
|
||||
stav = false
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
} else {
|
||||
stav = true
|
||||
}
|
||||
|
||||
if (news.title != '' && news.text != '') {
|
||||
if (stav == true) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/add_news',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(news),
|
||||
success: (data ) => {
|
||||
if (data['success'] == true) {
|
||||
$("#create_news_modal").modal('hide');
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
$('#exception_data').slideDown(500);
|
||||
$('#exception_data').delay(2000).slideUp();
|
||||
}
|
||||
});
|
||||
$('.remove_news').on('click', function() {
|
||||
//console.log($(this)[0].attributes);
|
||||
//console.log($(this)[0].attributes['id-data_news']['value']);
|
||||
|
||||
var ind = $(this)[0].attributes['id-data_news']['value'];
|
||||
data = {
|
||||
'ind': ind
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/delete_news",
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(data),
|
||||
success: (data ) => {
|
||||
if (data['success'] == true) {
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
$(".edit_news").on('click', function() {
|
||||
var ind = $(this)[0].attributes['id-data_news']['value'];
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/get_news/'+ind,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#title_news_edit').val(data['title'])
|
||||
$('#text_news_edit').val(data['text'])
|
||||
$('#image_news_edit').val(data['url'])
|
||||
$('#save_edit_news').attr("id-data_card", data['id'])
|
||||
}
|
||||
})
|
||||
|
||||
$("#edit_news_modal").modal('toggle')
|
||||
});
|
||||
$('#save_edit_news').on('click', function() {
|
||||
let news = {
|
||||
title: $("#title_news_edit").val(),
|
||||
text: $("#text_news_edit").val(),
|
||||
image: '',
|
||||
file: ''
|
||||
}
|
||||
|
||||
//img = $('#image_news_file')[0].files[0]
|
||||
//if (img) {
|
||||
//
|
||||
// var reader = new FileReader();
|
||||
// reader.readAsDataURL(img);
|
||||
// reader.onload = function() {
|
||||
// let url=this.result.substring(this.result.indexOf(',')+1);
|
||||
// news.file = 'data:image/png;base64,' + url
|
||||
// console.log(news)
|
||||
// }
|
||||
//}
|
||||
|
||||
var stav = true
|
||||
if ($("#image_news_edit").val() != '') {
|
||||
var RegExp = /^((ftp|http|https):\/\/)?(www\.)?([A-Za-zА-Яа-я0-9]{1}[A-Za-zА-Яа-я0-9\-]*\.?)*\.{1}[A-Za-zА-Яа-я0-9-]{2,8}(\/([\w#!:.?+=&%@!\-\/])*)?/;
|
||||
|
||||
if(RegExp.test($("#image_news_edit").val())){
|
||||
news.image = $("#image_news_edit").val()
|
||||
stav = true
|
||||
} else {
|
||||
stav = false
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
} else {
|
||||
stav = true
|
||||
}
|
||||
|
||||
var ind = $(this)[0].attributes[2]['value'];
|
||||
console.log( $(this)[0].attributes[2]['value'])
|
||||
if (news.title != '' && news.text != '') {
|
||||
if (stav == true) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/edit_news/' + ind,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(news),
|
||||
success: (data ) => {
|
||||
if (data['success'] == true) {
|
||||
$("#edit_news_modal").modal('hide');
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
$('#exception_data').slideDown(500);
|
||||
$('#exception_data').delay(2000).slideUp();
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
@@ -0,0 +1,68 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#pdf_download').click(function()
|
||||
{
|
||||
wait_button(this);
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/pdf_report/'+$('#visit_id').val(),
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var a = document.createElement('a');
|
||||
a.href = '/pdf/'+ data;
|
||||
filename = $('#patient_full_name').html()
|
||||
a.download = filename + '.pdf';
|
||||
document.body.append(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL('/pdf/'+ data);
|
||||
resume_button(this);
|
||||
$('#pdf_download').attr("disabled", false);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('Не сформировать PDF файл',0);
|
||||
console.log('resume button')
|
||||
resume_button(this);
|
||||
$('#pdf_download').attr("disabled", false);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#send_patient_pdf').click(function()
|
||||
{
|
||||
wait_button(this);
|
||||
var message = {
|
||||
visit_id : $('#visit_id').val()
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/send_pdf_report',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
show_success('PDF успешно отправлена', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(data.hasOwnProperty('message'))
|
||||
{
|
||||
show_error(data.message,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('Не удалось отправить PDF файл',0);
|
||||
}
|
||||
}
|
||||
resume_button(this);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('Ошибка сервера. Не удалось отправить PDF файл',0);
|
||||
resume_button(this);
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
$(document).ready(function () {
|
||||
$('.check-filter').click(function(){
|
||||
if($(this).is(':checked'))
|
||||
$('.'+$(this).attr('id')).show();
|
||||
else
|
||||
$('.'+$(this).attr('id')).hide();
|
||||
});
|
||||
|
||||
$('.direct_patient').on('change', function(){
|
||||
$('#direct_modal').modal('toggle');
|
||||
$('#send_direction').data('routing_id', $(this).data('routing_id'));
|
||||
$('#send_direction').data('clinic_id', $(this).val());
|
||||
|
||||
$('#dm_patinet').html($(this).data('patient_name'));
|
||||
$('#dm_clinic').html($(this).children(':selected').text());
|
||||
});
|
||||
|
||||
$('#send_direction').on('click', function(){
|
||||
var params = {
|
||||
routing_id : $(this).data('routing_id'),
|
||||
clinic_id : $(this).data('clinic_id')
|
||||
};
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/route_patient',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(params),
|
||||
success: (data) => {
|
||||
console.log('data')
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#direct_modal').modal('hide');
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('.patient-sort').click(function(){
|
||||
$('.check-filter').prop('checked', true);
|
||||
if($(this).attr('selected')){
|
||||
$(this).removeAttr('selected');
|
||||
$('.routing-card').show();
|
||||
return;
|
||||
}
|
||||
else{
|
||||
$(this).attr('selected', '1');
|
||||
var patient_id = $(this).data('patient_id');
|
||||
$.each($('.routing-card'), function(e) {
|
||||
if($(this).data('patient_id') == patient_id)
|
||||
{
|
||||
$(this).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
$('.excl_dwnld').on('click', function() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/dwnld_excl',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var a = document.createElement('a');
|
||||
a.href = '/excel/'+ data['file'];
|
||||
filename = $('#clinic_name').val()+'_report'
|
||||
a.download = filename + '.xlsx';
|
||||
document.body.append(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL('/excel/'+ data['file']);
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
@@ -0,0 +1,552 @@
|
||||
$(document).ready(function () {
|
||||
var codition = {}
|
||||
|
||||
open_filter();
|
||||
remove_script_btn();
|
||||
|
||||
function remove_script_btn(){
|
||||
$('.remove-script').click(function(){
|
||||
console.log($(this).data('id'));
|
||||
if($(this).data('id') == 'main_filter')
|
||||
{
|
||||
$('#' + $(this).data('id')).data('filters', '');
|
||||
$('#' + $(this).data('id')).data('filter_type', '');
|
||||
$('#' + $(this).data('id')).parent().children("small").remove();
|
||||
$('#' + $(this).data('id')).val('0').prop('selected', true);
|
||||
$('#' + $(this).data('id')).parent().children(".small").remove();
|
||||
$('#' + $(this).data('id')).select2({
|
||||
tags: true
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#' + $(this).data('id')).parent().remove();
|
||||
$(this).parent().remove();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function open_filter() {
|
||||
$('.filter').change(function() {
|
||||
if($(this).val() == 'by_nn_diagnos'){
|
||||
$('#routing_modal_by_diagnos').modal('toggle');
|
||||
$("#routing_modal_dignosis_submit").attr('filter_type', $(this).val());
|
||||
$("#routing_modal_dignosis_submit").attr('filter_num', $(this).attr('id'));
|
||||
$(this).data('filter_type', $(this).val());
|
||||
//$('#area1').attr('class', 'tab-pane active')
|
||||
//$('#arealink1').attr('class', 'nav-link active')
|
||||
|
||||
//Открывается модалка с 4 вкладками, в них чекбоксы с перечисленными диагнозами,
|
||||
//при закрытии модалки в data- от селекта записывается набор tag.id добавленых в фильтр
|
||||
//Под SELECT пишется набор tag.name в small
|
||||
}
|
||||
if($(this).val() == 'by_expert_diagnos'){
|
||||
$('#routing_modal_by_diagnos').modal('toggle');
|
||||
$("#routing_modal_dignosis_submit").attr('filter_type', $(this).val());
|
||||
$("#routing_modal_dignosis_submit").attr('filter_num', $(this).attr('id'));
|
||||
$(this).data('filter_type', $(this).val());
|
||||
//$('#area1').attr('class', 'tab-pane active')
|
||||
//$('#arealink1').attr('class', 'nav-link active')
|
||||
//Открывается модалка с 4 вкладками, в них чекбоксы с перечисленными диагнозами,
|
||||
//при закрытии модалки в data- от селекта записывается набор tag.id добавленых в фильтр
|
||||
//Под SELECT пишется набор tag.name в small
|
||||
}
|
||||
if($(this).val() == 'by_doctor_diagnos'){
|
||||
$('#routing_modal_by_diagnos').modal('toggle');
|
||||
$("#routing_modal_dignosis_submit").attr('filter_type', $(this).val());
|
||||
$("#routing_modal_dignosis_submit").attr('filter_num', $(this).attr('id'));
|
||||
$(this).data('filter_type', $(this).val());
|
||||
//$('#area1').attr('class', 'tab-pane active')
|
||||
//$('#arealink1').attr('class', 'nav-link active')
|
||||
//Открывается модалка с 4 вкладками, в них чекбоксы с перечисленными диагнозами,
|
||||
//при закрытии модалки в data- от селекта записывается набор tag.id добавленых в фильтр
|
||||
//Под SELECT пишется набор tag.name в small
|
||||
}
|
||||
if($(this).val() == 'by_script'){
|
||||
$('#routing_modal_by_script').modal('toggle');
|
||||
$("#routing_modal_scripts_submit").attr('filter_type', 'by_script');
|
||||
$(this).data('filter_type', 'by_script');
|
||||
$("#routing_modal_scripts_submit").attr('filter_num', $(this).attr('id'));
|
||||
//Открывается модалка с чекбоксами возможных первичных сценариев,
|
||||
//[Визит, Профосмотр, Направление, Внешние источники, Виджет на сайте]
|
||||
//при закрытии модалки в data- от селекта записывается набор имен сценариев добавленых в фильтр
|
||||
//Под SELECT пишется набор сценариев в small
|
||||
}
|
||||
if($(this).val() == 'by_user'){
|
||||
|
||||
var ind = $('#source_clinic').val()
|
||||
if (!ind) {
|
||||
$('#exception').innerHTML = "Выберите клинику";
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
} else {
|
||||
$('#routing_modal_by_user').modal('toggle');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/routing/get_user_by_clinic/' + ind,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
var users_list = document.getElementById('users');
|
||||
$(users_list).empty();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('class', 'form-check.mb-2')
|
||||
var checkbox = document.createElement('input');
|
||||
checkbox.setAttribute('class', 'form-check-input user');
|
||||
checkbox.setAttribute('id', 'user_id'+data[i]['id']);
|
||||
checkbox.setAttribute('value', data[i]['id']);
|
||||
checkbox.setAttribute('type', 'checkbox');
|
||||
var label = document.createElement('label');
|
||||
label.setAttribute('class', 'form-check-label');
|
||||
label.setAttribute('for', 'user_id'+data[i]['id']);
|
||||
label.innerHTML = data[i]['name']
|
||||
div.appendChild(checkbox);
|
||||
div.appendChild(label);
|
||||
users_list.appendChild(div);
|
||||
}
|
||||
$("#routing_modal_users_submit").attr('filter_type', 'by_user');
|
||||
$(this).data('filter_type', $(this).val());
|
||||
$("#routing_modal_users_submit").attr('filter_num', $(this).attr('id'));
|
||||
}
|
||||
})
|
||||
}
|
||||
//Открывается модалка с чекбоксами возможных пользователей клиники-инициатора
|
||||
//при закрытии модалки в data- от селекта записывается набор user.id добавленых в фильтр
|
||||
//Под SELECT пишется набор user.name в small
|
||||
}
|
||||
if($(this).val() == 'by_profarea'){
|
||||
var id = $('#source_clinic').val();
|
||||
if (!id) {
|
||||
$('#exception').innerHTML = "Выберите клинику";
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
} else {
|
||||
$('#routing_modal_by_profarea').modal('toggle');
|
||||
$.ajax({
|
||||
url: '/routing/get_profarea_by_clinic/' + id,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
var profarea_list = document.getElementById('profarea_list');
|
||||
$(profarea_list).empty();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('class', 'form-check.mb-2')
|
||||
var checkbox = document.createElement('input');
|
||||
checkbox.setAttribute('class', 'form-check-input area');
|
||||
checkbox.setAttribute('id', 'area_id'+data[i]['id'])
|
||||
checkbox.setAttribute('value', data[i]['id'])
|
||||
checkbox.setAttribute('type', 'checkbox');
|
||||
var label = document.createElement('label');
|
||||
label.setAttribute('class', 'form-check-label');
|
||||
label.setAttribute('for', 'area_id'+data[i]['id']);
|
||||
label.innerHTML = data[i]['name']
|
||||
div.appendChild(checkbox);
|
||||
div.appendChild(label);
|
||||
profarea_list.appendChild(div);
|
||||
}
|
||||
$("#routing_modal_profarea_submit").attr('filter_type', 'by_profarea');
|
||||
$(this).data('filter_type', $(this).val());
|
||||
$("#routing_modal_profarea_submit").attr('filter_num', $(this).attr('id'));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//Открывается модалка с чекбоксами возможных профобластей клиники-инициатора
|
||||
//при закрытии модалки в data- от селекта записывается набор profarea.id добавленых в фильтр
|
||||
//Под SELECT пишется набор profarea.area_name в small
|
||||
}
|
||||
if($(this).val() == 'by_city'){
|
||||
$('#routing_modal_by_city').modal('toggle');
|
||||
$.ajax({
|
||||
url: '/routing/get_city',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute('value', data[i]['id']);
|
||||
option.innerHTML = data[i]['name'];
|
||||
$('#city_patient').append(option);
|
||||
}
|
||||
$("#routing_modal_city_submit").attr('filter_type', 'by_city');
|
||||
$(this).data('filter_type', $(this).val());
|
||||
$("#routing_modal_city_submit").attr('filter_num', $(this).attr('id'));
|
||||
$(".routing_select2").select2({
|
||||
tags: true
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//Открывается модалка с SELECT2 с кастомным вводом, на модалке кнопка добавить выбранный
|
||||
//При нажатии кнопки город добавляется в список под селектом, рядом с каждым должен быть крестик для удаления
|
||||
//при закрытии модалки в data- от селекта записывается набор городов добавленых в фильтр
|
||||
//Под SELECT пишется набор городов в small
|
||||
}
|
||||
});
|
||||
//TODO: если фильтр поменяли на другой, то удалять значнения из filters() сделать кнопку удаления фильтра справа от селекта
|
||||
}
|
||||
$("#city_patient").change(function() {
|
||||
$('#city').show();
|
||||
var city = this.options[this.selectedIndex].text
|
||||
var id = $(this).val()
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('class', 'form-check.mb-2')
|
||||
var checkbox = document.createElement('input');
|
||||
checkbox.setAttribute('class', 'form-check-input city');
|
||||
checkbox.setAttribute('id', 'city_id'+id);
|
||||
checkbox.setAttribute('value', city);
|
||||
checkbox.setAttribute('type', 'checkbox');
|
||||
checkbox.setAttribute('checked', '')
|
||||
var label = document.createElement('label');
|
||||
label.setAttribute('class', 'form-check-label');
|
||||
label.setAttribute('for', 'user_id'+id);
|
||||
label.innerHTML = city
|
||||
div.appendChild(checkbox);
|
||||
div.appendChild(label);
|
||||
$('#city_list').append(div);
|
||||
|
||||
});
|
||||
$('.nav-link').on('click', function() {
|
||||
this.setAttribute('class', 'nav-link active');
|
||||
});
|
||||
$('.choise_all').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[area_id="' + this.getAttribute('id_area') + '"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
});
|
||||
$('.cancel_all_choise').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[area_id="' + this.getAttribute('id_area') + '"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.choise_all_scripts').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input script"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
});
|
||||
$('.cancel_all_choise_scipts').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input script"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.choise_all_users').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input user"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
});
|
||||
$('.cancel_all_choise_users').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input user"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.choise_all_area').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input area"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = true;
|
||||
}
|
||||
});
|
||||
$('.cancel_all_choise_area').on('click', function() {
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input area"]')
|
||||
for (var checkbox of checkboxes) {
|
||||
checkbox.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#routing_modal_users_submit').on('click', function() {
|
||||
var users = []
|
||||
var users_text = []
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input user"]');
|
||||
for (var checkbox of checkboxes) {
|
||||
if (checkbox.checked == true) {
|
||||
users.push(checkbox.getAttribute('value'))
|
||||
users_text.push($(checkbox).parent().children("label").html())
|
||||
}
|
||||
}
|
||||
$('#' + $(this).attr('filter_num')).parent().children(".small").remove();
|
||||
$('#' + $(this).attr('filter_num')).data('filters', users);
|
||||
$('#' + $(this).attr('filter_num')).data('filter_type', 'by_user');
|
||||
$('#' + $(this).attr('filter_num')).parent().append('<div class="col-12 small"><small class="text-success">'+users_text.join(", ")+'</small></div>');
|
||||
$("#routing_modal_by_user").modal('hide')
|
||||
})
|
||||
$('#routing_modal_profarea_submit').on('click', function() {
|
||||
var profarea = []
|
||||
var profarea_text = []
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input area"]');
|
||||
for (var checkbox of checkboxes) {
|
||||
if (checkbox.checked == true) {
|
||||
profarea.push(checkbox.getAttribute('value'));
|
||||
profarea_text.push($(checkbox).parent().children("label").html());
|
||||
}
|
||||
}
|
||||
$('#' + $(this).attr('filter_num')).parent().children(".small").remove();
|
||||
$('#' + $(this).attr('filter_num')).data('filters', profarea);
|
||||
$('#' + $(this).attr('filter_num')).data('filter_type', 'by_profarea');
|
||||
$('#' + $(this).attr('filter_num')).parent().append('<div class="col-12 small"><small class="text-success">'+profarea_text.join(", ")+'</small></div>');
|
||||
$("#routing_modal_by_profarea").modal('hide')
|
||||
|
||||
})
|
||||
$('#routing_modal_scripts_submit').on('click', function() {
|
||||
var scripts = []
|
||||
var scripts_text = []
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input script"]');
|
||||
for (var checkbox of checkboxes) {
|
||||
if (checkbox.checked == true) {
|
||||
scripts.push(checkbox.getAttribute('value'));
|
||||
scripts_text.push($(checkbox).parent().children("label").html())
|
||||
}
|
||||
}
|
||||
$('#' + $(this).attr('filter_num')).parent().children(".small").remove();
|
||||
$('#' + $(this).attr('filter_num')).data('filter_type', 'by_script');
|
||||
$('#' + $(this).attr('filter_num')).data('filters', scripts);
|
||||
$('#' + $(this).attr('filter_num')).parent().append('<div class="col-12 small"><small class="text-success">'+scripts_text.join(", ")+'</small></div>');
|
||||
$("#routing_modal_by_script").modal('hide')
|
||||
});
|
||||
$('#routing_modal_city_submit').on('click', function() {
|
||||
var cities = []
|
||||
var cities_text = []
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input city"]');
|
||||
for (var checkbox of checkboxes) {
|
||||
if (checkbox.checked == true) {
|
||||
cities.push(checkbox.getAttribute('value'))
|
||||
cities_text.push($(checkbox).parent().children("label").html())
|
||||
}
|
||||
}
|
||||
$('#' + $(this).attr('filter_num')).parent().children(".small").remove();
|
||||
$('#' + $(this).attr('filter_num')).data('filter_type', 'by_city');
|
||||
$('#' + $(this).attr('filter_num')).data('filters', cities);
|
||||
$('#' + $(this).attr('filter_num')).parent().append('<div class="col-12 small"><small class="text-success">'+cities_text.join(", ")+'</small></div>');
|
||||
$("#routing_modal_by_city").modal('hide');
|
||||
})
|
||||
$('#routing_modal_dignosis_submit').on('click', function() {
|
||||
var diagonosis = {}
|
||||
var checkboxes = document.querySelectorAll('input[class="form-check-input tag_name"]')
|
||||
|
||||
var all_tags = []
|
||||
var tags_text = []
|
||||
|
||||
for (var tn of checkboxes) {
|
||||
if (tn.checked == true) {
|
||||
all_tags.push(tn.getAttribute('value'));
|
||||
tags_text.push($(tn).parent().children("label").html())
|
||||
}
|
||||
}
|
||||
$('#' + $(this).attr('filter_num')).parent().children(".small").remove();
|
||||
$('#' + $(this).attr('filter_num')).data('filter_type', $(this).attr('filter_type'));
|
||||
$('#' + $(this).attr('filter_num')).data('filters', all_tags);
|
||||
$('#' + $(this).attr('filter_num')).parent().append('<div class="col-12 small"><small class="text-success">'+tags_text.join(", ")+'</small></div>');
|
||||
for (tn of checkboxes) {
|
||||
tn.checked = false
|
||||
}
|
||||
|
||||
$("#routing_modal_by_diagnos").modal('hide')
|
||||
})
|
||||
function checked_condition() {
|
||||
$('.or_check').on('click', function() {
|
||||
codition[this.getAttribute('name')] = this.getAttribute('value')
|
||||
})
|
||||
$('.and_check').on('click', function() {
|
||||
codition[this.getAttribute('name')] = this.getAttribute('value')
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
$("#btn_add_filter").on('click', function() {
|
||||
var ind = this.getAttribute('ind-filter');
|
||||
this.setAttribute('ind-filter', parseInt(ind)+1);
|
||||
var script = document.createElement('div');
|
||||
script.setAttribute('class', 'mt-2 col-md-11')
|
||||
|
||||
var remove_script = document.createElement('div');
|
||||
remove_script.setAttribute('class', 'col-md-1')
|
||||
|
||||
var btn = document.createElement('button')
|
||||
btn.setAttribute('class', 'remove-script btn btn-danger btn-sm mt-2')
|
||||
btn.setAttribute('data-id', 'main_filter'+ind)
|
||||
btn.innerHTML = 'Удалить'
|
||||
|
||||
remove_script.appendChild(btn)
|
||||
|
||||
var select = document.createElement('select')
|
||||
select.setAttribute('class', 'form-select form-control custom-input routing_select2 filter me-0')
|
||||
select.setAttribute('style', 'width: 100%;')
|
||||
select.setAttribute('id', 'main_filter'+ind)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute('value', 0)
|
||||
option.setAttribute('selected', '')
|
||||
option.setAttribute('disabled', '')
|
||||
option.innerHTML = 'Правила'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_nn_diagnos')
|
||||
option.innerHTML = 'По диагнозу от нейросети'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_expert_diagnos')
|
||||
option.innerHTML = 'По диагнозу эксперта'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_doctor_diagnos')
|
||||
option.innerHTML = 'По диагнозу первичного врача'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_script')
|
||||
option.innerHTML = 'По сценарию'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_user')
|
||||
option.innerHTML = 'По пользователю клиники'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_profarea')
|
||||
option.innerHTML = 'По профобласти'
|
||||
select.appendChild(option)
|
||||
|
||||
var option = document.createElement('option');
|
||||
option.setAttribute("value", 'by_city')
|
||||
option.innerHTML = 'По городу пациента'
|
||||
select.appendChild(option)
|
||||
script.appendChild(select)
|
||||
$('#all_scripts').append(script)
|
||||
$('#all_scripts').append(remove_script)
|
||||
$('.routing_select2').select2({tags: true});
|
||||
open_filter();
|
||||
checked_condition();
|
||||
remove_script_btn();
|
||||
});
|
||||
function clear_form() {
|
||||
//console.log($('#source_clinic').val())
|
||||
$('#source_action').val(0)
|
||||
$('#source_clinic').val('')
|
||||
$('#price_source').val('')
|
||||
$('#emails').val('')
|
||||
$('#all_scripts').val(0)
|
||||
$('#dest_action').val(0)
|
||||
$('#dest_clinic').val(0)
|
||||
$('#price_terget').val('')
|
||||
$('#emails2').val('')
|
||||
}
|
||||
|
||||
$('#add_routing_rule').click(function(){
|
||||
filters = {}
|
||||
$.each($('.filter'), function(e) {
|
||||
if($(this).data('filter_type') == undefined || $(this).data('filters') == undefined)
|
||||
{
|
||||
console.log('und');
|
||||
}
|
||||
else{
|
||||
if (filters.hasOwnProperty($(this).data('filter_type')))
|
||||
{
|
||||
filters[$(this).data('filter_type')] = $.merge(filters[$(this).data('filter_type')], $(this).data('filters'));
|
||||
}
|
||||
else
|
||||
{
|
||||
filters[$(this).data('filter_type')] = $(this).data('filters');
|
||||
}
|
||||
}
|
||||
})
|
||||
//TODO: Маршрутизация
|
||||
//Собираем получившиеся данные и записываем в message
|
||||
var message = {'rules' : {}}
|
||||
|
||||
message['rule_name'] = $('#rule_name').val()
|
||||
message['source_action'] = $('#source_action').val()
|
||||
message['source_clinic_id'] = $('#source_clinic').val()
|
||||
message['source_price'] = $('#price_source').val()
|
||||
message['source_emails'] = $('#emails').val()
|
||||
message['rules'] = filters;
|
||||
message['dest_action'] = $('#dest_action').val()
|
||||
message['dest_clinic_id'] = $('#dest_clinic').val()
|
||||
message['dest_price'] = $('#price_target').val()
|
||||
message['dest_emails'] = $('#emails2').val()
|
||||
|
||||
console.log(message)
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/routing/add_rule',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true){
|
||||
show_success('Правило успешно добавлено', 0);
|
||||
clear_form()
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error(data['message'] ,0);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('System error' ,0);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.disable_rule').click(function(){
|
||||
let rule_id = $(this).data('rule_id');
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/routing/' + rule_id + '/disable',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
if(data['success'] == true){
|
||||
$('#enable_rule_'+rule_id).show();
|
||||
$('#disable_rule_'+rule_id).hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('Disable error' ,0);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('System error' ,0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.enable_rule').click(function(){
|
||||
let rule_id = $(this).data('rule_id');
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/routing/' + rule_id + '/enable',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
if(data['success'] == true){
|
||||
$('#enable_rule_'+rule_id).hide();
|
||||
$('#disable_rule_'+rule_id).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('Enable error' ,0);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
show_error('System error' ,0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,113 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#save_patient_props').on('click', function(){save_patient_props(false)});
|
||||
|
||||
if ($('#nic_visit').length > 0){
|
||||
$('#patient_props_modal').modal('show');
|
||||
}
|
||||
|
||||
$("#fio_select2").select2({
|
||||
tags: true,
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
$("#fio_select2").on("change", function() {
|
||||
id = this.value;
|
||||
text = $( "#fio_select2 option:selected" ).text();
|
||||
if (id == text)
|
||||
{
|
||||
console.log('New Patient');
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/get_patient_clinic/' + id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$("#med_card").val(data['card_number']);
|
||||
$("#telephone").val(data['telephone']);
|
||||
$("#dob").val(data['dob']);
|
||||
$("#sex").val(data['sex']);
|
||||
$("#email").val(data['email']);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function save_patient_props(redirect){
|
||||
|
||||
fio = $('#fio').val();
|
||||
dob = $('#dob').val();
|
||||
med_card = $('#med_card').val();
|
||||
sex = $('#sex').val();
|
||||
telephone = $('#telephone').val();
|
||||
email = $('#email').val();
|
||||
false_form = false
|
||||
lang = getUrlParameter('lang');
|
||||
if(false_form==false)
|
||||
{
|
||||
var message = {
|
||||
fio: fio,
|
||||
dob:dob,
|
||||
med_card:med_card,
|
||||
sex:sex,
|
||||
telephone:telephone,
|
||||
email:email
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/update_patient/' + $('#patient_id').val(),
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
if (lang == 'en')
|
||||
$('#success').html('Parameters updated')
|
||||
else
|
||||
$('#success').html('Информация обновлена')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
$('#patient_full_name').html(fio);
|
||||
if ($('#nic_visit').length > 0){
|
||||
$('#fio_info').html(fio);
|
||||
$('#dob_info').html(dob);
|
||||
$('#med_card_info').html(med_card);
|
||||
$('#sex_info').html(sex);
|
||||
$('#patient_props_modal').modal('hide');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lang == 'en')
|
||||
$('#exception').html('Failed to update parameters')
|
||||
else
|
||||
$('#exception').html('Не удалось обновить')
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
check_status();
|
||||
setInterval(() => check_status(), 25000);
|
||||
|
||||
function check_status()
|
||||
{
|
||||
|
||||
$.each($('.server_status'), function(e) {
|
||||
var message = {
|
||||
url: $(this).data('url'),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/server_status',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
$(this).html(data['status']+' '+data['ssl_status']);
|
||||
$(this).css( "color", data['status_color'] );
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,900 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.close-modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
});
|
||||
|
||||
$('#short_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), false, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').hide();
|
||||
$('#long_std').show();
|
||||
});
|
||||
|
||||
$('#long_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), true, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').show();
|
||||
$('#long_std').hide();
|
||||
});
|
||||
|
||||
$('.custom-input').on('focus focusout', function(){
|
||||
if($(this).val() == null || $(this).val() == '')
|
||||
{
|
||||
$($(this).parent()).removeClass('hastext');
|
||||
}
|
||||
else
|
||||
{
|
||||
$($(this).parent()).addClass('hastext');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function previewIMG(input, preview) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$(preview).attr('src', e.target.result);
|
||||
}
|
||||
reader.readAsDataURL(input);
|
||||
}
|
||||
|
||||
$("#file_input").change(function(){
|
||||
$('#imgs_preview').empty();
|
||||
$('#file-input-greenspan').html('');
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#pre_load').hide();
|
||||
$('#file-input-greenspan').html('Загружено снимков: ' + $(this)[0].files.length);
|
||||
for(i=0;i<$(this)[0].files.length;i++)
|
||||
{
|
||||
if (($(this)[0].files[i].type.includes('image')))
|
||||
{
|
||||
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-3 p-1 m-0');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'preview_img');
|
||||
previewIMG($(this)[0].files[i], $(img));
|
||||
|
||||
div.appendChild(img);
|
||||
document.getElementById("imgs_preview").appendChild(div);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#endo_tab_link').on('click', function()
|
||||
{
|
||||
load__endo_history(true);
|
||||
});
|
||||
|
||||
$('#nn_tab_link').on('click', function()
|
||||
{
|
||||
load__endo_history(true);
|
||||
});
|
||||
|
||||
function reload_visit_info(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/reload_visit_info/' + $('#visit_id').val() + '?task=off'+'&lang='+lang,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
load__endo_history(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function load__endo_history(rvn){
|
||||
$('#endo_history').empty();
|
||||
if(rvn)
|
||||
reload_visit_info();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_visit_info/'+$('#visit_id').val(),
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentTypestatus
|
||||
success: (data) => {
|
||||
$('#endo_history').empty();
|
||||
var label_id = 0
|
||||
// Восстановил старый код (как у меня было)
|
||||
for (untask_num in data['untask_pics'])
|
||||
{
|
||||
pic = data['untask_pics'][untask_num]
|
||||
organ = ''
|
||||
if (pic['organ'])
|
||||
{
|
||||
organ = pic['organ']
|
||||
}
|
||||
if($('#language').val() == 'ru')
|
||||
$('#endo_history').append('<tr><td scope="col"><img src=/img/'+pic['file']+' class="preview_img"></td><td scope="col">'+organ+'</td><td scope="col"><span class="expert_diagnos" data-img='+pic['file']+'></span><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td><td scope="col"><select data-img='+pic['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td></tr>');
|
||||
else
|
||||
$('#endo_history').append('<tr><td scope="col"><img src=/img/'+pic['file']+' class="preview_img"></td><td scope="col">'+organ+'</td><td scope="col"><span class="expert_diagnos" data-img='+pic['file']+'></span><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td><td scope="col"><select data-img='+pic['file']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td></tr>');
|
||||
label_id = label_id + 1
|
||||
}
|
||||
for (untask_num in data['tasks'])
|
||||
{
|
||||
pic = data['tasks'][untask_num]
|
||||
console.log(pic)
|
||||
organ = ''
|
||||
if (pic['organ'])
|
||||
{
|
||||
organ = pic['organ']
|
||||
}
|
||||
if (pic["task"]['error']==null) {
|
||||
tr = document.createElement('tr');
|
||||
td1 = document.createElement('td');
|
||||
td1.setAttribute('scope', 'col');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('src', '/img/'+pic['pictures'][0]['hash_name']);
|
||||
//
|
||||
img.setAttribute('class', 'preview_img');
|
||||
td1.appendChild(img);
|
||||
tr.appendChild(td1);
|
||||
//
|
||||
td2 = document.createElement('td');
|
||||
td2.setAttribute('scope', 'col');
|
||||
td2.innerHTML = organ;
|
||||
tr.appendChild(td2);
|
||||
//
|
||||
//
|
||||
td3 = document.createElement('td');
|
||||
td3.setAttribute('scope', 'col');
|
||||
//
|
||||
span = document.createElement('span');
|
||||
span.setAttribute('class', 'expert_diagnos');
|
||||
span.setAttribute('data-img', pic['file']);
|
||||
span.innerHTML = data['tasks'][untask_num]['task']['class'];
|
||||
td3.appendChild(span);
|
||||
//
|
||||
span = document.createElement('span');
|
||||
span.setAttribute('class', 'standart_modal btn btn-secondary btn-sm')
|
||||
span.setAttribute('data-code', '');
|
||||
if($('#language').val() == 'ru') {
|
||||
span.innerHTML = 'Стандарт';
|
||||
} else {
|
||||
span.innerHTML = "Standart"
|
||||
}
|
||||
td3.appendChild(span);
|
||||
tr.appendChild(td3);
|
||||
//
|
||||
td4 = document.createElement('td');
|
||||
td4.setAttribute('scope', 'col');
|
||||
//
|
||||
select = document.createElement('select');
|
||||
select.setAttribute('data-img', pic['pictures'][0]['hash_name']);
|
||||
select.setAttribute('id', 'ds'+label_id);
|
||||
select.setAttribute('type', 'select');
|
||||
select.setAttribute('class', 'form-control diagnoses_select')
|
||||
//
|
||||
option = document.createElement('option');
|
||||
option.setAttribute('value', '');
|
||||
option.setAttribute('disabled', '');
|
||||
option.setAttribute('selected', '');
|
||||
if ($('#language').val() == 'ru') {
|
||||
option.innerHTML = 'Диагноз';
|
||||
} else {
|
||||
option.innerHTML = 'Diagnos';
|
||||
}
|
||||
|
||||
select.appendChild(option);
|
||||
td4.appendChild(select);
|
||||
//
|
||||
span = document.createElement('span');
|
||||
span.setAttribute('class', 'standart_modal btn btn-secondary btn-sm')
|
||||
span.setAttribute('data-code', '');
|
||||
if($('#language').val() == 'ru') {
|
||||
span.innerHTML = 'Стандарт';
|
||||
} else {
|
||||
span.innerHTML = "Standart"
|
||||
}
|
||||
td4.appendChild(span);
|
||||
tr.appendChild(td4)
|
||||
//
|
||||
$('#endo_history').append(tr);
|
||||
}
|
||||
// else {
|
||||
//
|
||||
// tr = document.createElement('tr');
|
||||
// td1 = document.createElement('td');
|
||||
// td1.setAttribute('scope', 'col');
|
||||
// img = document.createElement('img');
|
||||
// img.setAttribute('src', '/img/'+data['untask_pics'][untask_num]['file']);
|
||||
// //
|
||||
// img.setAttribute('class', 'preview_img');
|
||||
// td1.appendChild(img);
|
||||
// tr.appendChild(td1);
|
||||
// //
|
||||
// td2 = document.createElement('td');
|
||||
// td2.setAttribute('scope', 'col');
|
||||
// td2.innerHTML = organ;
|
||||
// tr.appendChild(td2);
|
||||
// //
|
||||
// //
|
||||
// td3 = document.createElement('td');
|
||||
// td3.setAttribute('scope', 'col');
|
||||
// //
|
||||
// span = document.createElement('span');
|
||||
// span.setAttribute('class', 'expert_diagnos');
|
||||
// span.setAttribute('data-img', pic['file']);
|
||||
// span.innerHTML = data['tasks'][untask_num]['task']['class'];
|
||||
// td3.appendChild(span);
|
||||
// //
|
||||
// span = document.createElement('span');
|
||||
// span.setAttribute('class', 'standart_modal btn btn-secondary btn-sm')
|
||||
// span.setAttribute('data-code', '');
|
||||
// if($('#language').val() == 'ru') {
|
||||
// span.innerHTML = 'Стандарт';
|
||||
// } else {
|
||||
// span.innerHTML = "Standart"
|
||||
// }
|
||||
// td3.appendChild(span);
|
||||
// tr.appendChild(td3);
|
||||
// //
|
||||
// td4 = document.createElement('td');
|
||||
// td4.setAttribute('scope', 'col');
|
||||
// //
|
||||
// select = document.createElement('select');
|
||||
// select.setAttribute('data-img', pic['file']);
|
||||
// select.setAttribute('id', 'ds'+label_id);
|
||||
// select.setAttribute('type', 'select');
|
||||
// select.setAttribute('class', 'form-control diagnoses_select')
|
||||
// //
|
||||
// option = document.createElement('option');
|
||||
// option.setAttribute('value', '');
|
||||
// option.setAttribute('disabled', '');
|
||||
// option.setAttribute('selected', '');
|
||||
// if ($('#language').val() == 'ru') {
|
||||
// option.innerHTML = 'Диагноз';
|
||||
// } else {
|
||||
// option.innerHTML = 'Diagnos';
|
||||
// }
|
||||
//
|
||||
// select.appendChild(option);
|
||||
// td4.appendChild(select);
|
||||
// //
|
||||
// span = document.createElement('span');
|
||||
// span.setAttribute('class', 'standart_modal btn btn-secondary btn-sm')
|
||||
// span.setAttribute('data-code', '');
|
||||
// if($('#language').val() == 'ru') {
|
||||
// span.innerHTML = 'Стандарт';
|
||||
// } else {
|
||||
// span.innerHTML = "Standart"
|
||||
// }
|
||||
// td4.appendChild(span);
|
||||
// tr.appendChild(td4)
|
||||
// //
|
||||
// $('#endo_history').append(tr);
|
||||
// }
|
||||
label_id = label_id + 1
|
||||
}
|
||||
|
||||
//Если не прошел запрос к API
|
||||
//for (untask_num in data['tasks']){
|
||||
// pic = data['tasks'][untask_num]
|
||||
// organ = ''
|
||||
// if (pic['organ'])
|
||||
// {
|
||||
// organ = pic['organ']
|
||||
// }
|
||||
// console.log(pic)
|
||||
// tr = document.createElement('tr');
|
||||
// td1 = document.createElement('td');
|
||||
// td1.setAttribute('scope', 'col');
|
||||
// img = document.createElement('img');
|
||||
// img.setAttribute('src', '/img/'+data['untask_pics'][untask_num]['file']);
|
||||
// //
|
||||
// img.setAttribute('class', 'preview_img');
|
||||
// td1.appendChild(img);
|
||||
// tr.appendChild(td1);
|
||||
// //
|
||||
// td2 = document.createElement('td');
|
||||
// td2.setAttribute('scope', 'col');
|
||||
// td2.innerHTML = organ;
|
||||
// tr.appendChild(td2);
|
||||
// //
|
||||
// //
|
||||
// td3 = document.createElement('td');
|
||||
// td3.setAttribute('scope', 'col');
|
||||
// //
|
||||
// span = document.createElement('span');
|
||||
// span.setAttribute('class', 'expert_diagnos');
|
||||
// span.setAttribute('data-img', pic['file']);
|
||||
// span.innerHTML = data['tasks'][untask_num]['task']['class'];
|
||||
// td3.appendChild(span);
|
||||
// //
|
||||
// span = document.createElement('span');
|
||||
// span.setAttribute('class', 'standart_modal btn btn-secondary btn-sm')
|
||||
// span.setAttribute('data-code', '');
|
||||
// if($('#language').val() == 'ru') {
|
||||
// span.innerHTML = 'Стандарт';
|
||||
// } else {
|
||||
// span.innerHTML = "Standart"
|
||||
// }
|
||||
// td3.appendChild(span);
|
||||
// tr.appendChild(td3);
|
||||
// //
|
||||
// td4 = document.createElement('td');
|
||||
// td4.setAttribute('scope', 'col');
|
||||
// //
|
||||
// select = document.createElement('select');
|
||||
// select.setAttribute('data-img', pic['file']);
|
||||
// select.setAttribute('id', 'ds'+label_id);
|
||||
// select.setAttribute('type', 'select');
|
||||
// select.setAttribute('class', 'form-control diagnoses_select')
|
||||
// //
|
||||
// option = document.createElement('option');
|
||||
// option.setAttribute('value', '');
|
||||
// option.setAttribute('disabled', '');
|
||||
// option.setAttribute('selected', '');
|
||||
// if ($('#language').val() == 'ru') {
|
||||
// option.innerHTML = 'Диагноз';
|
||||
// } else {
|
||||
// option.innerHTML = 'Diagnos';
|
||||
// }
|
||||
//
|
||||
// select.appendChild(option);
|
||||
// td4.appendChild(select);
|
||||
// //
|
||||
// span = document.createElement('span');
|
||||
// span.setAttribute('class', 'standart_modal btn btn-secondary btn-sm')
|
||||
// span.setAttribute('data-code', '');
|
||||
// if($('#language').val() == 'ru') {
|
||||
// span.innerHTML = 'Стандарт';
|
||||
// } else {
|
||||
// span.innerHTML = "Standart"
|
||||
// }
|
||||
// td4.appendChild(span);
|
||||
// tr.appendChild(td4)
|
||||
// //
|
||||
// $('#endo_history').append(tr);
|
||||
// label_id = label_id + 1
|
||||
//}
|
||||
|
||||
|
||||
|
||||
select_fill();
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
if (pic.length > 0){
|
||||
if(pic.length > 1)
|
||||
{
|
||||
// $('#exception').html('Обнаружены снимки с дублирующимся описанием, перейдите в подробный отчет');
|
||||
// $('#exception').slideDown(500);
|
||||
// $('#exception').delay(2000).slideUp();
|
||||
console.log('Обнаружены снимки с дублирующимся описанием')
|
||||
}
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
// console.log(pic[0]['tag_id'])
|
||||
$(this).val(pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
// $(this).select2('data', {id: pic[0]['tag_id'], text: 'Lorem Ipsum'});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for (pic_num in data['expert_pics'])
|
||||
{
|
||||
pic = data['expert_pics'][pic_num]
|
||||
if (pic.length > 0){
|
||||
if(pic.length > 1)
|
||||
{
|
||||
// $('#exception').html('Обнаружены снимки с дублирующимся описанием, перейдите в подробный отчет');
|
||||
// $('#exception').slideDown(500);
|
||||
console.log('Обнаружены снимки с дублирующимся экспертым описанием')
|
||||
}
|
||||
|
||||
$.each($('.expert_diagnos'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
console.log(pic[0]['icd']);
|
||||
$(this).html(pic[0]['icd']+' '+pic[0]['tag'])
|
||||
$(this).parent().children('.standart_modal').data('tag_id', pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
// $(this).select2('data', {id: pic[0]['tag_id'], text: 'Lorem Ipsum'});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
$('.standart_modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
// console.log($(this).data('code'))
|
||||
standart_load($(this).data('code'), false, $(this).data('tag_id'));
|
||||
})
|
||||
$('.diagnoses_select').on('change', function() {
|
||||
// console.log( this.value );
|
||||
save_select(this);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
});
|
||||
$('.diagnoses_select').select2();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//saving on select change OK FOR MULTIPROFILE
|
||||
function save_select(element){
|
||||
// console.log(element.value);
|
||||
// console.log($(element).data('img'));
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_name: $(element).data('img'),
|
||||
visit_id: $('#visit_id').val(),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/save_pic_diagnos',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$(element).parent().children('.standart_modal').data('code', data['icd']);
|
||||
$(element).parent().children('.standart_modal').data('tag_id', data['tag_id']);
|
||||
$('#success').html('Диагноз сохранен');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
$('#request_waiting').hide();
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
$('#request_waiting').hide();
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getId(str)
|
||||
{
|
||||
return(str.replaceAll(' ','').replaceAll(',','').replaceAll('.','').replaceAll(';','').replaceAll(':','').replaceAll('(','').replaceAll(')','').replaceAll('-','').replaceAll('/','').replaceAll('\\',''))
|
||||
}
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function standart_load(code, full, tag_id){
|
||||
$('#cur_modal_std').val(code);
|
||||
$('#cur_modal_tag_id').val(tag_id);
|
||||
lang = getUrlParameter('lang');
|
||||
console.log('lang - '+lang);
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_standart?icd='+code+'&tag_id='+tag_id+'&lang='+lang,
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html(data['standart_name']);
|
||||
if(lang == 'en'){
|
||||
$('#standart_diagnos').html('Diagnosis: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Type of standard: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('ICD-10 code: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Treatment time (days): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#standart_diagnos').html('Диагноз: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Вид стандарта: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('Код по МКБ-10: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Сроки лечения (дней): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
var groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if (!(groups.includes(std['service_type'])))
|
||||
{
|
||||
groups.push(std['service_type'])
|
||||
$('#standart_body').append('<h5>'+std['service_type']+'</h5><div id="group'+getId(std['service_type'])+'"></div>');
|
||||
}
|
||||
}
|
||||
var sub_groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
for (group in groups){
|
||||
if(!($('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype'])) == true))
|
||||
{
|
||||
$('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype']), true);
|
||||
$('#group'+getId(std['service_type'])).append('<p>'+std['service_subtype']+'</p>');
|
||||
if(lang == 'en')
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Medical Service Code</th><th scope="col">Name</th><th scope="col">Approximate frequency of presentation</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
else
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Код медицинской услуги</th><th scope="col">Наименование</th><th scope="col">Примерная частота представления</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
if(full == true){
|
||||
var std = data['standart'][std_num]
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if(std['periodicity'] == '1'){
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$('#copy_text').data('text', data['for_copy'])
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html('');
|
||||
$('#standart_diagnos').html('');
|
||||
$('#standart_type').html('');
|
||||
$('#standart_icd_code').html('');
|
||||
$('#standart_time').html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#copy_text').on("click", function(){
|
||||
$('#text_to_copy').html($('#copy_text').data('text'));
|
||||
function listener(e) {
|
||||
str = document.getElementById('text_to_copy').innerHTML
|
||||
e.clipboardData.setData("text/html", str);
|
||||
e.clipboardData.setData("text/plain", str);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
$('#copy_text').addClass('check-icn');
|
||||
setTimeout(function() {
|
||||
$('#copy_text').removeClass('check-icn');
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
$('#start_rec').on("click", function()
|
||||
{
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
startRec('source');
|
||||
else
|
||||
loadWOrec('source');
|
||||
});
|
||||
|
||||
$('#save_picture').on("click", function()
|
||||
{
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
startRec('webcam');
|
||||
else
|
||||
loadWOrec('webcam');
|
||||
});
|
||||
|
||||
function makeblob(dataURL) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',');
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = decodeURIComponent(parts[1]);
|
||||
return new Blob([raw], { type: contentType });
|
||||
}
|
||||
var parts = dataURL.split(BASE64_MARKER);
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = window.atob(parts[1]);
|
||||
var rawLength = raw.length;
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength);
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uInt8Array], { type: contentType });
|
||||
}
|
||||
|
||||
function loadWOrec(from){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var organ = 0
|
||||
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
$.each($('.endo_image'), function(e) {
|
||||
formData.append("files", makeblob($(this).attr('src')));
|
||||
i += 1;
|
||||
});
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/save_images?patient_id='+$('#patient_id').val()+'&organ='+organ+'&visit_id='+$('#visit_id').val()+'&profarea_id='+'3',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
|
||||
function startRec(from){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var lang = getUrlParameter('lang');
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
var img_in_params = ''
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
$.each($('.endo_image'), function(e) {
|
||||
if($(this).data('type') == "blob")
|
||||
formData.append("files", makeblob($(this).attr('src')));
|
||||
else
|
||||
{
|
||||
formData.append("files", $(this).attr('src'));
|
||||
img_in_params = img_in_params + $(this).data('name') + ','
|
||||
}
|
||||
i += 1;
|
||||
});
|
||||
let searchParams = new URLSearchParams(window.location.search)
|
||||
force_ear = searchParams.has('force_ear');
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
console.log('ajax sending')
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/start_skinive_image_diagnostics?patient_id='+$('#patient_id').val()+'&visit_id='+$('#visit_id').val() + '&imgs='+img_in_params + '&force_ear='+force_ear+'&lang=' + lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#progress_text').html('Распознание диагноза');
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3) {
|
||||
after_error();
|
||||
$('#request_waiting').hide();
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
};
|
||||
if (data['status_id'] == 4) {
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#exception').html('Плохое качество снимка')
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
console.log('ajax error')
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
|
||||
function check_image_output(task_id)
|
||||
{
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/flebo_status/'+task_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
// console.log(data);
|
||||
if('status_id' in data){
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3)
|
||||
{
|
||||
$('#request_waiting').hide();
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#request_waiting').hide();
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#request_waiting').hide();
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select_fill(){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/3'+'?lang='+lang,
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$.each($('.diagnoses_select.diagnoses_select'), function(e) {
|
||||
console.log($(this).data('img'));
|
||||
for(tag_num in data)
|
||||
{
|
||||
var tag = data[tag_num]
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
$(this).append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
// $('#diagnoses_tags').append('<div class="custom-control custom-checkbox my-1 mr-sm-2 checktag"><input type="checkbox" id="tag'+tag['id']
|
||||
// +'" data-name="'+tag['name']+'" class="custom-control-input checkitem"><label for="tag'+tag['id']+'" class="custom-control-label">'+icd+tag['name']+'</label></div>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
$(document).ready(function () {
|
||||
console.log('try connection');
|
||||
var socket = io();//.connect('http://' + document.domain + ':' + location.port);
|
||||
socket.on('connect', function() {
|
||||
console.log('connected');
|
||||
socket.emit('message', {data: 'I\'m connected!'});
|
||||
});
|
||||
socket.on('message', function(data) {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
$(document).ready(function () {
|
||||
//Custom ordering tables
|
||||
jQuery.fn.dataTableExt.oSort["customNumber-pre"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
|
||||
var dt = $("#dir_datatable").DataTable({
|
||||
"scrollX": true,
|
||||
"aoColumnDefs": [{
|
||||
"sType": "customNumber",
|
||||
"bSortable": true,
|
||||
"aTargets": [5]
|
||||
}, {
|
||||
"searchable": false,
|
||||
"targets": [0, 1]
|
||||
}]
|
||||
});
|
||||
|
||||
$('#dir_datatable').DataTable().order([[5, 'pre'], [6, 'asc']]).draw();
|
||||
$('#dir_datatable').DataTable().column(6).visible(false);
|
||||
$('#dir_datatable').DataTable().column(0).visible(false);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
$(document).ready(function () {
|
||||
//Custom ordering tables
|
||||
jQuery.fn.dataTableExt.oSort["byDate-pre"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
jQuery.fn.dataTableExt.oSort["byDate-asc"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
jQuery.fn.dataTableExt.oSort["byDate-desc"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
|
||||
var dt = $("#pats_datatable").DataTable({
|
||||
"scrollX": true,
|
||||
"aoColumnDefs": [{
|
||||
"sType": "byDate",
|
||||
"bSortable": true,
|
||||
"aTargets": [2]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#pats_datatable').DataTable().order([[2, 'pre']]).draw();
|
||||
$('#pats_datatable').DataTable().column(0).visible(false);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
$(document).ready(function () {
|
||||
//Custom ordering tables
|
||||
jQuery.fn.dataTableExt.oSort["byDate-pre"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
jQuery.fn.dataTableExt.oSort["byDate-asc"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
jQuery.fn.dataTableExt.oSort["byDate-desc"] = function(num) {
|
||||
let splt = num.split('.')
|
||||
text = splt[2]+splt[1]+splt[0]
|
||||
return parseInt(text)
|
||||
}
|
||||
jQuery.fn.dataTableExt.oSort["byUser-pre"] = function(num) {
|
||||
if(num == $('#cur_username').val())
|
||||
return Infinity;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
var dt = $("#visit_datatable").DataTable({
|
||||
"scrollX": true,
|
||||
"aoColumnDefs": [{
|
||||
"sType": "byUser",
|
||||
"bSortable": true,
|
||||
"aTargets": [4]
|
||||
},
|
||||
{
|
||||
"sType": "byDate",
|
||||
"bSortable": true,
|
||||
"aTargets": [2]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#visit_datatable').DataTable().order([[4, 'pre'],[2, 'pre']]).draw();
|
||||
$('#visit_datatable').DataTable().column(0).visible(false);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,392 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
})
|
||||
|
||||
mapTags();
|
||||
get_stats();
|
||||
|
||||
update_dates();
|
||||
function update_dates()
|
||||
{
|
||||
chData = $('#visits_chart').data('data');
|
||||
if (chData.length < 2)
|
||||
return;
|
||||
chLabels = JSON.parse($('#visits_chart').data('labels').replaceAll('\'', '\"'));
|
||||
area_Labels = JSON.parse($('#visits_chart').data('areas').replaceAll('\'', '\"'));
|
||||
console.log(chLabels);
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.setAttribute('id', 'canvas_vc');
|
||||
$('#visits_chart').empty();
|
||||
$('#visits_chart').append(canvas);
|
||||
colors = [
|
||||
'rgba(250, 100, 100, 1)',
|
||||
'rgba(100, 250, 100, 1)',
|
||||
'rgba(100, 100, 250, 1)',
|
||||
'rgba(100, 250, 250, 1)',
|
||||
]
|
||||
datasets = []
|
||||
for(i in chData)
|
||||
{
|
||||
datasets.push({
|
||||
label: area_Labels[i],
|
||||
data: chData[i],
|
||||
backgroundColor: colors[i],
|
||||
lineTension: 0.4
|
||||
})
|
||||
}
|
||||
var chartData = {
|
||||
labels: chLabels,
|
||||
datasets: datasets
|
||||
};
|
||||
if (canvas) {
|
||||
var chart = new Chart(canvas, {
|
||||
type: 'line',
|
||||
data: chartData,
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
datalabels: {
|
||||
textAlign: 'center',
|
||||
maintainAspectRatio: false,
|
||||
font: {
|
||||
lineHeight: 1.6
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
display: false,
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.nav-link').click(function(){
|
||||
$('.select_div').hide();
|
||||
$('#select_div'+$(this).data('profarea_id')).show();
|
||||
get_stats();
|
||||
});
|
||||
|
||||
$('.show_visits').click(function(){
|
||||
getVisits($(this).data('visit_ids'));
|
||||
});
|
||||
|
||||
|
||||
function mapTags(){
|
||||
var lang = getUrlParameter('lang');
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
|
||||
var profarea_id = $(this).data('profarea_id');
|
||||
console.log(profarea_id);
|
||||
if(lang == 'en')
|
||||
$(this).append('<option value=0 selected style="color: #888;">Diagnos</option>');
|
||||
else
|
||||
$(this).append('<option value=0 selected style="color: #888;">Диагноз</option>');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/'+profarea_id+'?lang='+lang,
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for(tag_num in data)
|
||||
{
|
||||
var tag = data[tag_num]
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
$(this).append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
console.log('appended');
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$('.diagnoses_select').on('change', function() {get_stats(null)});
|
||||
$('#pirogov_confirmed').on('change', function() {get_stats(null)});
|
||||
$('#doctor_select').on('change', function() {get_stats(null)});
|
||||
$('#start_date').on('change', function() {get_stats(null)});
|
||||
$('#end_date').on('change', function() {get_stats(null)});
|
||||
$('#med_visit').on('change', function() {get_stats(null)});
|
||||
$('#med_exam').on('change', function() {get_stats(null)});
|
||||
$('#dest_direct').on('change', function() {get_stats(null)});
|
||||
$('#source_direct').on('change', function() {get_stats(null)});
|
||||
|
||||
|
||||
$('#today').on('click', function() {get_stats('today')});
|
||||
$('#7days').on('click', function() {get_stats('7days')});
|
||||
$('#30days').on('click', function() {get_stats('30days')});
|
||||
|
||||
|
||||
|
||||
function get_stats(time_param)
|
||||
{
|
||||
lang = getUrlParameter('lang');
|
||||
var start_date = $('#start_date').val();
|
||||
var end_date = $('#end_date').val();
|
||||
var user_id = $('#doctor_select').val();
|
||||
var pirogov_confirmed = $('#pirogov_confirmed').is(':checked');
|
||||
var med_exam = $('#med_exam').is(':checked');
|
||||
var med_visit = $('#med_visit').is(':checked');
|
||||
var dest_direct = $('#dest_direct').is(':checked');
|
||||
var source_direct = $('#source_direct').is(':checked');
|
||||
var profarea_id = $('.tab-pane.active').data('profarea_id');
|
||||
var diagnos_id = $('#diagnos'+profarea_id).val();
|
||||
var clinic_id = $('#clinic_id').val();
|
||||
var url = '/get_stats?lang='+lang+'&start_date='+start_date+'&time_param='+time_param+'&dest_direct='+dest_direct+'&source_direct='+source_direct+'&med_exam='+med_exam+'&med_visit='+med_visit+'&end_date='+end_date+'&user_id='+user_id+'&pirogov_confirmed='+pirogov_confirmed+'&diagnos_id='+diagnos_id+'&profarea_id='+profarea_id+'&clinic_id='+clinic_id;
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#num_surgical'+profarea_id).html(data['surgical']);
|
||||
$('#num_surgical'+profarea_id).parent().data('visit_ids', data['visits']['surgical']);
|
||||
$('#num_therapeutic'+profarea_id).html(data['therapeutic']);
|
||||
$('#num_therapeutic'+profarea_id).parent().data('visit_ids', data['visits']['therapeutic']);
|
||||
$('#num_waiting'+profarea_id).html(data['waiting']);
|
||||
$('#num_norma'+profarea_id).html(data['norma']);
|
||||
$('#num_waiting'+profarea_id).parent().data('visit_ids', data['visits']['waiting']);
|
||||
$('#num_unsatisfactory'+profarea_id).html(data['unsatisfactory']);
|
||||
$('#num_unsatisfactory'+profarea_id).parent().data('visit_ids', data['visits']['unsatisfactory']);
|
||||
var chLabels = [data['translate']['surgical'],data['translate']['therapeutic'],data['translate']['norma'],data['translate']['waiting'],data['translate']['unsatisfactory']];
|
||||
var chNames = ['surgical','therapeutic','norma','waiting','unsatisfactory'];
|
||||
var chData = [data['surgical'], data['therapeutic'], data['norma'], data['waiting'], data['unsatisfactory']];
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.setAttribute('id', 'canvas'+profarea_id);
|
||||
$('#chart'+profarea_id).empty();
|
||||
$('#chart'+profarea_id).append(canvas);
|
||||
var chartData = {
|
||||
labels: chLabels,
|
||||
datasets: [{
|
||||
data: chData,
|
||||
backgroundColor: [
|
||||
'rgba(250, 100, 100, 1)',
|
||||
'rgba(100, 190, 100, 1)',
|
||||
'rgba(0, 250, 0, 1)',
|
||||
'rgba(200, 200, 200, 1)',
|
||||
'rgba(100, 100, 200, 1)',
|
||||
]
|
||||
}]
|
||||
};
|
||||
if (canvas) {
|
||||
var chart = new Chart(canvas, {
|
||||
type: 'doughnut',
|
||||
data: chartData,
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
datalabels: {
|
||||
color: '#111',
|
||||
textAlign: 'center',
|
||||
font: {
|
||||
lineHeight: 1.6
|
||||
},
|
||||
formatter: function(value, ctx) {
|
||||
return ctx.chart.data.labels[ctx.dataIndex] + '\n' + value + '%';
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
enabled: false
|
||||
},
|
||||
onClick: (evt, activeEls, chart) => {
|
||||
if (activeEls.length === 0 || chart.getElementsAtEventForMode(evt, 'nearest', {
|
||||
intersect: true
|
||||
}, true).length === 0) {
|
||||
return;
|
||||
}
|
||||
console.log('Function param: ', activeEls[0].index);
|
||||
getVisits(data['visits'][chNames[activeEls[0].index]])
|
||||
// console.log('lookup with the event: ', chart.getElementsAtEventForMode(evt, 'nearest', {
|
||||
// intersect: true
|
||||
// }, true)[0].index);
|
||||
|
||||
// activeEls.forEach(point => {
|
||||
// console.log('val: ', chart.data.datasets[point.datasetIndex].data[point.index])
|
||||
// })
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('.excl_dwnld').on('click', function() {getExcel()});
|
||||
|
||||
$('.excl_dwnld2_0').on('click', function() {getExcel2_0()});
|
||||
|
||||
function getExcel2_0(){
|
||||
lang = getUrlParameter('lang');
|
||||
var start_date = $('#start_date').val();
|
||||
var end_date = $('#end_date').val();
|
||||
var clinic_id = $('#clinic_id').val();
|
||||
var url = '/routing/report/'+clinic_id+'?lang='+lang+'&start_date='+start_date+'&end_date='+end_date+'&reload='+$('#reload').is(':checked');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var a = document.createElement('a');
|
||||
a.href = '/excel/'+ data['file'];
|
||||
filename = $('#clinic_name').val()+'_report'
|
||||
a.download = filename + '.xlsx';
|
||||
document.body.append(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL('/excel/'+ data['file']);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getExcel(){
|
||||
lang = getUrlParameter('lang');
|
||||
var start_date = $('#start_date').val();
|
||||
var end_date = $('#end_date').val();
|
||||
var user_id = $('#doctor_select').val();
|
||||
var pirogov_confirmed = $('#pirogov_confirmed').is(':checked');
|
||||
var med_exam = $('#med_exam').is(':checked');
|
||||
var med_visit = $('#med_visit').is(':checked');
|
||||
var dest_direct = $('#dest_direct').is(':checked');
|
||||
var source_direct = $('#source_direct').is(':checked');
|
||||
var profarea_id = $('.tab-pane.active').data('profarea_id');
|
||||
var diagnos_id = $('#diagnos'+profarea_id).val();
|
||||
var clinic_id = $('#clinic_id').val();
|
||||
var url = '/get_excel_stats?lang='+lang+'&start_date='+start_date+'&dest_direct='+dest_direct+'&source_direct='+source_direct+'&med_exam='+med_exam+'&med_visit='+med_visit+'&end_date='+end_date+'&user_id='+user_id+'&pirogov_confirmed='+pirogov_confirmed+'&diagnos_id='+diagnos_id+'&profarea_id='+profarea_id+'&clinic_id='+clinic_id;
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var a = document.createElement('a');
|
||||
a.href = '/excel/'+ data['file'];
|
||||
filename = $('#clinic_name').val()+'_report'
|
||||
a.download = filename + '.xlsx';
|
||||
document.body.append(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL('/excel/'+ data['file']);
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getVisits(ids){
|
||||
var message = {
|
||||
visit_ids: ids,
|
||||
clinic_id: $('#clinic_id').val()
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/prepare_stats_visits',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
$('#visits_table').empty();
|
||||
$('#visits_modal').modal('toggle');
|
||||
$('#datatable').DataTable().clear().destroy();
|
||||
for (visit_num in data)
|
||||
{
|
||||
visit = data[visit_num]
|
||||
if($('#language').val() == 'ru')
|
||||
$('#visits_table').append('<tr '+getTooltip(visit['confirmed_tags'])+'><td><a href="/medical_report/'+visit['id']+'">'+visit['patient']+'</a></td><td><a href="/medical_report/'+visit['id']+'">'+visit['date']+'</a></td><td><a href="/medical_report/'+visit['id']+'">'+visit['telephone']+'</a></td><td><a href="/medical_report/'+visit['id']+'">'+visit['doctor']+'</a></td><td style="display: none;">'+visit['department']+'</td><td><a href="/medical_report/'+visit['id']+'">'+getDiagnosesText(visit['confirmed_tags'])+'</a></td></tr>');
|
||||
else
|
||||
$('#visits_table').append('<tr '+getTooltip(visit['confirmed_tags'])+'><td><a href="/medical_report/'+visit['id']+'?lang=en">'+visit['patient']+'</a></td><td><a href="/medical_report/'+visit['id']+'">'+visit['date']+'</a></td><td><a href="/medical_report/'+visit['id']+'">'+visit['telephone']+'</a></td><td><a href="/medical_report/'+visit['id']+'">'+visit['doctor']+'</a></td><td style="display: none;">'+visit['department']+'</td><td><a href="/medical_report/'+visit['id']+'">'+getDiagnosesText(visit['confirmed_tags'])+'</a></td></tr>');
|
||||
}
|
||||
$('tr[data-bs-toggle="tooltip"]').tooltip({
|
||||
html: true,
|
||||
});
|
||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'))
|
||||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
||||
return new bootstrap.Tooltip(tooltipTriggerEl)
|
||||
})
|
||||
// $('#datatable').DataTable({
|
||||
// "scrollX": true
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
function getDiagnosesText(tags)
|
||||
{
|
||||
var diagnoses = '';
|
||||
for(tag in tags)
|
||||
diagnoses += tags[tag] + '<br>'
|
||||
return diagnoses
|
||||
}
|
||||
function getTooltip(tags)
|
||||
{
|
||||
var diagnoses = '';
|
||||
for(tag in tags)
|
||||
diagnoses += tags[tag] + '<br>'
|
||||
return ''
|
||||
// return 'data-bs-toggle="tooltip" data-bs-placement="bottom" title="'+diagnoses+'"'
|
||||
}
|
||||
|
||||
$('#visits_modal').on('shown.bs.modal', function () {
|
||||
// $('#datatable_wrapper').hide();
|
||||
$('#datatable').DataTable( {
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Russian.json"
|
||||
},
|
||||
"scrollX": true
|
||||
});
|
||||
});
|
||||
|
||||
function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,120 @@
|
||||
function wait_button(btn)
|
||||
{
|
||||
$(btn).attr("disabled", true);
|
||||
}
|
||||
function resume_button(btn)
|
||||
{
|
||||
$(btn).attr("disabled", false);
|
||||
}
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
||||
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
return new bootstrap.Popover(popoverTriggerEl)
|
||||
});
|
||||
|
||||
$.each($('.fa'), function(e) {
|
||||
console.log('fa found' + $(this).data('src'));
|
||||
$(this).css('font-family', "\'Font Awesome\\ 5 Free\'");
|
||||
$(this).css('font-weight', 900);
|
||||
$(this).css('font-size', '20px');
|
||||
$(this).css('content', $(this).data('src'));
|
||||
});
|
||||
|
||||
$('.diagnoses_select').select2();
|
||||
$('.routing_select2').select2();
|
||||
|
||||
$('.close').click(function(){
|
||||
$('#' + $(this).data('target')).hide();
|
||||
})
|
||||
|
||||
$('.kill').click(function(){
|
||||
$('#' + $(this).data('target')).remove();
|
||||
})
|
||||
|
||||
$('.change-color-mode').on('click', function(){
|
||||
change_color_mode($('body'));
|
||||
change_color_mode($('.navbar'));
|
||||
change_color_mode($('.custom-nav-item'));
|
||||
change_color_mode($('.card'));
|
||||
});
|
||||
|
||||
function change_color_mode(e){
|
||||
if (e.attr('data-theme')) {
|
||||
e.removeAttr('data-theme');
|
||||
} else {
|
||||
e.attr('data-theme', 'dark');
|
||||
}
|
||||
}
|
||||
|
||||
//Язык для datatable
|
||||
var url = document.location.search;
|
||||
var searchParam = new URLSearchParams(url);
|
||||
var lang = searchParam.get('lang');
|
||||
if (lang == 'ru') {
|
||||
$('#datatable').DataTable({
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Russian.json"
|
||||
},
|
||||
"scrollX": true
|
||||
});
|
||||
} else {
|
||||
$('#datatable').DataTable({
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.10.19/i18n/English.json"
|
||||
},
|
||||
"scrollX": true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('#header_tabs li a').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
$(this).tab('show');
|
||||
$('#organs_group').hide();
|
||||
if ($(this).attr('id') == 'endocscopy_link')
|
||||
{
|
||||
$('#organs_group').show();
|
||||
}
|
||||
if ($(this).attr('id') == 'live_endocscopy_link')
|
||||
{
|
||||
$('#organs_group').show();
|
||||
}
|
||||
})
|
||||
|
||||
$('#diagnoses_tabs li a').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
$(this).tab('show');
|
||||
});
|
||||
|
||||
$('#hide_deleted').click(function(){
|
||||
$('.sql_deleted').hide();
|
||||
$('#hide_deleted').hide();
|
||||
$('#show_deleted').show();
|
||||
});
|
||||
|
||||
$('#show_deleted').click(function(){
|
||||
$('.sql_deleted').show();
|
||||
$('#hide_deleted').show();
|
||||
$('#show_deleted').hide();
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,289 @@
|
||||
$(document).ready(function () {
|
||||
$("#gen_pass").click(function () {
|
||||
$("#password").val(makePassword(8));
|
||||
return false;
|
||||
});
|
||||
|
||||
function makePassword(length) {
|
||||
var result = '';
|
||||
var characters_g = 'AEIOUYaeiouy';
|
||||
var characters_s = 'BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz';
|
||||
var characters_g_Length = characters_g.length;
|
||||
var characters_s_Length = characters_s.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (i % 2 == 0) {
|
||||
result += characters_g.charAt(Math.floor(Math.random() * characters_g_Length));
|
||||
} else {
|
||||
result += characters_s.charAt(Math.floor(Math.random() * characters_s_Length));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#add_clinic').on('click', function () {
|
||||
$('#clinic_name').css('background-color', '#fff');
|
||||
$('#username').css('background-color', '#fff');
|
||||
$('#password').css('background-color', '#fff');
|
||||
$('#full_name').css('background-color', '#fff');
|
||||
|
||||
demo = $("#create_demo").prop("checked");
|
||||
|
||||
|
||||
clinic_name = $('#clinic_name').val();
|
||||
username = $('#username').val();
|
||||
|
||||
password = $('#password').val();
|
||||
full_name = $('#full_name').val();
|
||||
email = $('#email').val();
|
||||
profarea = $('#profarea').val();
|
||||
|
||||
send_directions = $('#send_directions').prop("checked");
|
||||
accept_direction = $('#accept_direction').prop("checked");
|
||||
partner_clinic = $('#partner_clinic').prop("checked");
|
||||
add_pirogov = $('#add_pirogov').prop("checked");
|
||||
balance = $('#rec_balance').val();
|
||||
false_form = false
|
||||
if (!(clinic_name)) {
|
||||
$('#clinic_name').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if (!(username)) {
|
||||
$('#username').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if (!(password)) {
|
||||
$('#password').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if (!(full_name)) {
|
||||
$('#full_name').css('background-color', '#f55');
|
||||
full_name = true;
|
||||
}
|
||||
if (false_form == false) {
|
||||
var message = {
|
||||
demo: demo,
|
||||
clinic_name: clinic_name,
|
||||
username: username,
|
||||
password: password,
|
||||
full_name: full_name,
|
||||
profarea: profarea,
|
||||
email: email,
|
||||
send_directions: send_directions,
|
||||
accept_direction: accept_direction,
|
||||
partner_clinic: partner_clinic,
|
||||
add_pirogov: add_pirogov,
|
||||
balance: balance
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/su_add_clinic',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if (data['success'] == true) {
|
||||
$('#clinic_name').val('');
|
||||
$('#username').val('');
|
||||
$('#password').val('');
|
||||
$('#full_name').val('');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
} else {
|
||||
//$('#username').css('background-color', '#f55');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#su_add_user').on('click', function () {
|
||||
$('#username').css('background-color', '#fff');
|
||||
$('#password').css('background-color', '#fff');
|
||||
$('#full_name').css('background-color', '#fff');
|
||||
username = $('#username').val();
|
||||
password = $('#password').val();
|
||||
full_name = $('#full_name').val();
|
||||
super_admin = $('#super_admin').prop("checked");
|
||||
false_form = false
|
||||
|
||||
if (!(username)) {
|
||||
$('#username').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if (!(password)) {
|
||||
$('#password').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if (!(full_name)) {
|
||||
$('#full_name').css('background-color', '#f55');
|
||||
full_name = true;
|
||||
}
|
||||
|
||||
if (false_form == false) {
|
||||
var message = {
|
||||
username: username,
|
||||
password: password,
|
||||
full_name: full_name,
|
||||
super_admin: super_admin
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/su_add_user',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if (data['success'] == true) {
|
||||
$('#clinic_name').val('');
|
||||
$('#username').val('');
|
||||
$('#password').val('');
|
||||
$('#full_name').val('');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
} else {
|
||||
$('#username').css('background-color', '#f55');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#su_add_clinic_user').on('click', function () {
|
||||
$('#username').css('background-color', '#fff');
|
||||
$('#username').css('background-color', '#fff');
|
||||
$('#password').css('background-color', '#fff');
|
||||
$('#full_name').css('background-color', '#fff');
|
||||
clinic_manager = $('#clinic_manager').prop("checked");
|
||||
examiner = $('#examiner').prop("checked");
|
||||
doctor = $('#doctor').prop("checked");
|
||||
directions = $('#directions').prop("checked");
|
||||
prof_doctor = $('#prof_doctor').prop("checked");
|
||||
username = $('#username').val();
|
||||
password = $('#password').val();
|
||||
clinic_id = $('#clinic_id').val();
|
||||
notification_email = $('#notification_email').val();
|
||||
full_name = $('#full_name').val();
|
||||
false_form = false;
|
||||
if(!(directions))
|
||||
{
|
||||
directions = false;
|
||||
}
|
||||
|
||||
if(!(prof_doctor))
|
||||
{
|
||||
prof_doctor = false;
|
||||
}
|
||||
|
||||
|
||||
if(!(full_name))
|
||||
{
|
||||
$('#full_name').css('background-color', '#f55');
|
||||
full_name = true;
|
||||
}
|
||||
|
||||
if(!(username))
|
||||
{
|
||||
$('#username').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
if(!(password))
|
||||
{
|
||||
$('#password').css('background-color', '#f55');
|
||||
false_form = true;
|
||||
}
|
||||
|
||||
if(false_form==false)
|
||||
{
|
||||
var message = {
|
||||
clinic_manager: clinic_manager,
|
||||
examiner: examiner,
|
||||
username:username,
|
||||
password:password,
|
||||
full_name:full_name,
|
||||
directions:directions,
|
||||
doctor:doctor,
|
||||
prof_doctor:prof_doctor,
|
||||
notification_email:notification_email,
|
||||
clinic_id:clinic_id
|
||||
}
|
||||
$.each($('.area_check'), function(e) {
|
||||
if($(this).prop('checked') == true)
|
||||
message['area'] = $(this).data('area_id');
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/su_add_clinic_user',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#username').val('');
|
||||
$('#password').val('');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
$('#username').css('background-color', '#f55');
|
||||
if(data.hasOwnProperty('message'))
|
||||
{
|
||||
show_error(data.message,0);
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
if(data.hasOwnProperty('message'))
|
||||
{
|
||||
show_error('Ошибка при добавлении пользователя',0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
});
|
||||
$("#create_demo").on('click', function () {
|
||||
|
||||
let send_directions = $("#send_directions");
|
||||
let accept_direction = $("#accept_direction");
|
||||
let partner_clinic = $("#partner_clinic");
|
||||
|
||||
if ($("#create_demo")[0].checked == true) {
|
||||
partner_clinic[0].checked = false
|
||||
send_directions[0].checked = false
|
||||
accept_direction[0].checked = false
|
||||
|
||||
partner_clinic[0].disabled = true
|
||||
send_directions[0].disabled = true
|
||||
accept_direction[0].disabled = true
|
||||
$('#remaining').attr("style", "display: block")
|
||||
} else {
|
||||
partner_clinic[0].disabled = false
|
||||
send_directions[0].disabled = false
|
||||
accept_direction[0].disabled = false
|
||||
$('#remaining').attr("style", "display: none")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
@@ -0,0 +1,186 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
reloadCategories();
|
||||
mapTags();
|
||||
|
||||
$('#add_tag_diagnos').click(function(){
|
||||
if($(this).is(':checked'))
|
||||
{
|
||||
$('#category_block').hide();
|
||||
$('#icd_block').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#category_block').show();
|
||||
$('#icd_block').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#add_group').click(function(){
|
||||
var message = {
|
||||
name: $('#add_group_name').val()
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/add_category',
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#add_group_name').val('');
|
||||
$('#add_group_name').css('background-color', 'lightgreen');
|
||||
$('#add_tag_category').empty();
|
||||
$('#add_tag_category').append('<option value="" disabled="" selected="">Категория</option>');
|
||||
reloadCategories();
|
||||
mapTags();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#add_group_name').css('background-color', 'lightcora');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#check_diagnoses').click(function(){
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/check_diagnoses',
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#add_tag').click(function(){
|
||||
$('#add_tag_name').css('background-color', 'white');
|
||||
var message = {
|
||||
name: $('#add_tag_name').val(),
|
||||
icd: $('#add_icd_code').val(),
|
||||
diagnos: $('#add_tag_diagnos').is(':checked'),
|
||||
category: $('#add_tag_category').val()
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/add_tag',
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#add_tag_name').css('background-color', 'lightgreen');
|
||||
$('#add_tag_name').val('');
|
||||
$('#add_icd_code').val('');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#add_tag_name').css('background-color', 'lightcora');
|
||||
}
|
||||
mapTags();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function reloadCategories(){
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_categories',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for(category in data)
|
||||
{
|
||||
$('#add_tag_category').append('<option value=' + data[category]['id'] + '> ' + data[category]['name'] + ' </option>');
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Функция отрисовки формы!
|
||||
function mapTags(){
|
||||
$('#categorized_tags_header').empty();
|
||||
$('#categorized_tags_body').empty();
|
||||
$('#diagnoses_tags').empty();
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_categories',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
var show = 'show';
|
||||
for(category in data)
|
||||
{
|
||||
$('#categorized_tags_header').append('<a data-toggle="collapse" href="#cat'+data[category]['id']
|
||||
+'" aria-expanded="true" aria-controls="#cat'+data[category]['id']
|
||||
+'" class="btn btn-link">'+data[category]['name']+'</a>')
|
||||
$('#categorized_tags_body').append('<div id="cat'+data[category]['id']
|
||||
+'" class="collapse '+show+'">');
|
||||
show = ''
|
||||
for(tag_num in data[category]['tags'])
|
||||
{
|
||||
var tag = data[category]['tags'][tag_num]
|
||||
$('#cat'+data[category]['id']).append('<div class="custom-control custom-checkbox my-1 mr-sm-2 checktag"><input type="checkbox" id="tag'+tag['id']
|
||||
+'" data-name="'+tag['name']+'" class="custom-control-input checkitem"><label for="tag'+tag['id']+'" class="custom-control-label">'+tag['name']+'</label></div>');
|
||||
}
|
||||
}
|
||||
$('.collapse').on('show.bs.collapse', function (e) {
|
||||
$('.collapse').collapse("hide")
|
||||
})
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_tags',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for(tag_num in data)
|
||||
{
|
||||
var tag = data[tag_num]
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
$('#diagnoses_tags').append('<div class="custom-control custom-checkbox my-1 mr-sm-2 checktag"><input type="checkbox" id="tag'+tag['id']
|
||||
+'" data-name="'+tag['name']+'" class="custom-control-input checkitem"><label for="tag'+tag['id']+'" class="custom-control-label">'+icd+tag['name']+'</label></div>');
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
$('.collapse').addClass('show');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,122 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#su_save_clinic_control').on('click', function(){
|
||||
api_password = $('#api_password').val();
|
||||
api_username = $('#api_username').val();
|
||||
rec_balance = $('#rec_balance').val();
|
||||
clinic_id = $('#clinic_id').val();
|
||||
demo_clinic = $('#demo_clinic').prop("checked");
|
||||
email = $('#email').val();
|
||||
inn = $('#inn').val();
|
||||
site = $('#site').val();
|
||||
telephone = $('#telephone').val();
|
||||
logo = $('#logo').val();
|
||||
send_directions = $('#send_directions').prop("checked");
|
||||
accept_direction = $('#accept_direction').prop("checked");
|
||||
partner_clinic = $('#partner_clinic').prop("checked");
|
||||
|
||||
var message = {
|
||||
api_password:api_password,
|
||||
api_username:api_username,
|
||||
rec_balance:rec_balance,
|
||||
demo_clinic: demo_clinic,
|
||||
clinic_id: clinic_id,
|
||||
email: email,
|
||||
send_directions:send_directions,
|
||||
accept_direction:accept_direction,
|
||||
partner_clinic:partner_clinic,
|
||||
inn:inn,
|
||||
site:site,
|
||||
telephone:telephone,
|
||||
logo:logo,
|
||||
areas: []
|
||||
}
|
||||
$.each($('.area_check'), function(e) {
|
||||
if($(this).prop('checked') == true)
|
||||
message['areas'].push({'id': $(this).data('area_id'), 'enabled': true})
|
||||
else
|
||||
message['areas'].push({'id': $(this).data('area_id'), 'enabled': false})
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/su_save_clinic_control',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#su_delete_clinic').on('click', function(){
|
||||
clinic_id = $('#clinic_id').val();
|
||||
|
||||
var message = {
|
||||
clinic_id: clinic_id
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/su_delete_clinic',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#su_restore_clinic').on('click', function(){
|
||||
clinic_id = $('#clinic_id').val();
|
||||
|
||||
var message = {
|
||||
clinic_id: clinic_id
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/su_restore_clinic',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.userpassword').click(function(){
|
||||
$('#password-modal').modal('toggle');
|
||||
$('#target_user_id').val($(this).data('id'));
|
||||
$('#returned_username').html('Имя пользователя: ' + $(this).data('username'));
|
||||
$('#get_password').prop('disabled', false);
|
||||
});
|
||||
|
||||
$('#password-modal').on('hidden.bs.modal', function () {
|
||||
$('#returned_password').html();
|
||||
$('#password-input-redspan').hide();
|
||||
$('#selfpasswordinput').show();
|
||||
$('#returned_password').hide();
|
||||
$('#returned_username').hide();
|
||||
$('#new_pwd_form').hide();
|
||||
$('#change_password').hide();
|
||||
});
|
||||
|
||||
|
||||
$('#change_password').click(function(){
|
||||
$('#password-input-redspan').hide();
|
||||
var message = {
|
||||
id: $('#target_user_id').val(),
|
||||
password: $('#selfpassword').val(),
|
||||
new_password: $('#new_password').val()
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/change_userpassword',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['password'])
|
||||
{
|
||||
$('#selfpasswordinput').hide();
|
||||
$('#returned_password').show();
|
||||
$('#returned_username').show();
|
||||
$('#new_pwd_form').show();
|
||||
$('#change_password').show();
|
||||
$('#returned_password').html('Пароль: ' + data['password']);
|
||||
$('#get_password').prop('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#password-input-redspan').show();
|
||||
$('#password-input-redspan').html('Ошибка доступа, проверьте правильность ввода');
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#get_password').click(function(){
|
||||
$('#password-input-redspan').hide();
|
||||
var message = {
|
||||
id: $('#target_user_id').val(),
|
||||
password: $('#selfpassword').val()
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/get_userpassword',
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['password'])
|
||||
{
|
||||
$('#selfpasswordinput').hide();
|
||||
$('#returned_password').show();
|
||||
$('#returned_username').show();
|
||||
$('#new_pwd_form').show();
|
||||
$('#change_password').show();
|
||||
$('#returned_password').html('Пароль: ' + data['password']);
|
||||
$('#get_password').prop('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#password-input-redspan').show();
|
||||
$('#password-input-redspan').html('Ошибка доступа, проверьте правильность ввода');
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
$(document).ready(function () {
|
||||
$('.alert-placeholder').mouseenter(function(){
|
||||
var popOverSettings = {
|
||||
placement: 'bottom',
|
||||
content: $(this).data('content'),
|
||||
trigger: 'hover',
|
||||
container: this,
|
||||
offset: '0'
|
||||
}
|
||||
$(this).popover(popOverSettings);
|
||||
$(this).popover('show');
|
||||
$('.popover').addClass('alert-popover');
|
||||
});
|
||||
$('.alert-placeholder').mouseleave(function(){
|
||||
$('.alert-popover').remove()
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
$(document).ready(function () {
|
||||
$('body').on('click', '.preview_img', openVideo)
|
||||
|
||||
function openVideo() {
|
||||
let type = 'image'
|
||||
let path = this.getAttribute('data-path_file');
|
||||
parts = path.split('.')
|
||||
if (['avi', 'mp4', 'webm', 'mkv', 'flv', 'wmv'].includes(parts[parts.length - 1])) {
|
||||
type = 'video'
|
||||
}
|
||||
if (type == 'video') {
|
||||
$('#video_play').modal('toggle')
|
||||
var my_video_id = videojs('video_play_file');
|
||||
my_video_id.fluid(true);
|
||||
path = path.replace('avi', 'mp4');
|
||||
my_video_id.src('/video/' + path);
|
||||
$('#rotate_video').click(function(){
|
||||
rotation = $('#rotate_video').data('rotation');
|
||||
if(rotation == undefined)
|
||||
rotation = 0
|
||||
rotation = rotation + 90;
|
||||
if(rotation == 360)
|
||||
rotation = 0;
|
||||
console.log(rotation);
|
||||
my_video_id.zoomrotate({
|
||||
rotate: rotation,
|
||||
});
|
||||
$('#rotate_video').data('rotation', rotation);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#image_open").modal('toggle')
|
||||
$('#image_file').empty()
|
||||
let image_file = document.getElementById('image_file');
|
||||
let image = document.createElement('img')
|
||||
image.setAttribute('src', '/img/' + path)
|
||||
image.setAttribute('width', '100%')
|
||||
image.setAttribute('height', '100%')
|
||||
image_file.appendChild(image)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,838 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.close-modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
});
|
||||
|
||||
$('#short_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), false, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').hide();
|
||||
$('#long_std').show();
|
||||
});
|
||||
|
||||
$('#long_std').on('click', function(){
|
||||
standart_load($('#cur_modal_std').val(), true, $('#cur_modal_tag_id').val());
|
||||
$('#short_std').show();
|
||||
$('#long_std').hide();
|
||||
});
|
||||
|
||||
$('.custom-input').on('focus focusout', function(){
|
||||
if($(this).val() == null || $(this).val() == '')
|
||||
{
|
||||
$($(this).parent()).removeClass('hastext');
|
||||
}
|
||||
else
|
||||
{
|
||||
$($(this).parent()).addClass('hastext');
|
||||
}
|
||||
});
|
||||
|
||||
// if ($('#nic_visit').length > 0){
|
||||
// load__endo_history();
|
||||
// console.log('nic visit')
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// console.log('NOT nic visit')
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// let dropzone = document.getElementById("dropzone");
|
||||
// let listing = document.getElementById("listing");
|
||||
//// var folder_items = null;
|
||||
//
|
||||
// function scanFiles(item, container) {
|
||||
// console.log(item)
|
||||
// let elem = document.createElement("li");
|
||||
// elem.textContent = item.name;
|
||||
// container.appendChild(elem);
|
||||
//
|
||||
// if (item.isDirectory) {
|
||||
// let directoryReader = item.createReader();
|
||||
// let directoryContainer = document.createElement("ul");
|
||||
// container.appendChild(directoryContainer);
|
||||
// directoryReader.readEntries(function(entries) {
|
||||
// entries.forEach(function(entry) {
|
||||
// scanFiles(entry, directoryContainer);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// function get_files(folder_items, a){
|
||||
// console.log('listing');
|
||||
// console.log(folder_items.length)
|
||||
// console.log(folder_items)
|
||||
// console.log(a)
|
||||
// listing.textContent = "";
|
||||
// for (let i=0; i<folder_items.length; i++) {
|
||||
// let item = folder_items[i].webkitGetAsEntry();
|
||||
// if (item) {
|
||||
// scanFiles(item, listing)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// dropzone.addEventListener("dragover", function(event) {
|
||||
// event.preventDefault();
|
||||
// }, false);
|
||||
//
|
||||
// dropzone.addEventListener("drop", function(event) {
|
||||
// var folder_items = event.dataTransfer.items;
|
||||
//
|
||||
// event.preventDefault();
|
||||
//// get_files()
|
||||
// a = [1,4,5,6]
|
||||
// console.log(folder_items)
|
||||
// console.log(folder_items.length)
|
||||
// var t=setInterval(function(){get_files(folder_items, a);},1000);
|
||||
//// start_monitoring(items)
|
||||
//
|
||||
// }, false);
|
||||
//
|
||||
// function optimed_monitor(){
|
||||
//
|
||||
// }
|
||||
|
||||
function previewIMG(input, preview) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
$(preview).attr('src', e.target.result);
|
||||
}
|
||||
reader.readAsDataURL(input);
|
||||
}
|
||||
|
||||
$("#file_input").change(function(){
|
||||
$('#imgs_preview').empty();
|
||||
$('#file-input-greenspan').html('');
|
||||
if ($(this)[0].files[0]) {
|
||||
$('#pre_load').hide();
|
||||
$('#file-input-greenspan').html('Загружено снимков: ' + $(this)[0].files.length);
|
||||
for(i=0;i<$(this)[0].files.length;i++)
|
||||
{
|
||||
if (($(this)[0].files[i].type.includes('image')))
|
||||
{
|
||||
|
||||
div = document.createElement('div');
|
||||
div.setAttribute('class', 'col-3 p-1 m-0');
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('class', 'preview_img');
|
||||
previewIMG($(this)[0].files[i], $(img));
|
||||
|
||||
div.appendChild(img);
|
||||
document.getElementById("imgs_preview").appendChild(div);
|
||||
}
|
||||
if (($(this)[0].files[i].type.includes('video'))) {
|
||||
console.log('Загрузка видео')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#endo_tab_link').on('click', function()
|
||||
{
|
||||
load__endo_history(true);
|
||||
});
|
||||
|
||||
$('#nn_tab_link').on('click', function()
|
||||
{
|
||||
load__endo_history(true);
|
||||
});
|
||||
|
||||
function reload_visit_info(){
|
||||
lang = getUrlParameter('lang');
|
||||
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/reload_visit_info/' + $('#visit_id').val() + '?task=off'+'&lang='+lang,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
load__endo_history(false)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function load__endo_history(rvn){
|
||||
$('#endo_history').empty();
|
||||
if(rvn)
|
||||
{
|
||||
reload_visit_info();
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_visit_info_alt/'+$('#visit_id').val(),
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentTypestatus
|
||||
success: (data) => {
|
||||
$('#endo_history').empty();
|
||||
var label_id = 0
|
||||
console.log(data['pics'])
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
organ = ''
|
||||
if (pic['organ'])
|
||||
{
|
||||
organ = pic['organ']
|
||||
}
|
||||
type = 'image'
|
||||
parts = pic['hash_name'].split('.')
|
||||
if (['avi', 'mp4', 'webm', 'mkv', 'flv', 'wmv', 'mpeg'].includes(parts[parts.length - 1])) {
|
||||
type = 'video'
|
||||
}
|
||||
if(pic.hasOwnProperty('nn_tag'))
|
||||
{
|
||||
//Нейросеть
|
||||
if($('#language').val() == 'ru')
|
||||
$('#endo_history').append('<tr><td scope="col" id="click"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'>'+pic['nn_icd']+' '+pic['nn_tag']+'</span><span class="standart_modal btn btn-primary btn-sm" data-code="'+pic['nn_icd']+'">Стандарт</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт<span></td></tr>');
|
||||
else
|
||||
$('#endo_history').append('<tr><td scope="col" id="click"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'>'+pic['nn_icd']+' '+pic['nn_tag']+'</span><span class="standart_modal btn btn-primary btn-sm" data-code="'+pic['nn_icd']+'">Standart</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart<span></td></tr>');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Без описания
|
||||
if($('#language').val() == 'ru')
|
||||
$('#endo_history').append('<tr><td scope="col"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'></span><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Стандарт</span></td></tr>');
|
||||
else
|
||||
$('#endo_history').append('<tr><td scope="col"><img src=/img/'+pic['hash_name']+' class="preview_img" data-path_file=' + pic['hash_name'] + ' data-type_file=' + type + '></td><td scope="col"><span class="expert_diagnos" data-img='+pic['hash_name']+'></span><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td><td scope="col"><select data-img='+pic['hash_name']+' id="ds'+label_id+'" type="select" class="form-control diagnoses_select"><option value="" disabled="" selected="">Диагноз</option></select><span class="standart_modal btn btn-secondary btn-sm" data-code="">Standart</span></td></tr>');
|
||||
}
|
||||
|
||||
label_id = label_id + 1
|
||||
}
|
||||
select_fill();
|
||||
for (pic_num in data['pics'])
|
||||
{
|
||||
pic = data['pics'][pic_num]
|
||||
if(pic.hasOwnProperty('confirmed')){
|
||||
if(pic['confirmed'] == true)
|
||||
{
|
||||
$.each($('.expert_diagnos'), function(e) {
|
||||
if($(this).data('img') == pic[0]['hash_name'])
|
||||
{
|
||||
console.log(pic[0]['icd']);
|
||||
$(this).html(pic[0]['icd']+' '+pic[0]['tag'])
|
||||
$(this).parent().children('.standart_modal').data('tag_id', pic[0]['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic[0]['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
if($(this).data('img') == pic['hash_name'])
|
||||
{
|
||||
$(this).val(pic['tag_id']);
|
||||
$(this).parent().children('.standart_modal').data('code', pic['icd']);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
$('.standart_modal').on('click', function(){
|
||||
$('#standart_modal').modal('toggle');
|
||||
standart_load($(this).data('code'), false, $(this).data('tag_id'));
|
||||
})
|
||||
$('.diagnoses_select').on('change', function() {
|
||||
save_select(this);
|
||||
$(this).parent().children('.standart_modal').removeClass('btn-secondary');
|
||||
$(this).parent().children('.standart_modal').addClass('btn-primary');
|
||||
});
|
||||
$('.diagnoses_select').select2();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//saving on select change
|
||||
function save_select(element){
|
||||
// console.log(element.value);
|
||||
// console.log($(element).data('img'));
|
||||
var message = {
|
||||
diagnos_id: element.value,
|
||||
pic_name: $(element).data('img'),
|
||||
visit_id: $('#visit_id').val(),
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/save_pic_diagnos',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$(element).parent().children('.standart_modal').data('code', data['icd']);
|
||||
$(element).parent().children('.standart_modal').data('tag_id', data['tag_id']);
|
||||
$('#success').html('Диагноз сохранен');
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getId(str)
|
||||
{
|
||||
return(str.replaceAll(' ','').replaceAll(',','').replaceAll('.','').replaceAll(';','').replaceAll(':','').replaceAll('(','').replaceAll(')','').replaceAll('-','').replaceAll('/','').replaceAll('\\',''))
|
||||
}
|
||||
|
||||
var getUrlParameter = function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function standart_load(code, full, tag_id){
|
||||
$('#cur_modal_std').val(code);
|
||||
$('#cur_modal_tag_id').val(tag_id);
|
||||
lang = getUrlParameter('lang');
|
||||
console.log('lang - '+lang);
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_standart?icd='+code+'&tag_id='+tag_id+'&lang='+lang,
|
||||
async: true,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html(data['standart_name']);
|
||||
if(lang == 'en'){
|
||||
$('#standart_diagnos').html('Diagnosis: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Type of standard: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('ICD-10 code: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Treatment time (days): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#standart_diagnos').html('Диагноз: <b>' + data['name']+'</b>');
|
||||
$('#standart_type').html('Вид стандарта: <b>'+data['standart_type']+'</b>');
|
||||
$('#standart_icd_code').html('Код по МКБ-10: <b>'+data['icd']+'</b>');
|
||||
$('#standart_time').html('Сроки лечения (дней): <b>'+data['days_min']+' - '+data['days_max']+'</b>');
|
||||
}
|
||||
var groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if (!(groups.includes(std['service_type'])))
|
||||
{
|
||||
groups.push(std['service_type'])
|
||||
$('#standart_body').append('<h5>'+std['service_type']+'</h5><div id="group'+getId(std['service_type'])+'"></div>');
|
||||
}
|
||||
}
|
||||
var sub_groups = [];
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
for (group in groups){
|
||||
if(!($('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype'])) == true))
|
||||
{
|
||||
$('#group'+getId(std['service_type'])).data('dt'+getId(std['service_subtype']), true);
|
||||
$('#group'+getId(std['service_type'])).append('<p>'+std['service_subtype']+'</p>');
|
||||
if(lang == 'en')
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Medical Service Code</th><th scope="col">Name</th><th scope="col">Approximate frequency of presentation</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
else
|
||||
$('#group'+getId(std['service_type'])).append('<table style="width: 100%;" class="table table-striped table-bordered custom-font"><thead><tr><th scope="col">Код медицинской услуги</th><th scope="col">Наименование</th><th scope="col">Примерная частота представления</th></tr></thead><tbody id="table'+ getId(std['service_subtype']) + getId(std['service_type'])+'"></tbody></table>');
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std_num in data['standart'])
|
||||
{
|
||||
if(full == true){
|
||||
var std = data['standart'][std_num]
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var std = data['standart'][std_num]
|
||||
if(std['periodicity'] == '1'){
|
||||
service_code = ''
|
||||
if (!(std['service_code'] == 'NULL'))
|
||||
service_code = std['service_code']
|
||||
$('#table'+ getId(std['service_subtype']) + getId(std['service_type'])).append(
|
||||
'<tr><td>'+service_code+'</td><td>'+std['standart_name']+'</td><td>'+std['periodicity']+'</td></td>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// console.log(groups)
|
||||
$('#copy_text').data('text', data['for_copy'])
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#standart_body').empty();
|
||||
$('#standart_name').html('');
|
||||
$('#standart_diagnos').html('');
|
||||
$('#standart_type').html('');
|
||||
$('#standart_icd_code').html('');
|
||||
$('#standart_time').html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
// $('#copy_text').data('text', data['for_copy'])
|
||||
|
||||
// function fallbackCopyTextToClipboard(text) {
|
||||
// var textArea = document.createElement("textarea");
|
||||
// textArea.value = text;
|
||||
//
|
||||
// // Avoid scrolling to bottom
|
||||
// textArea.style.top = "0";
|
||||
// textArea.style.left = "0";
|
||||
// textArea.style.position = "fixed";
|
||||
//
|
||||
// document.body.appendChild(textArea);
|
||||
// textArea.focus();
|
||||
// textArea.select();
|
||||
//
|
||||
// try {
|
||||
// var successful = document.execCommand('copy');
|
||||
// var msg = successful ? 'successful' : 'unsuccessful';
|
||||
// console.log('Fallback: Copying text command was ' + msg);
|
||||
// } catch (err) {
|
||||
// console.error('Fallback: Oops, unable to copy', err);
|
||||
// }
|
||||
//
|
||||
// document.body.removeChild(textArea);
|
||||
// }
|
||||
// function copyTextToClipboard(text) {
|
||||
// if (!navigator.clipboard) {
|
||||
// fallbackCopyTextToClipboard(text);
|
||||
// return;
|
||||
// }
|
||||
// navigator.clipboard.writeText(text).then(function() {
|
||||
// console.log('Async: Copying to clipboard was successful!');
|
||||
// }, function(err) {
|
||||
// console.error('Async: Could not copy text: ', err);
|
||||
// });
|
||||
// }
|
||||
|
||||
$('#copy_text').on("click", function(){
|
||||
// navigator.clipboard.writeText($('#copy_text').data('text'))
|
||||
$('#text_to_copy').html($('#copy_text').data('text'));
|
||||
function listener(e) {
|
||||
str = document.getElementById('text_to_copy').innerHTML
|
||||
e.clipboardData.setData("text/html", str);
|
||||
e.clipboardData.setData("text/plain", str);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
$('#copy_text').addClass('check-icn');
|
||||
setTimeout(function() {
|
||||
$('#copy_text').removeClass('check-icn');
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
$('#start_rec').on("click", function()
|
||||
{
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
startRec('source');
|
||||
else
|
||||
loadWOrec('source');
|
||||
});
|
||||
|
||||
$('#save_picture').on("click", function()
|
||||
{
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
startRec('webcam');
|
||||
else
|
||||
loadWOrec('webcam');
|
||||
});
|
||||
|
||||
function makeblob(dataURL) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',');
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = decodeURIComponent(parts[1]);
|
||||
return new Blob([raw], { type: contentType });
|
||||
}
|
||||
var parts = dataURL.split(BASE64_MARKER);
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = window.atob(parts[1]);
|
||||
var rawLength = raw.length;
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength);
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uInt8Array], { type: contentType });
|
||||
}
|
||||
|
||||
function loadWOrec(from){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var organ = 0
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
organ = 1
|
||||
if($('#btnradio_throat').is(":checked"))
|
||||
organ = 2
|
||||
if($('#btnradio_nose').is(":checked"))
|
||||
organ = 3
|
||||
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image') || fileList[i].type.includes('video'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
$.each($('.endo_image'), function(e) {
|
||||
formData.append("files", makeblob($(this).attr('src')));
|
||||
i += 1;
|
||||
});
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/save_images?patient_id='+$('#patient_id').val()+'&organ='+organ+'&visit_id='+$('#visit_id').val()+'&profarea_id='+'1',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
|
||||
var cookie_life = new Date();
|
||||
cookie_life.setTime(cookie_life.getTime() + (20 * 60 * 1000));
|
||||
check_cookies();
|
||||
setInterval(() => check_cookies(), 5000);
|
||||
|
||||
function check_cookies()
|
||||
{
|
||||
if (!document.hidden) {
|
||||
var url = '/new_images_monitoring'
|
||||
if ($.cookie('images_timestamp'))
|
||||
url = '/new_images_monitoring?timestamp='+$.cookie('images_timestamp')
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: url,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
for (msg_num in data['result'])
|
||||
{
|
||||
if (data['result'][msg_num]['timestamp'] > $.cookie('images_timestamp'))
|
||||
{
|
||||
if ($('#nic_saving').length > 0)
|
||||
startRemoteRec(data['result'][msg_num]['src']);
|
||||
}
|
||||
}
|
||||
$.cookie('images_timestamp', data['timestamp'], { expires: cookie_life });
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function startRemoteRec(src){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var lang = getUrlParameter('lang');
|
||||
var poll = null;
|
||||
var message = {
|
||||
src: src
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: JSON.stringify(message),
|
||||
url: '/start_remote_image_diagnostics?patient_id='+$('#patient_id').val()+'&visit_id='+$('#visit_id').val()+'&lang=' + lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#progress_text').html('Распознание диагноза');
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3)
|
||||
after_error();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function startRec(from){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var lang = getUrlParameter('lang');
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
var img_in_params = ''
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image') || fileList[i].type.includes('video'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
$.each($('.endo_image'), function(e) {
|
||||
if($(this).data('type') == "blob")
|
||||
formData.append("files", makeblob($(this).attr('src')));
|
||||
else
|
||||
{
|
||||
formData.append("files", $(this).attr('src'));
|
||||
img_in_params = img_in_params + $(this).data('name') + ','
|
||||
}
|
||||
i += 1;
|
||||
});
|
||||
let searchParams = new URLSearchParams(window.location.search)
|
||||
force_ear = searchParams.has('force_ear');
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/start_image_diagnostics?patient_id='+$('#patient_id').val()+'&visit_id='+$('#visit_id').val() + '&imgs='+img_in_params + '&force_ear='+force_ear+'&lang=' + lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#progress_text').html('Распознание диагноза');
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3)
|
||||
after_error();
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#photos').empty();
|
||||
$('#imgs_preview').empty();
|
||||
$('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
|
||||
function check_image_output(task_id)
|
||||
{
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/status/'+task_id,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
// console.log(data);
|
||||
if('status_id' in data){
|
||||
if(data['status_id'] == 0)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 1)
|
||||
poll = setTimeout(function() { check_image_output(data['id']); }, 2500);
|
||||
if(data['status_id'] == 2)
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
$('#success').html('Загрузка завершена, снимок доступен в истории')
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
load__endo_history(true);
|
||||
}
|
||||
if(data['status_id'] == 3)
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
after_error();
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function select_fill(){
|
||||
lang = getUrlParameter('lang');
|
||||
console.log(lang)
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/get_diagnos_tags/1'+'?lang='+lang,
|
||||
async: false,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
|
||||
$.each($('.diagnoses_select'), function(e) {
|
||||
// console.log(data);
|
||||
for(tag_num in data)
|
||||
{
|
||||
var tag = data[tag_num]
|
||||
// console.log(tag);
|
||||
if(tag['category_id'] == null && tag['diagnos'] == true)
|
||||
{
|
||||
var icd = ''
|
||||
if (tag['icd'])
|
||||
{
|
||||
icd = tag['icd'] + ' '
|
||||
}
|
||||
// console.log(icd);
|
||||
$(this).append('<option value="'+tag['id']+'">'+icd+tag['standart_name']+'</option>');
|
||||
// $('#diagnoses_tags').append('<div class="custom-control custom-checkbox my-1 mr-sm-2 checktag"><input type="checkbox" id="tag'+tag['id']
|
||||
// +'" data-name="'+tag['name']+'" class="custom-control-input checkitem"><label for="tag'+tag['id']+'" class="custom-control-label">'+icd+tag['name']+'</label></div>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRandomInt(max) {
|
||||
return Math.floor(Math.random() * Math.floor(max));
|
||||
}
|
||||
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,155 @@
|
||||
$(document).ready(function () {
|
||||
//https://medium.com/swlh/how-to-access-webcam-and-take-picture-with-javascript-b9116a983d78
|
||||
const webcamElement = document.getElementById('webcam');
|
||||
const canvasElement = document.getElementById('canvas');
|
||||
const snapSoundElement = document.getElementById('snapSound');
|
||||
const webcam = new Webcam(webcamElement, 'user', canvasElement, snapSoundElement);
|
||||
|
||||
|
||||
$('#live_endocscopy_link').on('click', function(){
|
||||
if ($('#live_endocscopy_link').hasClass('active'))
|
||||
{
|
||||
webcam.start()
|
||||
.then(result =>{
|
||||
console.log("webcam started");
|
||||
$('#take_picture').focus();
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$(document).keypress(function(event){
|
||||
if ($('#live_endocscopy_link').hasClass('active'))
|
||||
{
|
||||
take_picture();
|
||||
}
|
||||
});
|
||||
|
||||
$('#take_picture').on('click', function(){
|
||||
take_picture();
|
||||
})
|
||||
|
||||
$('.nav-link').on('click', function(){
|
||||
if ($(this).attr('id') != 'live_endocscopy_link')
|
||||
webcam.stop()
|
||||
});
|
||||
|
||||
function makeblob(dataURL) {
|
||||
var BASE64_MARKER = ';base64,';
|
||||
if (dataURL.indexOf(BASE64_MARKER) == -1) {
|
||||
var parts = dataURL.split(',');
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = decodeURIComponent(parts[1]);
|
||||
return new Blob([raw], { type: contentType });
|
||||
}
|
||||
var parts = dataURL.split(BASE64_MARKER);
|
||||
var contentType = parts[0].split(':')[1];
|
||||
var raw = window.atob(parts[1]);
|
||||
var rawLength = raw.length;
|
||||
|
||||
var uInt8Array = new Uint8Array(rawLength);
|
||||
|
||||
for (var i = 0; i < rawLength; ++i) {
|
||||
uInt8Array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
return new Blob([uInt8Array], { type: contentType });
|
||||
}
|
||||
|
||||
function loadWOrec(from, blob){
|
||||
$('#start_rec').attr("disabled", true);
|
||||
$('#save_picture').attr("disabled", true);
|
||||
$('#request_waiting').show();
|
||||
$('#progress_text').html('Загрузка снимков');
|
||||
var organ = 0
|
||||
if($('#btnradio_ear').is(":checked"))
|
||||
organ = 1
|
||||
if($('#btnradio_throat').is(":checked"))
|
||||
organ = 2
|
||||
if($('#btnradio_nose').is(":checked"))
|
||||
organ = 3
|
||||
|
||||
var fileList = document.getElementById('file_input').files;
|
||||
var formData = new FormData();
|
||||
var poll = null;
|
||||
var i = 0
|
||||
if (from == 'source')
|
||||
for(i=0;i<fileList.length;i++)
|
||||
{
|
||||
if (fileList[i].type.includes('image'))
|
||||
{
|
||||
formData.append("files", fileList[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (from == 'webcam')
|
||||
// $.each($('.endo_image'), function(e) {
|
||||
formData.append("files", makeblob(blob));
|
||||
i += 1;
|
||||
// });
|
||||
if (i > 0)
|
||||
{
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
data: formData,
|
||||
url: '/upload_images',
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
// $('#photos').empty();
|
||||
// $('#imgs_preview').empty();
|
||||
// $('#file_input').val(null);
|
||||
$('#pre_load').show();
|
||||
$('#file-input-greenspan').html('');
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
for(fnum in data['files'])
|
||||
$('#photos').append('<div class="col-3 my-2"><button type="button" aria-label="Close" class="btn-close remove-picture" style="background-color: #0d6efd; display: block; position: absolute; margin: 5px;"></button><img class="endo_image" data-type="saved" data-name=' + data['files'][fnum] + ' id="rrr" src="/img/'+data['files'][fnum]+'" style="width: 100%;"></div>')
|
||||
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
// after_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#start_rec').attr("disabled", false);
|
||||
$('#save_picture').attr("disabled", false);
|
||||
$('#request_waiting').hide();
|
||||
// after_error();
|
||||
}
|
||||
}
|
||||
|
||||
function take_picture(){
|
||||
let picture = webcam.snap();
|
||||
|
||||
// $('#download-photo').attr('src', picture);
|
||||
// $('#download').attr('href', picture);
|
||||
if($('#eleps').is(':checked'))
|
||||
loadWOrec('webcam', picture);
|
||||
else
|
||||
$('#photos').append('<div class="col-3 my-2"><button type="button" aria-label="Close" class="btn-close remove-picture" style="background-color: #0d6efd; display: block; position: absolute; margin: 5px;"></button><img class="endo_image" data-type="blob" id="rrr" src="'+picture+'" style="width: 100%;"></div>')
|
||||
$('.remove-picture').on('click', function(){
|
||||
$(this).parent().remove();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('.remove-picture').on('click', function(){
|
||||
$(this).parent.remove();
|
||||
})
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,137 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
lastVisits();
|
||||
|
||||
reload_visit_info();
|
||||
|
||||
function reload_visit_info(){
|
||||
if($('#visit_id').val()){
|
||||
lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/reload_visit_info/' + $('#visit_id').val() + '?task=off'+'&lang='+lang,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
//load__endo_history(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('#visits_link').click(function(){
|
||||
lastVisits();
|
||||
})
|
||||
|
||||
$('#recover_visit').click(function(){
|
||||
|
||||
visit_id = $('#visit_id').val()
|
||||
var message = {
|
||||
visit_id: visit_id,
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/ca_recover_visit',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#recover_visit').hide();
|
||||
$('#delete_visit').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Saving error')
|
||||
$('#exception').html('Ошибка, не удалось обновить информацию');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#delete_visit').click(function(){
|
||||
visit_id = $('#visit_id').val()
|
||||
var message = {
|
||||
visit_id: visit_id,
|
||||
}
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: '/ca_delete_visit',
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
if(data['success'] == true)
|
||||
{
|
||||
$('#recover_visit').show();
|
||||
$('#delete_visit').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Saving error')
|
||||
if(notify == true)
|
||||
{
|
||||
$('#exception').html('Ошибка, не удалось обновить информацию');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function lastVisits(){
|
||||
$('#last_visits').empty();
|
||||
var lang = getUrlParameter('lang');
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: '/last_visits/'+$('#patient_id').val()+'?lang=' + lang,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: (data) => {
|
||||
// console.log(data)
|
||||
for (visit_num in data['visits'])
|
||||
{
|
||||
visit = data['visits'][visit_num]
|
||||
if (data['full_name'])
|
||||
var full_name = data['full_name'];
|
||||
else
|
||||
var full_name = 'N/D';
|
||||
|
||||
if($('#language').val() == 'ru')
|
||||
$('#last_visits').append('<tr><td><a href="/medical_report/'+visit['id']+'?nn_diagnos=true">'+full_name+'</a></td><td>'+visit['date']+'</td><td>'+visit['clinic']+'</td><td>'+visit['doctor']+'</td><td>'+visit['profarea']+'</td></tr>');
|
||||
else
|
||||
$('#last_visits').append('<tr><td><a href="/medical_report/'+visit['id']+'?lang=en&nn_diagnos=true">'+full_name+'</a></td><td>'+visit['date']+'</td><td>'+visit['clinic']+'</td><td>'+visit['doctor']+'</td><td>'+visit['profarea']+'</td></tr>');
|
||||
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,168 @@
|
||||
$(document).ready(function() {
|
||||
$('#next').on('click', function() {
|
||||
false_form = false
|
||||
if (!($('#fio').val())) {
|
||||
$('#fio').css('border-color', '#f55');
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
if (!($('#telephone').val())) {
|
||||
$('#telephone').css('border-color', '#f55');
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
|
||||
if (!($('#email').val())) {
|
||||
$('#email').css('border-color', '#f55');
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
if (!($('#city').val())) {
|
||||
$('#city').css('border-color', '#f55');
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
|
||||
|
||||
if (false_form == false) {
|
||||
let data = {
|
||||
fio: $('#fio').val(),
|
||||
telephone: $('#telephone').val(),
|
||||
email: $('#email').val(),
|
||||
city: $('#city').val()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: JSON.stringify(data),
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
url: '/check_one_form',
|
||||
success: (data) => {
|
||||
if (data['email_uniqe'] && data['phone_uniqe']) {
|
||||
let one_form = document.getElementById('one_form')
|
||||
one_form.setAttribute('style', 'display: none')
|
||||
let tho_form = document.getElementById('tho_form')
|
||||
tho_form.setAttribute('style', 'display: block')
|
||||
tho_form.setAttribute('data-id_user', data['id_user'])
|
||||
tho_form.setAttribute('data-id_clinic', data['id_clinic'])
|
||||
tho_form.setAttribute('data-id_profarea', 0)
|
||||
} else {
|
||||
if (!data['email_uniqe']) {
|
||||
$('#email').css('border-color', '#f55');
|
||||
$('#email_row').children("p").remove();
|
||||
var smaul = $('<p class="col-12 text-danger">Пользователь с таким E-mail уже существует<p>').appendTo($('#email_row'));
|
||||
smaul.slideDown(500);
|
||||
}
|
||||
if (!data['phone_uniqe']) {
|
||||
$('#telephone').css('border-color', '#f55');
|
||||
$('#phone_row').children("p").remove();
|
||||
var smaul = $('<p class="col-12 text-danger">Пользователь с таким номером телефона уже существует<p>').appendTo($('#phone_row'));
|
||||
smaul.slideDown(500);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('#exception').html('Не все поля заполнены');
|
||||
$('#exception').slideDown(500);
|
||||
$('#exception').delay(2000).slideUp();
|
||||
}
|
||||
})
|
||||
$('.profarea').on('click', function() {
|
||||
let cards = document.getElementsByClassName('profarea')
|
||||
for (let i=0; i < cards.length; i++) {
|
||||
cards[i].setAttribute('style', 'background-color: none !important; color: black !important')
|
||||
//cards[ind].setAttribute('style', 'background-color: none !important; color: black !important')
|
||||
}
|
||||
$(this).attr('style', 'background-color: #6e3288 !important; color: #fff !important')
|
||||
let tho_form = document.getElementById('tho_form')
|
||||
tho_form.setAttribute('data-id_profarea', $(this).attr('data-area_id'))
|
||||
})
|
||||
|
||||
$('#registration').on('click', function() {
|
||||
let false_form = false
|
||||
if (!($('#login').val())) {
|
||||
$('#login').css('border-color', '#f55');
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
if (!($('#clinic').val())) {
|
||||
$('#clinic').css('border-color', '#f55');
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
|
||||
if ($('#tho_form').attr('data-id_profarea') == 0) {
|
||||
$('#profareas').attr('style', 'border-color: #f55 !important')
|
||||
false_form = true
|
||||
} else {
|
||||
false_form = false
|
||||
}
|
||||
|
||||
|
||||
if (false_form == false) {
|
||||
function makePassword(length) {
|
||||
var result = '';
|
||||
var characters_g = 'AEIOUYaeiouy';
|
||||
var characters_s = 'BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz';
|
||||
var characters_g_Length = characters_g.length;
|
||||
var characters_s_Length = characters_s.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (i % 2 == 0) {
|
||||
result += characters_g.charAt(Math.floor(Math.random() * characters_g_Length));
|
||||
} else {
|
||||
result += characters_s.charAt(Math.floor(Math.random() * characters_s_Length));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
let data = {
|
||||
id_user: $('#tho_form').attr('data-id_user'),
|
||||
id_clinic: $('#tho_form').attr('data-id_clinic'),
|
||||
id_profarea: $('#tho_form').attr('data-id_profarea'),
|
||||
login: $('#login').val(),
|
||||
clinic: $('#clinic').val(),
|
||||
password: makePassword(8)
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: JSON.stringify(data),
|
||||
async: !1,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
url: '/register_user_clinic',
|
||||
success: (data) => {
|
||||
if (data['clinic_uniqe']) {
|
||||
$('#success').html(data['message']);
|
||||
$('#success').slideDown(500);
|
||||
$('#success').delay(2000).slideUp();
|
||||
$('#final_email').text($('#final_email').text() + $('#email').val());
|
||||
$('#tho_form').hide();
|
||||
$('#final_form').show();
|
||||
} else {
|
||||
var smaul = $('<p class="col-12 text-danger">' + data['message'] + '<p>').appendTo($('#clinic_row'));
|
||||
smaul.slideDown(500);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('#exception2').html('Не все поля заполнены');
|
||||
$('#exception2').slideDown(500);
|
||||
$('#exception2').delay(2000).slideUp();
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user