first commit
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"type": "service_account",
|
||||
"project_id": "botforclinic-436512",
|
||||
"private_key_id": "0c117dd103a890d20705d9e66bbfde56f9d65a05",
|
||||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4XOtHBzxPR4lb\nqiX8grd2XBfBxXZLgLKTkz4WRcncgBpACXKms5AtKF707uKCvgUD8SwTpzvfY3oz\nvzLQs0uZoM9RALw5ui9dlimdoYQGsuH5LAUX68w0oPyour36XeBqacxNoEeO5C2F\nbb4+ql4gC2qJT86aBt2kwKpTxnTPZxvYoKZ0TwsmN8gj9vNckONbSSZteMKpQA50\nRqpoLM0EpsB64HRSiu8mH+bkdLK9ZMEZGmOG7pNDijctGkgAy9rK9vurH4PRgIMt\n7j+q/EeBQDuZX2SSVIaMkiFkDhHVGd84CFzcodBIYOSiCDer7aIcv8SrcYGZ0QJD\nnIzTqZMrAgMBAAECggEAW3HHR2dI3D/s2xkVl15U1nHOXM/vIXsX2EgH2y9JdUPb\nAVlOU24sPKHSG6YjltrejPqCNMtV0LM8SU90Sn0sKerP+esl8XIujTpusN+Mp2/x\n0tApRJiyJIaXW6+ojHck2VNZwUUXSUJXa9+npdiGMFnJQYtivBZcuJvRwBTnGnm/\ntuwQUcQREPy8IaaX5j+xPf390KeXqNOopULW7FtItkHthM18fr6706X1GQ77ua23\nzz1DT2PfIxOu2e3uPJ1O1CsQ8UiTIAm3J0nNgbpau1nP2+ea62vCrjmuqcyn5dfb\nhpgGD7Qe8uRvU+EICr67sOW47ikjAqkM38lZFgufuQKBgQDmypfFTYke7oDTZ8GE\nZFHZKn+ri5s94pDzjeeb8HxmeEC85cA6+jOr6f1QncwHON+tD2FRO7HHp/yVVyZY\nU2RSxaLaFleRL4CwlQkiMoqynLFWbqQthqdeJx2onNyGoO8uBDqfMJVBhOjwb8jI\n3SZt1Z6BJ076CMMOiLI7moZsWQKBgQDMgBdWND+uTR0SHXWqF1hj/+UgwHBqQKio\nyWbnIO28uFyMscfBAgh7JJbqcJIh6A+M9NdD4TveqZWoYBaUHkMBg5VGcmWrCH+L\nJOlAVJmhy4GgpE2nkYE0ZgDd0qlViYeTOKaLSKchPrLxRKNI9eeWkKqrk/a7wBHh\nsGJbt8p7IwKBgQCvFYaqAbZCpwFIX/ApNcn6DAmq5FAzVIxOmJrabEiTnCrQoyOA\nGovUocCwxeUgnX7i1UYo0DaAlupBiUnnu+vh91kiRczMsdLZI1c4gEtEUScfwPQA\nLaUPAnG3lrid0b1hlYe7eKnieKgWr1cNOuiKboK+zElX2gnQHtfH6+SKkQKBgDYW\nsxVz4FwDvWqrLBH+9rwMVNgizhjsXS+3hWYgiYDe6mu0IfdkyEV52gjMGXqqXGKV\n59HmYuVzyUetkos+rc5atULawxVHvCRbcO448iGfJ/wLORbXH2tyh0wkifE73QYN\nd89jOgFLCh1SYDXOBKEIRnv3OM1T8ebVtk44AHAtAoGAfOprlkWEDyVnfHQjGxxx\nTrxhEAjw3+ikM+wQJj7vumnpg91eAFNcwRUa/ykbVOmj6z/fBnStAbsG7mMQwa1M\nyIVPTvUogrsTHvf9GaG0IaAVJn/Su2DVNqQeL/ZpDmu2+wC959g8z665BKLzm3S8\nFc0eV1a7FN4GOpKNvXuDMBc=\n-----END PRIVATE KEY-----\n",
|
||||
"client_email": "clinic-chats-bot@botforclinic-436512.iam.gserviceaccount.com",
|
||||
"client_id": "105253150604049743778",
|
||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||
"token_uri": "https://oauth2.googleapis.com/token",
|
||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/clinic-chats-bot%40botforclinic-436512.iam.gserviceaccount.com",
|
||||
"universe_domain": "googleapis.com"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
[WEB_APP]
|
||||
PORT = 8084
|
||||
template_folder = C:\TgBotPage\webApp\templates
|
||||
environment = test
|
||||
[GOOGLE]
|
||||
type = service_account
|
||||
project_id = botforclinic-436512
|
||||
private_key_id = 0c117dd103a890d20705d9e66bbfde56f9d65a05
|
||||
private_key = -----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4XOtHBzxPR4lb\nqiX8grd2XBfBxXZLgLKTkz4WRcncgBpACXKms5AtKF707uKCvgUD8SwTpzvfY3oz\nvzLQs0uZoM9RALw5ui9dlimdoYQGsuH5LAUX68w0oPyour36XeBqacxNoEeO5C2F\nbb4+ql4gC2qJT86aBt2kwKpTxnTPZxvYoKZ0TwsmN8gj9vNckONbSSZteMKpQA50\nRqpoLM0EpsB64HRSiu8mH+bkdLK9ZMEZGmOG7pNDijctGkgAy9rK9vurH4PRgIMt\n7j+q/EeBQDuZX2SSVIaMkiFkDhHVGd84CFzcodBIYOSiCDer7aIcv8SrcYGZ0QJD\nnIzTqZMrAgMBAAECggEAW3HHR2dI3D/s2xkVl15U1nHOXM/vIXsX2EgH2y9JdUPb\nAVlOU24sPKHSG6YjltrejPqCNMtV0LM8SU90Sn0sKerP+esl8XIujTpusN+Mp2/x\n0tApRJiyJIaXW6+ojHck2VNZwUUXSUJXa9+npdiGMFnJQYtivBZcuJvRwBTnGnm/\ntuwQUcQREPy8IaaX5j+xPf390KeXqNOopULW7FtItkHthM18fr6706X1GQ77ua23\nzz1DT2PfIxOu2e3uPJ1O1CsQ8UiTIAm3J0nNgbpau1nP2+ea62vCrjmuqcyn5dfb\nhpgGD7Qe8uRvU+EICr67sOW47ikjAqkM38lZFgufuQKBgQDmypfFTYke7oDTZ8GE\nZFHZKn+ri5s94pDzjeeb8HxmeEC85cA6+jOr6f1QncwHON+tD2FRO7HHp/yVVyZY\nU2RSxaLaFleRL4CwlQkiMoqynLFWbqQthqdeJx2onNyGoO8uBDqfMJVBhOjwb8jI\n3SZt1Z6BJ076CMMOiLI7moZsWQKBgQDMgBdWND+uTR0SHXWqF1hj/+UgwHBqQKio\nyWbnIO28uFyMscfBAgh7JJbqcJIh6A+M9NdD4TveqZWoYBaUHkMBg5VGcmWrCH+L\nJOlAVJmhy4GgpE2nkYE0ZgDd0qlViYeTOKaLSKchPrLxRKNI9eeWkKqrk/a7wBHh\nsGJbt8p7IwKBgQCvFYaqAbZCpwFIX/ApNcn6DAmq5FAzVIxOmJrabEiTnCrQoyOA\nGovUocCwxeUgnX7i1UYo0DaAlupBiUnnu+vh91kiRczMsdLZI1c4gEtEUScfwPQA\nLaUPAnG3lrid0b1hlYe7eKnieKgWr1cNOuiKboK+zElX2gnQHtfH6+SKkQKBgDYW\nsxVz4FwDvWqrLBH+9rwMVNgizhjsXS+3hWYgiYDe6mu0IfdkyEV52gjMGXqqXGKV\n59HmYuVzyUetkos+rc5atULawxVHvCRbcO448iGfJ/wLORbXH2tyh0wkifE73QYN\nd89jOgFLCh1SYDXOBKEIRnv3OM1T8ebVtk44AHAtAoGAfOprlkWEDyVnfHQjGxxx\nTrxhEAjw3+ikM+wQJj7vumnpg91eAFNcwRUa/ykbVOmj6z/fBnStAbsG7mMQwa1M\nyIVPTvUogrsTHvf9GaG0IaAVJn/Su2DVNqQeL/ZpDmu2+wC959g8z665BKLzm3S8\nFc0eV1a7FN4GOpKNvXuDMBc=\n-----END PRIVATE KEY-----\n
|
||||
client_email = clinic-chats-bot@botforclinic-436512.iam.gserviceaccount.com
|
||||
client_id = 105253150604049743778
|
||||
auth_uri = https://accounts.google.com/o/oauth2/auth
|
||||
token_uri = https://oauth2.googleapis.com/token
|
||||
auth_provider_x509_cert_url = https://www.googleapis.com/oauth2/v1/certs
|
||||
client_x509_cert_url = https://www.googleapis.com/robot/v1/metadata/x509/clinic-chats-bot%40botforclinic-436512.iam.gserviceaccount.com
|
||||
universe_domain = googleapis.com
|
||||
@@ -0,0 +1,3 @@
|
||||
import configparser
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
Title TgBotUGN
|
||||
cd C:\TgBotPage
|
||||
CALL venv\Scripts\activate
|
||||
python web_run.py
|
||||
pause
|
||||
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from flask import Flask
|
||||
import logging
|
||||
from config import config
|
||||
import sys, os
|
||||
import sys, asyncio
|
||||
|
||||
|
||||
webApp = Flask(__name__, instance_relative_config=True, template_folder=config['WEB_APP']['template_folder'])
|
||||
|
||||
|
||||
__version__ = '1.0.1.0'
|
||||
|
||||
webApp.config['SECRET_KEY'] = '2qwtq2'
|
||||
webApp.config['INTERNAL_API_KEY'] = 'lGR9g09RW5cE07rKivRNIH9f'
|
||||
webApp.config['REMOTE_LOGIN_KEY'] = 'oRTiLTHeNTraZEsI'
|
||||
webApp.config['SESSION_COOKIE_SAMESITE'] = "None"
|
||||
webApp.config['SESSION_COOKIE_SECURE'] = True
|
||||
|
||||
webApp.jinja_env.add_extension('pypugjs.ext.jinja.PyPugJSExtension')
|
||||
|
||||
logging.basicConfig(level = logging.INFO)
|
||||
|
||||
from webApp.helper import jinjaHelper
|
||||
from webApp.interfaces import *
|
||||
@@ -0,0 +1,17 @@
|
||||
import config
|
||||
from webApp import webApp
|
||||
import random, string
|
||||
import datetime
|
||||
|
||||
DICT = {}
|
||||
|
||||
@webApp.context_processor
|
||||
def example():
|
||||
def randomString(stringLength=10):
|
||||
if config.config['WEB_APP']['environment'] == 'test':
|
||||
letters = string.ascii_lowercase
|
||||
return ''.join(random.choice(letters) for i in range(stringLength))
|
||||
else:
|
||||
return config.config['WEB_APP']['FRONTEND_VERSION']
|
||||
|
||||
return dict(randomString = randomString)
|
||||
@@ -0,0 +1,2 @@
|
||||
from webApp.interfaces.dependencies import *
|
||||
from webApp.interfaces.pagesController import *
|
||||
@@ -0,0 +1,16 @@
|
||||
from flask import send_from_directory, send_file, redirect, jsonify, make_response
|
||||
from webApp import webApp
|
||||
from config import config
|
||||
import os
|
||||
|
||||
@webApp.route('/css/<path:path>')
|
||||
def send_css(path):
|
||||
resp = make_response(send_from_directory(os.path.join(config['WEB_APP']['template_folder'], 'static/css'), path), 200)
|
||||
resp.headers['Cache-Control'] = 'public, max-age=31536000'
|
||||
return resp
|
||||
|
||||
@webApp.route('/js/<path:path>')
|
||||
def send_js(path):
|
||||
resp = make_response(send_from_directory(os.path.join(config['WEB_APP']['template_folder'], 'static/js'), path), 200)
|
||||
resp.headers['Cache-Control'] = 'public, max-age=31536000'
|
||||
return resp
|
||||
@@ -0,0 +1,54 @@
|
||||
from flask import abort, request, render_template, url_for, jsonify
|
||||
from webApp import *
|
||||
from webApp import webApp
|
||||
import gspread
|
||||
from oauth2client.service_account import ServiceAccountCredentials
|
||||
import json
|
||||
import datetime
|
||||
from config import config
|
||||
|
||||
# Авторизация Google API
|
||||
def authorize_google():
|
||||
# google_json = {}
|
||||
# for key in config["GOOGLE"].keys():
|
||||
# google_json[key] = config["GOOGLE"][key]
|
||||
scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
|
||||
creds = ServiceAccountCredentials.from_json_keyfile_name("botforclinic-436512-0c117dd103a8.json", scope)
|
||||
# creds = ServiceAccountCredentials.from_json_keyfile_dict(google_json, scope)
|
||||
client = gspread.authorize(creds)
|
||||
return client
|
||||
|
||||
|
||||
# Обработка формы
|
||||
@webApp.route('/form_submit', methods=['POST'])
|
||||
def form_submit():
|
||||
data = json.loads(request.data)
|
||||
# {'fio': '', 'tel': '', 'email': '', 'passport': '', 'passport_date': '', 'postal_code': '', 'address': '', 'snils': '', 'inn': '', 'dob': ''}
|
||||
data['current_time'] = datetime.datetime.now().strftime("%d.%m.%Y, %H:%M")
|
||||
print(data)
|
||||
|
||||
# Авторизация и добавление данных в Google Sheets
|
||||
sheet = authorize_google().open("Информация о сотрудниках").sheet1
|
||||
sheet.append_row([
|
||||
data['fio'],
|
||||
data['tel'],
|
||||
data['email'],
|
||||
data['passport'][:4],
|
||||
data['passport'][4:],
|
||||
data['passport_issued_by'],
|
||||
data['passport_date'],
|
||||
data['postal_code'],
|
||||
data['address'],
|
||||
data['snils'],
|
||||
data['inn'],
|
||||
data['dob'],
|
||||
data['user_id'], # Записываем Telegram ID пользователя
|
||||
data['current_time'] # Записываем время отправки данных
|
||||
])
|
||||
|
||||
return jsonify({'success':True})
|
||||
|
||||
|
||||
@webApp.route('/')
|
||||
def main_page_2_0():
|
||||
return render_template('2.0/main_page.pug', user_id=request.args.get('user_id', None))
|
||||
@@ -0,0 +1,22 @@
|
||||
doctype html
|
||||
html.custom-font(lang="ru", style="font-family: Montserrat;")
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1.0")
|
||||
meta(name="yandex-verification" content="e7a14bc685ede8b8")
|
||||
title="Клиника \"Ухо, Горло, Нос\""
|
||||
|
||||
|
||||
link(rel="stylesheet" href="/css/third_part/bootstrap.min.css?q="~randomString())
|
||||
script(type="text/javascript", src="/js/third_part/jquery-3.3.1.min.js")
|
||||
script(type="text/javascript", src="/js/third_part/popper.min.js")
|
||||
script(type="text/javascript", src="/js/third_part/bootstrap.bundle.min.js?q="~randomString())
|
||||
|
||||
script(type="text/javascript", src="/js/third_part/select2.min.js")
|
||||
link(rel="stylesheet" href="/css/third_part/select2.min.css")
|
||||
link(rel="stylesheet" href="/css/third_part/select2-bootstrap-5-theme.min.css")
|
||||
|
||||
link(rel="stylesheet" href="/css/third_part/fontawesome_all.css")
|
||||
|
||||
body
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
include 2.0/application
|
||||
|
||||
|
||||
link(rel="stylesheet" href="/css/1_model_app.css")
|
||||
link(rel="stylesheet" href="/css/1_model_icons.css")
|
||||
script(type="text/javascript", src="/js/2.0.dashboard.js?q="~randomString())
|
||||
|
||||
|
||||
|
||||
.enterblock.custom-font
|
||||
.row.mx-auto.h-100(style='max-width: 448px; vertical-align: middle;')
|
||||
.col-12.my-md-auto.p-0.card.shadow.rounded-3(style='min-height: 500px; height: auto;')
|
||||
.card-body.px-0.pb-0
|
||||
h5.mx-4.fw-bold="Заполните форму"
|
||||
input.tg_input#user_id(hidden, value=user_id)
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="fio")='ФИО'
|
||||
input.form-control.tg_input#fio
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="tel")='Телефон'
|
||||
input.form-control.tg_input#tel
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="email")='Электронная почта'
|
||||
input.form-control.tg_input#email
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="passport")='Серия и номер паспорта'
|
||||
input.form-control.tg_input#passport
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="passport_date")='Дата выдачи паспорта'
|
||||
input.form-control.tg_input#passport_date(type="date")
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="postal_code")='Кем выдан'
|
||||
input.form-control.tg_input#passport_issued_by
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="postal_code")='Код подразделения'
|
||||
input.form-control.tg_input#postal_code
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="address")='Место жительства'
|
||||
input.form-control.tg_input#address
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="snils")='СНИЛС'
|
||||
input.form-control.tg_input#snils
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="inn")='ИНН'
|
||||
input.form-control.tg_input#inn
|
||||
.my-3.mx-4
|
||||
label.form-label.m-0(for="dob")='Дата рождения'
|
||||
input.form-control.tg_input#dob(type="date")
|
||||
.my-3.mx-4
|
||||
button.btn.btn-success.float-end.mb-3#form_submit
|
||||
span.spinner-border.spinner-border-sm.me-1.d-none(role="status" aria-hidden="true")
|
||||
span="Подтвердить"
|
||||
@@ -0,0 +1,669 @@
|
||||
/*
|
||||
DEMO STYLE
|
||||
*/
|
||||
|
||||
@import "/css/fonts/montserrat.css";
|
||||
@import url("https://use.fontawesome.com/releases/v6.1.0/js/all.js");
|
||||
|
||||
html, body {
|
||||
font-family: 'Montserrat', serif;
|
||||
height: 100%;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
.enterblock {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
position: absolute;
|
||||
top: 0; left: 0; bottom: 0; right: 0;
|
||||
}
|
||||
|
||||
.custom-font{
|
||||
font-family: Montserrat, serif;
|
||||
}
|
||||
|
||||
.obst_place {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.obst_place:hover {
|
||||
cursor: pointer;
|
||||
background-color: #ebd0f7 !important;
|
||||
color: #6e3288 !important;
|
||||
}
|
||||
.template_list_visit {
|
||||
color: #999
|
||||
}
|
||||
.template_list_visit.active {
|
||||
color: #000
|
||||
}
|
||||
|
||||
.obst_place.active {
|
||||
background-color: #AF80C3 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.absolute-bottom{
|
||||
position: fixed;
|
||||
bottom: 3rem!important;
|
||||
right: 3rem!important;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
z-index: 999;
|
||||
background-color: rgba(255,255,255,0.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.box-ai {
|
||||
border-bottom: 1px solid #E8F0FE !important;
|
||||
border-right: 1px solid #E8F0FE !important;
|
||||
background-color: #eaf2ff6e;
|
||||
border-bottom-right-radius: 2rem !important;
|
||||
position: relative;
|
||||
top: -30px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.page-title{
|
||||
color: #6e3288;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
VERTICAL NAVBAR
|
||||
TODO: Добавить всем элементам класс-указатель, что они относятся к sidebar
|
||||
*/
|
||||
.cont{
|
||||
background-color: #fff;
|
||||
}
|
||||
#logout_btn{
|
||||
text-decoration: none;
|
||||
color: #6e3288;
|
||||
}
|
||||
@media (max-width: 992px) {
|
||||
#app_navigation .sidebar-toggler
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
.cont{
|
||||
margin-left: 0px !important;
|
||||
}
|
||||
.sidebar.navbar-brand {
|
||||
color: #6e3288 !important;
|
||||
background-color: white;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.sidebar.navbar {
|
||||
width: 100% !important;
|
||||
box-shadow: 0 .1rem .2rem rgba(0,0,0,.1)!important;
|
||||
}
|
||||
.sidebar.navbar-nav{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, auto);
|
||||
grid-gap: 10px;
|
||||
grid-auto-flow: row;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
.sidebar.nav-item
|
||||
{
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
display: flex;
|
||||
}
|
||||
.sidebar.nav-item-text{
|
||||
opacity: 100% !important;
|
||||
}
|
||||
.currentuser-span{
|
||||
opacity: 100% !important;
|
||||
}
|
||||
.navbar-brand{
|
||||
font-size: 1.25rem !important;
|
||||
padding-top: 0px !important;
|
||||
}
|
||||
.sidebar.nav-link
|
||||
{
|
||||
color: #AF80C3 !important;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.sidebar.nav-item.active .sidebar.nav-link
|
||||
{
|
||||
color: white !important;
|
||||
z-index: 2;
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
.sidebar.nav-item.active{
|
||||
background-color: #50398C;
|
||||
border-radius: 20px 20px 20px 20px;
|
||||
height: 70px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.cont{
|
||||
margin-left: 250px;
|
||||
}
|
||||
|
||||
.sidebar.navbar,
|
||||
.sidebar.navbar-collapse {
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
.sidebar.navbar-expand-lg .navbar-nav {
|
||||
flex-direction: column;
|
||||
}
|
||||
.sidebar.navbar-nav{
|
||||
flex-direction: column !important;
|
||||
text-align: end;
|
||||
align-items: flex-end;
|
||||
grid-template-columns: repeat(3, auto);
|
||||
grid-gap: 10px;
|
||||
grid-auto-flow: row;
|
||||
padding-left: 5px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
.sidebar.navbar {
|
||||
width: 250px;
|
||||
height: 100vh;
|
||||
min-height: 100%;
|
||||
align-items: flex-start;
|
||||
position: fixed !important;
|
||||
}
|
||||
.sidebar.navbar-brand {
|
||||
color: #6e3288 !important;
|
||||
font-weight: 500 !important;
|
||||
text-align: center;
|
||||
height: 70px;
|
||||
padding-top: 30px !important;
|
||||
background-color: white;
|
||||
width: 100%!important;
|
||||
}
|
||||
.sidebar.navbar-collapse{
|
||||
align-items: start !important;
|
||||
width: 100%;
|
||||
}
|
||||
.sidebar.nav-item
|
||||
{
|
||||
width: 80%;
|
||||
text-align: end;
|
||||
position: relative;
|
||||
display: flex;
|
||||
}
|
||||
.sidebar.nav-link
|
||||
{
|
||||
color: #AF80C3 !important;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.sidebar.nav-item.active .sidebar.nav-link
|
||||
{
|
||||
color: white !important;
|
||||
z-index: 2;
|
||||
margin-left: 30px;
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
.sidebar.nav-item.active{
|
||||
background-color: #50398C;
|
||||
border-radius: 20px 0 0 20px;
|
||||
height: 70px;
|
||||
}
|
||||
.sidebar.nav-item:not(.active):hover{
|
||||
font-weight: bold;
|
||||
color: #6e3288 !important;
|
||||
}
|
||||
.sidebar.nav-item:not(.active):hover .icon-item{
|
||||
color: #6e3288;
|
||||
}
|
||||
.sidebar.nav-item:not(.active):hover .sidebar.nav-link{
|
||||
color: #6e3288 !important;
|
||||
}
|
||||
.sidebar.nav-item-text{
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
.icon-item{
|
||||
color: #A83971;
|
||||
line-height: 40px;
|
||||
width: 50px;
|
||||
left: -25px;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
top: 0px;
|
||||
}
|
||||
.sidebar.nav-item.active.active .icon-item{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
background: #A83971;
|
||||
z-index: 2;
|
||||
top: 10px;
|
||||
left: -25px;
|
||||
position: absolute;
|
||||
border-radius: 15px 15px 0px 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #C6CB45;
|
||||
}
|
||||
.sidebar-toggler
|
||||
{
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
}
|
||||
/* #logout_btn{
|
||||
display: none;
|
||||
}*/
|
||||
}
|
||||
/*
|
||||
PAGE NAVIGATION
|
||||
*/
|
||||
|
||||
.p-link{
|
||||
color: black;
|
||||
font-weight: 500;
|
||||
}
|
||||
.p-link.active{
|
||||
color: #50398C;
|
||||
border-bottom: 3px solid #50398C;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PLUS DROPDOWN
|
||||
*/
|
||||
.plus-item{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
background: #866EC6;
|
||||
border-radius: 15px 15px 0px 15px;
|
||||
align-items: center;
|
||||
color: #FFF;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
.plus-item-dashboard {
|
||||
height: 37px;
|
||||
width: 37px;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
align-items: center;
|
||||
color: #6E3288;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
/* padding-left: 3px;
|
||||
padding-top: 3px; */
|
||||
}
|
||||
.plus-item-sm{
|
||||
height: 40px !important;
|
||||
width: 40px !important;
|
||||
border-radius: 10px 10px 0px 10px;
|
||||
}
|
||||
.plus-dropdown{
|
||||
background-color: rgba(255, 255, 255, .50) !important;
|
||||
backdrop-filter: blur(5px) !important;
|
||||
}
|
||||
|
||||
.plus-dd-item:hover{
|
||||
background-color: white !important;
|
||||
color: #6e3288 !important;
|
||||
font-weight: 500;
|
||||
}
|
||||
.plus-dd-item{
|
||||
color: #6e3288 !important;
|
||||
}
|
||||
|
||||
/*
|
||||
Notifications_menu
|
||||
*/
|
||||
.notifications-menu{
|
||||
display: flex;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
background: #C6CB45;
|
||||
border-radius: 15px 15px 15px 0px;
|
||||
align-items: center;
|
||||
color: #FFF;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/*
|
||||
GLASS MODAl
|
||||
*/
|
||||
/*
|
||||
.glass-modal .modal-dialog .modal-content{
|
||||
background-color: rgba(255, 255, 255, .5);
|
||||
backdrop-filter: blur(5px) !important;
|
||||
}
|
||||
.modal-backdrop {
|
||||
background-color: rgba(255, 255, 255, 0.15) !important;
|
||||
backdrop-filter: blur(5px) !important;
|
||||
opacity: 95% !important;
|
||||
}
|
||||
*/
|
||||
|
||||
.camera-item{
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
z-index: 1;
|
||||
left: 0px;
|
||||
height: 80px;
|
||||
|
||||
background-color: rgba(150, 150, 150, 0.15) !important;
|
||||
backdrop-filter: blur(5px) !important;
|
||||
|
||||
}
|
||||
|
||||
.camera-plus{
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
background: #fff;
|
||||
border: 2px solid #6E3288;
|
||||
border-radius: 30px 30px 30px 30px;
|
||||
left: calc(50% - 30px);
|
||||
position: relative;
|
||||
top: calc(40px - 30px);
|
||||
}
|
||||
|
||||
.preview_img{
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.control_card.hidden_info:hover{
|
||||
background-color: #daf;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.breadcrumb-select:focus{
|
||||
border-color: inherit !important;
|
||||
-webkit-box-shadow: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.breadcrumb-select{
|
||||
border: none !important;
|
||||
outline:0px !important;
|
||||
}
|
||||
|
||||
.user_row{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.overflow-auto::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.overflow-auto::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.overflow-auto::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background-color: #AF80C4;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.control_visits_overflow{
|
||||
height:90vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.control_visits_overflow{
|
||||
height:90vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.control_visits_overflow{
|
||||
height:85vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.control_visits_overflow{
|
||||
height:80vh;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 479px) {
|
||||
.control_visits_overflow{
|
||||
height:70vh;
|
||||
}
|
||||
}
|
||||
|
||||
.exams-check:checked {
|
||||
background-color: #198754 !important;
|
||||
border-color: #198754 !important;
|
||||
}
|
||||
.exams-check:disabled{
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.exams-check:disabled~.form-check-label, .exams-check[disabled]~.form-check-label {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.btn-arrow {
|
||||
background-color: #fff !important;
|
||||
color: #777 !important;
|
||||
}
|
||||
|
||||
.btn-arrow:hover {
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
.visit_diagnos:first-child {
|
||||
.row > .col-3 > .diag_up{
|
||||
pointer-events:none;
|
||||
color: #eee !important;
|
||||
}
|
||||
}
|
||||
|
||||
.visit_diagnos:last-child {
|
||||
.row > .col-3 > .diag_down{
|
||||
pointer-events:none;
|
||||
color: #eee !important;
|
||||
}
|
||||
}
|
||||
#conclusion_box{
|
||||
display:inline-block;
|
||||
position:relative;
|
||||
width: 100%;
|
||||
}
|
||||
#conclusion_buttons_box{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#conclusion_box:hover{
|
||||
#conclusion_buttons_box{
|
||||
display: block;
|
||||
position:absolute;
|
||||
top: 4px;
|
||||
left: 5px;
|
||||
}
|
||||
#conclusion_buttons_box > .btn-sm{
|
||||
padding: 0px 3px;
|
||||
}
|
||||
}
|
||||
|
||||
#conclusion_box:hover > textarea{
|
||||
padding-top: 28px;
|
||||
}
|
||||
|
||||
.btn-plus{
|
||||
box-sizing: content-box;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
padding: 0.25em 0.25em;
|
||||
color: #000;
|
||||
border: 0;
|
||||
border-radius: 0.25rem;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.tag-span{
|
||||
background: rgba(255,255,255, .6);
|
||||
}
|
||||
|
||||
.change_probe:hover{
|
||||
opacity: 50%;
|
||||
}
|
||||
|
||||
.form-control-sm{
|
||||
height: 29px;
|
||||
}
|
||||
|
||||
.visit-navs .active{
|
||||
border-bottom: 4px solid #6e3288 !important;
|
||||
color: #6e3288 !important;
|
||||
}
|
||||
|
||||
.visit-navs .nav-link{
|
||||
text-decoration: none;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Waiting spinner
|
||||
*/
|
||||
|
||||
.lds-ripple {
|
||||
/* change color here */
|
||||
color: #6e3288
|
||||
}
|
||||
.lds-ripple,
|
||||
.lds-ripple div {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.lds-ripple {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
.lds-ripple div {
|
||||
position: absolute;
|
||||
border: 4px solid currentColor;
|
||||
opacity: 1;
|
||||
border-radius: 50%;
|
||||
animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
|
||||
}
|
||||
.lds-ripple div:nth-child(2) {
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
@keyframes lds-ripple {
|
||||
0% {
|
||||
top: 36px;
|
||||
left: 36px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
opacity: 0;
|
||||
}
|
||||
4.9% {
|
||||
top: 36px;
|
||||
left: 36px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
opacity: 0;
|
||||
}
|
||||
5% {
|
||||
top: 36px;
|
||||
left: 36px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*Кнопки эндоскопа*/
|
||||
|
||||
.modern_button{
|
||||
position: relative;
|
||||
border-radius: 50%;
|
||||
outline: none;
|
||||
border: 0px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
backdrop-filter: blur(10.3px);
|
||||
-webkit-backdrop-filter: blur(10.3px);
|
||||
color: #fff;
|
||||
}
|
||||
.modern_button.modb_lg{
|
||||
width: 5em;
|
||||
height: 5em;
|
||||
}
|
||||
.modern_button.modb_md{
|
||||
width: 3em;
|
||||
height: 3em;
|
||||
}
|
||||
.modern_button.modb_lg span{
|
||||
font-size: 22px;
|
||||
}
|
||||
.modern_button.modb_md span{
|
||||
font-size: 16px;
|
||||
}
|
||||
.red.modern_button:hover{
|
||||
color: rgba(255, 0, 0, 1);
|
||||
}
|
||||
.red.modern_button.checked{
|
||||
background: rgba(255, 0, 0, 1);
|
||||
}
|
||||
.red.modern_button.checked:hover{
|
||||
color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
.green.modern_button:hover{
|
||||
color: rgba(0, 255, 0, 1);
|
||||
}
|
||||
.green.modern_button.checked{
|
||||
background: rgba(0, 255, 0, 1);
|
||||
}
|
||||
.green.modern_button.checked:hover{
|
||||
color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
.orange.modern_button:hover{
|
||||
color: rgba(255, 156, 0, 1);
|
||||
}
|
||||
.orange.modern_button.checked{
|
||||
background: rgba(255, 156, 0, 1);
|
||||
}
|
||||
.orange.modern_button.checked:hover{
|
||||
color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
.modern_button:disabled {
|
||||
background-color: dimgrey !important;
|
||||
color: linen !important;
|
||||
opacity: 1;
|
||||
}
|
||||
.modern-card{
|
||||
border-radius: inherit;
|
||||
box-shadow: 5px 5px 10px #141414, -5px -5px 10px #525252;
|
||||
}
|
||||
|
||||
/*HotKeys*/
|
||||
|
||||
.hotkey-card:focus{
|
||||
border: 1px solid blue !important;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@import url("https://use.fontawesome.com/releases/v6.1.0/js/all.js");
|
||||
|
||||
.server-icn::before {
|
||||
font-family: 'Font Awesome\ 5 Free';
|
||||
content: "\f233";
|
||||
font-weight: 900;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.m-off::before{
|
||||
margin: 0px !important;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Montserrat';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(/css/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Hw0aXpsog.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Montserrat';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(/css/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Hw9aXpsog.woff2) format('woff2');
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Montserrat';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(/css/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Hw2aXpsog.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Montserrat';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(/css/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Hw3aXpsog.woff2) format('woff2');
|
||||
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Montserrat';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(/css/fonts/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Hw5aXo.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
function show_error(message){
|
||||
$('#error_alert').slideDown(500);
|
||||
$('#error_alert').delay(2000).slideUp();
|
||||
if (message)
|
||||
$('#alert_error_text').text(message)
|
||||
}
|
||||
|
||||
function show_success(message){
|
||||
$('#success_alert').slideDown(500);
|
||||
$('#success_alert').delay(2000).slideUp();
|
||||
if (message)
|
||||
$('#alert_success_text').text(message)
|
||||
}
|
||||
|
||||
function validate_length(val, dest_len){
|
||||
if(val.length < dest_len){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('body').append('<div id="error_alert" class="alert alert-danger" role="alert" style="position: fixed; top: 50px; left: 10%; right: 10%; z-index: 9999; display: none;">Ошибка<br><small id="alert_error_text"></small></div>');
|
||||
$('body').append('<div id="success_alert" class="alert alert-success" role="alert" style="position: fixed; top: 50px; left: 10%; right: 10%; z-index: 9999; display: none;">Успех<br><small id="alert_success_text"></small></div>');
|
||||
$('#fio').on("input", function(){
|
||||
console.log($('#fio').val());
|
||||
});
|
||||
|
||||
$("#form_submit").click(function(){
|
||||
$(this).children(".spinner-border").removeClass('d-none');
|
||||
$(this).attr("disabled", true);
|
||||
message = {}
|
||||
|
||||
|
||||
if(!(validate_length($('#fio').val(), 3)))
|
||||
{
|
||||
show_error('Введите ФИО', false);
|
||||
$(this).children(".spinner-border").addClass('d-none');
|
||||
$(this).removeAttr("disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
$.each($('.tg_input'), function(e) {
|
||||
message[$(this).prop("id")] = $(this).val();
|
||||
});
|
||||
console.log(message);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/form_submit",
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
async: true,
|
||||
data: JSON.stringify(message),
|
||||
success: (data) => {
|
||||
$(this).children(".spinner-border").addClass('d-none');
|
||||
$(this).removeAttr("disabled");
|
||||
console.log(data);
|
||||
show_success("Данные сохранены!")
|
||||
},
|
||||
error:function (jqXHR, exception) {
|
||||
$(this).children(".spinner-border").addClass('d-none');
|
||||
$(this).removeAttr("disabled");
|
||||
show_error('Что-то пошло не так', false)
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
let defaults = {
|
||||
activeClass: 'active',
|
||||
fixed: true
|
||||
};
|
||||
|
||||
let container,
|
||||
target,
|
||||
activeClass,
|
||||
fixed,
|
||||
collection = [];
|
||||
|
||||
let init = function (params) {
|
||||
let options = $.extend({}, defaults, params);
|
||||
|
||||
container = this;
|
||||
target = options.target;
|
||||
activeClass = options.activeClass;
|
||||
fixed = options.fixed;
|
||||
|
||||
let hash = null, element = null;
|
||||
$.each(target, function () {
|
||||
(hash = this.href.split('#')[1]) !== undefined
|
||||
? (element = container.find(`[id="${hash}"]`)).length > 0 ? collection.push({
|
||||
link: $(this),
|
||||
element: element
|
||||
}) : null : null;
|
||||
});
|
||||
this.unbind('scroll', eventListener).bind('scroll', eventListener);
|
||||
return this;
|
||||
};
|
||||
|
||||
let eventListener = function () {
|
||||
let relativeOffsetTop = collection.length > 0 ? collection[0].element.offset().top + container.scrollTop() : 0;
|
||||
$.each(collection, function () {
|
||||
let _ot = Math.floor(this.element.offset().top + container.scrollTop() - relativeOffsetTop);
|
||||
let _st = Math.ceil(container.scrollTop());
|
||||
if (_ot <= _st && _st < _ot + Math.floor(this.element.outerHeight())) {
|
||||
if (!this.link.hasClass(activeClass)) {
|
||||
target.removeClass(activeClass);
|
||||
this.link.addClass(activeClass);
|
||||
}
|
||||
return false;
|
||||
} else if (fixed) {
|
||||
this.link.removeClass('active');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.scrollSpy = function (options) {
|
||||
if (typeof options === 'object' && typeof options.target != "undefined") {
|
||||
return init.apply(this, arguments);
|
||||
} else {
|
||||
$.error('You should use plugin with required options...');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
!function(t){"use strict";let e,l,i,s,n={activeClass:"active",fixed:!0},o=[],r=function(){let n=o.length>0?o[0].element.offset().top+e.scrollTop():0;t.each(o,function(){let t=Math.floor(this.element.offset().top+e.scrollTop()-n),o=Math.ceil(e.scrollTop());if(t<=o&&o<t+Math.floor(this.element.outerHeight()))return this.link.hasClass(i)||(l.removeClass(i),this.link.addClass(i)),!1;s&&this.link.removeClass("active")})};t.fn.scrollSpy=function(h){if("object"==typeof h&&void 0!==h.target)return function(h){let c=t.extend({},n,h);e=this,l=c.target,i=c.activeClass,s=c.fixed;let u=null,a=null;return t.each(l,function(){void 0!==(u=this.href.split("#")[1])&&(a=e.find(`[id="${u}"]`)).length>0&&o.push({link:t(this),element:a})}),this.unbind("scroll",r).bind("scroll",r),this}.apply(this,arguments);t.error("You should use plugin with required options...")}}(jQuery);
|
||||
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* Extend jquery with a scrollspy plugin.
|
||||
* This watches the window scroll and fires events when elements are scrolled into viewport.
|
||||
*
|
||||
* throttle() and getTime() taken from Underscore.js
|
||||
* https://github.com/jashkenas/underscore
|
||||
*
|
||||
* @author Copyright 2013 John Smart
|
||||
* @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
|
||||
* @see https://github.com/thesmart
|
||||
* @version 0.1.2
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
var jWindow = $(window);
|
||||
var elements = [];
|
||||
var elementsInView = [];
|
||||
var isSpying = false;
|
||||
var ticks = 0;
|
||||
var offset = {
|
||||
top : 0,
|
||||
right : 0,
|
||||
bottom : 0,
|
||||
left : 0,
|
||||
}
|
||||
|
||||
/**
|
||||
* Find elements that are within the boundary
|
||||
* @param {number} top
|
||||
* @param {number} right
|
||||
* @param {number} bottom
|
||||
* @param {number} left
|
||||
* @return {jQuery} A collection of elements
|
||||
*/
|
||||
function findElements(top, right, bottom, left) {
|
||||
var hits = $();
|
||||
$.each(elements, function(i, element) {
|
||||
var elTop = element.offset().top,
|
||||
elLeft = element.offset().left,
|
||||
elRight = elLeft + element.width(),
|
||||
elBottom = elTop + element.height();
|
||||
|
||||
var isIntersect = !(elLeft > right ||
|
||||
elRight < left ||
|
||||
elTop > bottom ||
|
||||
elBottom < top);
|
||||
|
||||
if (isIntersect) {
|
||||
hits.push(element);
|
||||
}
|
||||
});
|
||||
|
||||
return hits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user scrolls the window
|
||||
*/
|
||||
function onScroll() {
|
||||
// unique tick id
|
||||
++ticks;
|
||||
|
||||
// viewport rectangle
|
||||
var top = jWindow.scrollTop(),
|
||||
left = jWindow.scrollLeft(),
|
||||
right = left + jWindow.width(),
|
||||
bottom = top + jWindow.height();
|
||||
|
||||
// determine which elements are in view
|
||||
var intersections = findElements(top+offset.top, right+offset.right, bottom+offset.bottom, left+offset.left);
|
||||
$.each(intersections, function(i, element) {
|
||||
var lastTick = element.data('scrollSpy:ticks');
|
||||
if (typeof lastTick != 'number') {
|
||||
// entered into view
|
||||
element.triggerHandler('scrollSpy:enter');
|
||||
}
|
||||
|
||||
// update tick id
|
||||
element.data('scrollSpy:ticks', ticks);
|
||||
});
|
||||
|
||||
// determine which elements are no longer in view
|
||||
$.each(elementsInView, function(i, element) {
|
||||
var lastTick = element.data('scrollSpy:ticks');
|
||||
if (typeof lastTick == 'number' && lastTick !== ticks) {
|
||||
// exited from view
|
||||
element.triggerHandler('scrollSpy:exit');
|
||||
element.data('scrollSpy:ticks', null);
|
||||
}
|
||||
});
|
||||
|
||||
// remember elements in view for next tick
|
||||
elementsInView = intersections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when window is resized
|
||||
*/
|
||||
function onWinSize() {
|
||||
jWindow.trigger('scrollSpy:winSize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get time in ms
|
||||
* @license https://raw.github.com/jashkenas/underscore/master/LICENSE
|
||||
* @type {function}
|
||||
* @return {number}
|
||||
*/
|
||||
var getTime = (Date.now || function () {
|
||||
return new Date().getTime();
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a function, that, when invoked, will only be triggered at most once
|
||||
* during a given window of time. Normally, the throttled function will run
|
||||
* as much as it can, without ever going more than once per `wait` duration;
|
||||
* but if you'd like to disable the execution on the leading edge, pass
|
||||
* `{leading: false}`. To disable execution on the trailing edge, ditto.
|
||||
* @license https://raw.github.com/jashkenas/underscore/master/LICENSE
|
||||
* @param {function} func
|
||||
* @param {number} wait
|
||||
* @param {Object=} options
|
||||
* @returns {Function}
|
||||
*/
|
||||
function throttle(func, wait, options) {
|
||||
var context, args, result;
|
||||
var timeout = null;
|
||||
var previous = 0;
|
||||
options || (options = {});
|
||||
var later = function () {
|
||||
previous = options.leading === false ? 0 : getTime();
|
||||
timeout = null;
|
||||
result = func.apply(context, args);
|
||||
context = args = null;
|
||||
};
|
||||
return function () {
|
||||
var now = getTime();
|
||||
if (!previous && options.leading === false) previous = now;
|
||||
var remaining = wait - (now - previous);
|
||||
context = this;
|
||||
args = arguments;
|
||||
if (remaining <= 0) {
|
||||
clearTimeout(timeout);
|
||||
timeout = null;
|
||||
previous = now;
|
||||
result = func.apply(context, args);
|
||||
context = args = null;
|
||||
} else if (!timeout && options.trailing !== false) {
|
||||
timeout = setTimeout(later, remaining);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables ScrollSpy using a selector
|
||||
* @param {jQuery|string} selector The elements collection, or a selector
|
||||
* @param {Object=} options Optional.
|
||||
throttle : number -> scrollspy throttling. Default: 100 ms
|
||||
offsetTop : number -> offset from top. Default: 0
|
||||
offsetRight : number -> offset from right. Default: 0
|
||||
offsetBottom : number -> offset from bottom. Default: 0
|
||||
offsetLeft : number -> offset from left. Default: 0
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
$.scrollSpy = function(selector, options) {
|
||||
selector = $(selector);
|
||||
selector.each(function(i, element) {
|
||||
elements.push($(element));
|
||||
});
|
||||
options = options || {
|
||||
throttle: 100
|
||||
};
|
||||
|
||||
offset.top = options.offsetTop || 0;
|
||||
offset.right = options.offsetRight || 0;
|
||||
offset.bottom = options.offsetBottom || 0;
|
||||
offset.left = options.offsetLeft || 0;
|
||||
|
||||
var throttledScroll = throttle(onScroll, options.throttle || 100);
|
||||
var readyScroll = function(){
|
||||
$(document).ready(throttledScroll);
|
||||
};
|
||||
|
||||
if (!isSpying) {
|
||||
jWindow.on('scroll', readyScroll);
|
||||
jWindow.on('resize', readyScroll);
|
||||
isSpying = true;
|
||||
}
|
||||
|
||||
// perform a scan once, after current execution context, and after dom is ready
|
||||
setTimeout(readyScroll, 0);
|
||||
|
||||
return selector;
|
||||
};
|
||||
|
||||
/**
|
||||
* Listen for window resize events
|
||||
* @param {Object=} options Optional. Set { throttle: number } to change throttling. Default: 100 ms
|
||||
* @returns {jQuery} $(window)
|
||||
*/
|
||||
$.winSizeSpy = function(options) {
|
||||
$.winSizeSpy = function() { return jWindow; }; // lock from multiple calls
|
||||
options = options || {
|
||||
throttle: 100
|
||||
};
|
||||
return jWindow.on('resize', throttle(onWinSize, options.throttle || 100));
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables ScrollSpy on a collection of elements
|
||||
* e.g. $('.scrollSpy').scrollSpy()
|
||||
* @param {Object=} options Optional.
|
||||
throttle : number -> scrollspy throttling. Default: 100 ms
|
||||
offsetTop : number -> offset from top. Default: 0
|
||||
offsetRight : number -> offset from right. Default: 0
|
||||
offsetBottom : number -> offset from bottom. Default: 0
|
||||
offsetLeft : number -> offset from left. Default: 0
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
$.fn.scrollSpy = function(options) {
|
||||
return $.scrollSpy($(this), options);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,382 @@
|
||||
var Tour = (function() {
|
||||
var t = [],
|
||||
o, cur
|
||||
T = {
|
||||
step: {
|
||||
pl: "krok",
|
||||
en: "step",
|
||||
be: "крок",
|
||||
ca: "pas",
|
||||
cs: "krok",
|
||||
da: "trin",
|
||||
de: "Schritt",
|
||||
el: "βήμα",
|
||||
es: "paso",
|
||||
et: "samm",
|
||||
fi: "vaihe",
|
||||
fr: "étape",
|
||||
hu: "lépés",
|
||||
it: "passo",
|
||||
lt: "žingsnis",
|
||||
lv: "solis",
|
||||
mk: "чекор",
|
||||
nl: "stap",
|
||||
no: "trinn",
|
||||
pt: "passo",
|
||||
ru: "шаг",
|
||||
sk: "krok",
|
||||
sl: "korak",
|
||||
sq: "hapi",
|
||||
sv: "steg",
|
||||
tr: "adım",
|
||||
uk: "крок"
|
||||
},
|
||||
Next: {
|
||||
pl: "Następny",
|
||||
en: "Next",
|
||||
be: "Далей",
|
||||
ca: "Següent",
|
||||
cs: "Další",
|
||||
da: "Næste",
|
||||
de: "Weiter",
|
||||
el: "Την επόμενη",
|
||||
es: "Siguiente",
|
||||
et: "Järgmine",
|
||||
fi: "Seuraava",
|
||||
fr: "Prochaine",
|
||||
hu: "Következő",
|
||||
it: "Accanto",
|
||||
lt: "Kitas",
|
||||
lv: "Nākamā",
|
||||
mk: "Следна",
|
||||
nl: "Volgende",
|
||||
no: "Neste",
|
||||
pt: "Próximo",
|
||||
ru: "Далее",
|
||||
sk: "Ďalej",
|
||||
sl: "Naprej",
|
||||
sq: "Tjetër",
|
||||
sv: "Nästa",
|
||||
tr: "Gelecek",
|
||||
uk: "Далі"
|
||||
},
|
||||
Previous: {
|
||||
pl: "Poprzedni",
|
||||
en: "Previous",
|
||||
be: "Папярэдні",
|
||||
ca: "Anteriors",
|
||||
cs: "Předchozí",
|
||||
da: "Tidligere",
|
||||
de: "Vorherige",
|
||||
el: "Προηγούμενο",
|
||||
es: "Anterior",
|
||||
et: "Eelmine",
|
||||
fi: "Edellinen",
|
||||
fr: "Précédente",
|
||||
hu: "Előző",
|
||||
it: "Precedente",
|
||||
lt: "Ankstesnis",
|
||||
lv: "Iepriekšējā",
|
||||
mk: "Претходна",
|
||||
nl: "Vorige",
|
||||
no: "Tidligere",
|
||||
pt: "Anterior",
|
||||
ru: "Предыдущий",
|
||||
sk: "Predchádzajúce",
|
||||
sl: "Prejšnji",
|
||||
sq: "E mëparshme",
|
||||
sv: "Föregående",
|
||||
tr: "Önceki",
|
||||
uk: "Попередній"
|
||||
},
|
||||
Finish: {
|
||||
pl: "Zakończ",
|
||||
en: "Finish",
|
||||
be: "Аздабленне",
|
||||
ca: "Acabat",
|
||||
cs: "Dokončit",
|
||||
da: "Finish",
|
||||
de: "Finish",
|
||||
el: "Τελειώνει",
|
||||
es: "Acabado",
|
||||
et: "Lõpeta",
|
||||
fi: "Loppuun",
|
||||
fr: "Finition",
|
||||
hu: "Befejezés",
|
||||
it: "Finitura",
|
||||
lt: "Apdaila",
|
||||
lv: "Apdare",
|
||||
mk: "Заврши",
|
||||
nl: "Afwerking",
|
||||
no: "Ferdig",
|
||||
pt: "Acabamento",
|
||||
ru: "Отделка",
|
||||
sk: "Povrch",
|
||||
sl: "Zaključek",
|
||||
sq: "Finish",
|
||||
sv: "Avsluta",
|
||||
tr: "Bitir",
|
||||
uk: "Оздоблення"
|
||||
}
|
||||
};
|
||||
|
||||
function _t(s) {
|
||||
return T[s][t[cur].language] || T[s]['en'];
|
||||
}
|
||||
|
||||
function step(n) {
|
||||
|
||||
cur = n;
|
||||
$('.tourStep, .tourBg').remove();
|
||||
|
||||
if (!t[n]) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('body').append([
|
||||
'<div class="tourStep popover" step="' + n + '">',
|
||||
'<div class="arrow"></div>',
|
||||
'<div class="card">',
|
||||
'<div class="card-header">',
|
||||
!t[n].close ? '' : '<button class="tourClose btn-close float-end">× </button>',
|
||||
'</div>',
|
||||
'<div class="card-body">',
|
||||
t[n].content,
|
||||
'</div>',
|
||||
'<div class="card-footer">',
|
||||
'<div class="pull-right">',
|
||||
'<div class="tourPrev btn btn-default btn-sm">' + _t('Previous') + '</div> ',
|
||||
'<div class="tourNext btn btn-primary btn-sm">' + _t('Next') + '</div>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
|
||||
var el = $('.tourStep')
|
||||
.addClass(t[n].position)
|
||||
.css({
|
||||
minWidth: 250
|
||||
}),
|
||||
x = 0,
|
||||
y = 0;
|
||||
|
||||
if (t[n].element && !!t[n].element.length) {
|
||||
var x1 = 1e6,
|
||||
y1 = 1e6,
|
||||
x2 = 0,
|
||||
y2 = 0;
|
||||
|
||||
t[n].element.each(function(k, v) {
|
||||
var ofs = $(v).offset();
|
||||
x1 = Math.min(x1, ofs.left + t[n].forceCorrectionLeft);
|
||||
y1 = Math.min(y1, ofs.top + t[n].forceCorrectionTop);
|
||||
|
||||
x2 = Math.max(x2, ofs.left + t[n].forceCorrectionLeft + t[n].forceCorrectionWidth
|
||||
+ parseInt($(v).css('border-left-width'))
|
||||
+ parseInt($(v).css('padding-left'))
|
||||
+ $(v).width()
|
||||
+ parseInt($(v).css('padding-right'))
|
||||
+ parseInt($(v).css('border-right-width'))
|
||||
);
|
||||
|
||||
y2 = Math.max(y2, ofs.top + t[n].forceCorrectionTop + t[n].forceCorrectionHeight
|
||||
+ parseInt($(v).css('border-top-width'))
|
||||
+ parseInt($(v).css('padding-top'))
|
||||
+ $(v).height()
|
||||
+ parseInt($(v).css('padding-bottom'))
|
||||
+ parseInt($(v).css('border-bottom-width'))
|
||||
);
|
||||
});
|
||||
|
||||
switch (t[n].position) {
|
||||
case 'top':
|
||||
y = y1 - el.height();
|
||||
x = ((x1 + x2) >> 1) - (el.width() >> 1);
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
y = ((y1 + y2) >> 1) - (el.height()>> 1);
|
||||
x = x2;
|
||||
break;
|
||||
|
||||
case 'left':
|
||||
y = ((y1 + y2) >> 1) - (el.height()>> 1);
|
||||
x = x1 - el.width();
|
||||
break;
|
||||
|
||||
case 'bottom':
|
||||
y = y2;
|
||||
x = ((x1 + x2) >> 1) - (el.width() >> 1);
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
el
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: x,
|
||||
top: y
|
||||
})
|
||||
.show();
|
||||
|
||||
if (t[n].spotlight) {
|
||||
var p = t[n].padding;
|
||||
$('body').append(Array(5).join('<div class="tourBg"></div>'));
|
||||
|
||||
var pos = [
|
||||
{
|
||||
bottom: 'auto',
|
||||
height: y1 - p
|
||||
},
|
||||
{
|
||||
top: y2 + p,
|
||||
height: $(document).height() - y2 - p
|
||||
},
|
||||
{
|
||||
right: 'auto',
|
||||
bottom: 'auto',
|
||||
top: y1 - p,
|
||||
width: x1 - p,
|
||||
height: 2 * p + y2 - y1
|
||||
},
|
||||
{
|
||||
left: x2 + p,
|
||||
bottom: 'auto',
|
||||
top: y1 - p,
|
||||
height: 2 * p + y2 - y1
|
||||
}
|
||||
];
|
||||
|
||||
$('.tourBg')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
zIndex: 1000,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
left: 0,
|
||||
background: '#000',
|
||||
opacity: 0.3
|
||||
}).each(function(k, v){
|
||||
$(v).css(pos[k]);
|
||||
});
|
||||
}
|
||||
|
||||
if (!!t[n].scroll) {
|
||||
var my = ((Math.min(y, y1) + Math.max(y + el.height(), y2)) >> 1) - ($(window).height() >> 1),
|
||||
mx = ((Math.min(x, x1) + Math.max(x + el.width(), x2)) >> 1) - ($(window).width() >> 1);
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: Math.max(0, Math.min(y, y1, my)),
|
||||
scrollLeft: Math.max(0, Math.min(x, x1, mx))
|
||||
});
|
||||
}
|
||||
|
||||
if (!n) {
|
||||
$('.tourPrev').remove();
|
||||
}
|
||||
|
||||
if (n > t.length - 2) {
|
||||
$('.tourNext').text(_t('Finish'));
|
||||
}
|
||||
|
||||
$('.tourStep')
|
||||
.on('click', '.tourNext:not([disabled])', Tour.next)
|
||||
.on('click', '.tourPrev:not([disabled])', Tour.prev)
|
||||
.on('click', '.tourClose:not([disabled])', Tour.close);
|
||||
|
||||
(t[n].onstep || Tour.onstep || function(){})(t[n]);
|
||||
}
|
||||
|
||||
$(window).on('resize', function() {
|
||||
if (!!Tour.onresize) {
|
||||
Tour.onresize();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
run: function(tour, options) {
|
||||
try {
|
||||
t = [];
|
||||
cur = 0;
|
||||
|
||||
o = {
|
||||
close: true,
|
||||
content: '',
|
||||
language: 'en',
|
||||
padding: 5,
|
||||
position: 'right',
|
||||
scroll: true,
|
||||
spotlight: true,
|
||||
forceCorrectionLeft: 0,
|
||||
forceCorrectionTop: 0,
|
||||
forceCorrectionWidth: 0,
|
||||
forceCorrectionHeight: 0,
|
||||
onstep: null,
|
||||
};
|
||||
|
||||
for (var k in options) {
|
||||
o[k] = options[k];
|
||||
}
|
||||
|
||||
$(tour).each(function(k, v) {
|
||||
for (var kk in o) {
|
||||
v[kk] = v[kk] || o[kk];
|
||||
};
|
||||
|
||||
if (v.element && !!v.element.length) {
|
||||
t.push(v);
|
||||
}
|
||||
});
|
||||
|
||||
step(cur);
|
||||
|
||||
if (!!Tour.onstart) {
|
||||
Tour.onstart();
|
||||
}
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
next: function() {
|
||||
step(cur + 1);
|
||||
|
||||
if (cur == t.length) {
|
||||
if (!!Tour.onfinish) {
|
||||
Tour.onfinish();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
prev: function(){
|
||||
step(cur - 1);
|
||||
},
|
||||
|
||||
current: function(){
|
||||
return cur;
|
||||
},
|
||||
|
||||
close: function(){
|
||||
step(-1);
|
||||
|
||||
if (!!Tour.onclose) {
|
||||
Tour.onclose();
|
||||
}
|
||||
},
|
||||
|
||||
onstart: null,
|
||||
onfinish: null,
|
||||
onclose: null,
|
||||
onstep: null,
|
||||
|
||||
onresize: function() {
|
||||
var n = cur - 1;
|
||||
step(-1);
|
||||
cur = n;
|
||||
|
||||
setTimeout(function() {
|
||||
Tour.next();
|
||||
}, 20);
|
||||
}
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,73 @@
|
||||
console.log('zoomrotate: Start');
|
||||
|
||||
(function(){
|
||||
var defaults, extend;
|
||||
console.log('zoomrotate: Init defaults');
|
||||
defaults = {
|
||||
zoom: 1,
|
||||
rotate: 0,
|
||||
debug: true
|
||||
};
|
||||
extend = function() {
|
||||
var args, target, i, object, property;
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
target = args.shift() || {};
|
||||
for (i in args) {
|
||||
object = args[i];
|
||||
for (property in object) {
|
||||
if (object.hasOwnProperty(property)) {
|
||||
if (typeof object[property] === 'object') {
|
||||
target[property] = extend(target[property], object[property]);
|
||||
} else {
|
||||
target[property] = object[property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
/**
|
||||
* register the zoomrotate plugin
|
||||
*/
|
||||
videojs.plugin('zoomrotate', function(settings){
|
||||
if (defaults.debug) console.log('zoomrotate: Register init');
|
||||
|
||||
var options, player, video, poster;
|
||||
options = extend(defaults, settings);
|
||||
|
||||
/* Grab the necessary DOM elements */
|
||||
player = this.el();
|
||||
video = this.el().getElementsByTagName('video')[0];
|
||||
poster = this.el().getElementsByTagName('div')[1]; // div vjs-poster
|
||||
|
||||
if (options.debug) console.log('zoomrotate: '+video.style);
|
||||
if (options.debug) console.log('zoomrotate: '+poster.style);
|
||||
if (options.debug) console.log('zoomrotate: '+options.rotate);
|
||||
if (options.debug) console.log('zoomrotate: '+options.zoom);
|
||||
|
||||
/* Array of possible browser specific settings for transformation */
|
||||
var properties = ['transform', 'WebkitTransform', 'MozTransform',
|
||||
'msTransform', 'OTransform'],
|
||||
prop = properties[0];
|
||||
|
||||
/* Iterators */
|
||||
var i,j;
|
||||
|
||||
/* Find out which CSS transform the browser supports */
|
||||
for(i=0,j=properties.length;i<j;i++){
|
||||
if(typeof player.style[properties[i]] !== 'undefined'){
|
||||
prop = properties[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Let's do it */
|
||||
player.style.overflow = 'hidden';
|
||||
video.style[prop]='scale('+options.zoom+') rotate('+options.rotate+'deg)';
|
||||
poster.style[prop]='scale('+options.zoom+') rotate('+options.rotate+'deg)';
|
||||
if (options.debug) console.log('zoomrotate: Register end');
|
||||
});
|
||||
})();
|
||||
|
||||
console.log('zoomrotate: End');
|
||||
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||