**Это старая версия документа!**
Helix-v21-20230808_093929
Cистемные настройки
Для запуска необходимо включить переадресацию:
sudo a2enmod rewrite
sudo service apache2 restart
Заказчик должен настроить доменное имя для https соединения с пробросом на 443 порт сервера MGERM и предоставить сертификаты для настройки SSL Engine в Apache на сервере MGERM.
На сервере MGERM в настройках виртуальных хостов Apache должен быть файл helix.conf
<VirtualHost :81> ServerAdmin support@mgerm.ru DocumentRoot /var/www/mgerm25/externalservices <Directory /> Options +FollowSymLinks -Indexes AllowOverride None </Directory> <Directory /var/www/mgerm25/externalservices> Options +FollowSymLinks -Indexes AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHELOGDIR}/externalserviceserror.log LogLevel error CustomLog ${APACHELOGDIR}/externalservicesaccess.log combined </VirtualHost> <VirtualHost *:443> SSLEngine on SSLCertificateFile /etc/ssl/1med39.ru.crt SSLCertificateKeyFile /etc/ssl/private.key SSLCertificateChainFile /etc/ssl/GlobalSignca.crt ServerAdmin support@mgerm.ru DocumentRoot /var/www/mgerm25/externalservices <Directory /> Options +FollowSymLinks -Indexes AllowOverride None </Directory> <Directory /var/www/mgerm25/externalservices> Options -Indexes AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHELOGDIR}/externalserviceserror.log LogLevel error CustomLog ${APACHELOGDIR}/externalservices.log combined </VirtualHost>| В параметрах SSLCertificateFile указываем сертификат, выпущенный заказчиком, SSLCertificateKeyFile - соответствующий ключ, SSLCertificateChainFile - нужный сертификат. В папке conf проекта MGERM должен быть конфигурационный файл helix.ini. nano /var/www/mgerm25/conf/helix.ini вставляем: | clientId = clientSecret = redirectUri = url urlAuthorize = https://auth-mdo.helix.ru/connect/authorize urlAccessToken = https://auth-mdo.helix.ru/connect/token urlResourceOwnerDetails = https://auth-mdo.helix.ru/ scopes = mis catalogservice offlineaccess urlApi = https://mdo.helix.ru/ contractID = authorizeUri = url| В свойства redirectUri и authorizeUri ставим адрес с доменным именем + /_income/callback/oAuthRedirect.php, полученный от заказчика, например: https://mgerm.clinica-boli.ru/_income/callback/oAuthRedirect.php Указать clientId clientSecret и contractID, внеся данные для подключения от Хеликс. Внимание! В логине и пароле не должно быть скобок! Если они есть, нужно просить выдать их заново без скобок. Скобки вызывают ошибку чтения конфигурационного файла. При этом выводится сообщение: “Can't read /conf/helix.ini file properly!“ Так же в случае непонятной ошибки с подключением к API Хеликса необходимо убедиться, что файл _services\lib\Helpers\LeageReplace\AbstractProvider.php скопирован в ib\vendor\league\oauth2-client\src\Provider\ с замещением исходного файла. ===== Настройки cron ===== Необходимы для обновления контракта загрузки результатов: sudo crontab -e Вставляем: | 0 */12 * * * curl «http://localhost/_services/Laboratory/Helix/Invoice.loadContract?no_connection=1« 0 * * * * curl «http://localhost/_services/Laboratory/Helix/Invoice.getAndStoreResult?no_connection=1«| ====== Настройки MGERM ====== Добавляем системного пользователя и запись результата анализа. В системной переменной “Внешняя лаборатория“ ставим helix. | GRANTSELECT, INSERT, UPDATE ON medis\_logs . TO'expert'@'127.0.0.1';FLUSH PRIVILEGES; INSERTINTO medis_users .users (ind , created , login , **password** , GUID , class , department , last_name , first_name , second_name , spec , observe , works , vacation , director , reception_doctor , allow_fio_change , expert , parus_id , cat_nm , cat_dt , ct_spc , cmn , dmn , science_prefix , vacation_start , vacation_end , fot , deligate_expert , kmis_department , fot_refferal_premium , birthday , seniority_date , merit , photo , callOnly , siteComment , SNILS_45130 , observe_login , INN , showDoctorOnSite , cbn , dbn , site_periods_count_user , add_spec , default_show_initials_print_all_records_spec , cpn , dpn , power_of_attorney , allow_delete_templates , user_another_ids , mango_extension , spec_FRMR , only_personal_services ) VALUES (-11, '2012-03-06 07:44:10', 'laboratoryAgent', 'b98451dffec462fa47ba832ca641c2d6', 1, 2, 1, 'Импорт', 'Внешней', 'Лаборатории', -5, NULL, 1, 0, 1, 0, 1, 1, 0, , , , 0, 0, , NULL, NULL, 5.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0);INSERTINTO medis_interface .button_set (author_only , GUID , digested , always , ID , **order** , html_id , style , **Name** , script , **Action** , title , image , dead , lifespan , callback ) VALUES (0, NULL, 1, 0, 'helixpdf', 2, NULL, 'std40', 'Открыть PDF c показателями', 'butpresssi', '/services/Laboratory/LaboratoryRequest.getResult?template=/laboratory/helix/showTaskStatus.html&', 'Скачать PDF файл c результатами анализов', NULL, 0, NULL, NULL);UPDATE medis_interface .buttonset SET dead = 1 WHERE ID = 'procbiomaterials';INSERTINTO medis_interface .button_set (author_only , GUID , digested , always , ID , **order** , html_id , style , **Name** , script , **Action** , title , image , dead , lifespan , callback ) VALUES (0, NULL, 0, 0, 'procbiomaterials', 2, NULL, 'std40', 'Преаналитика и отправка', 'butpresssi', '/services/Laboratory/LaboratoryRequest.getSpecimenTypes?template=/laboratory/helix/chooseSpecimens.html&', 'Создание и отправка заказа', NULL, 0, NULL, NULL);INSERTINTO medis_interface .button_set (author_only , GUID , digested , always , ID , **order** , html_id , style , **Name** , script , **Action** , title , image , dead , lifespan , callback ) VALUES (0, NULL, 0, 0, 'procbiomaterials', 0, 'DEL', 'std40', 'Удалить', 'butpresssidel', 'edit', 'Удалить запись', NULL, 0, NULL, NULL);INSERTINTO medis_interface .button_set (author_only , GUID , digested , always , ID , **order** , html_id , style , **Name** , script , **Action** , title , image , dead , lifespan , callback ) VALUES (0, NULL, 0, 0, 'procbiomaterials', 0, NULL, 'std40', 'Изменить', 'butpresssi', '/kpo/calculator', 'Составить список услуг', NULL, 0, NULL, NULL);REPLACEINTO medis_interface .**references** (recordTypeID , **name** , dead , chapter , med_refferal , need_redirection , edit_GUID , **order** , order2 , interf_ref , d_table , num_list , signs , show_treatment , show_content , show_time , print_size_percentage , print_checker , status_buttons , buttonSetID , buttonSetID_inp , extend_record_class , record_method_in , record_method_out , TH_output_style , TD_output_style , Tbl_output_style , Tbl_input_style , TH_input_style , TD_input_style , button_line_style , status_line_style , button_line_style_inp , text_style , files_style , files_alias , files_script , show_in_summary , show_in_hystory , show_in_refferals , identifier , print_form , print_form_cap , common_view , use_autotemplate , multifier , specialist_visit , form14_operation_identifier , show_creation_date_in_caption , copy_content_from_previous_record_of_same_type , show_date , print_full_text_position , allow_record_date_change , PHR_notification , PHR_hide_record , print_record_date_from_field_date , summary_referecnce_order , print_template_php , auto_lock , advanced_protocols , dont_show_name_in_print_all_records , dont_show_name_in_print_record , show_contract_type_in_head , info , dont_print_treatment , first_hystory_record , minzdrav_code , show_count_in_report , show_time_in_info , force_patient_name_printing , ClinicalDocument/code , Порядок случаев госпитализации или обращения , Место оказания помощи , export_recordTypeGroup , show_in_analise_dynamic , dont_print_recomendations ) VALUES (201, 'Результаты анализа', 0, 80, 0, 0, NULL, 0, 0, 'default', 'default', 0, 0, 0, 1, 0, 0, 1, NULL, 'helixpdf', 'saveonly', 'classextentionrecord', 'showbodyfromphpscript', 'restorebodyshow', 'THoutputstd', 'TDoutputstd', 'Tbloutputstd', 'Tbloutputstd', 'THoutputstd', 'TRoutputinp', 'recordbuttonsrow', 'statusstyle', 'recordbuttonsrow', 'stdinfostyle', 'stdfilesstyle', NULL, '/fileoperationsdownload.php', 1, 1, 1, NULL, '-', NULL, NULL, 1, 1, 0, NULL, 1, 0, 1, 0, 0, 0, 0, 0, 0, '/services/Core/DatabaseRecord.getData?template=/laboratory/helix/results.html', 0, 0, 0, 0, 0, NULL, 0, 0, NULL, 0, 1, 0, NULL, NULL, NULL, NULL, 0, 0); REPLACEINTO medisinterface. **references** (recordTypeID , **name** , dead , chapter , med_refferal , need_redirection , edit_GUID , **order** , order2 , interf_ref , d_table , num_list , signs , show_treatment , show_content , show_time , print_size_percentage , print_checker , status_buttons , buttonSetID , buttonSetID_inp , extend_record_class , record_method_in , record_method_out , TH_output_style , TD_output_style , Tbl_output_style , Tbl_input_style , TH_input_style , TD_input_style , button_line_style , status_line_style , button_line_style_inp , text_style , files_style , files_alias , files_script , show_in_summary , show_in_hystory , show_in_refferals , identifier , print_form , print_form_cap , common_view , use_autotemplate , multifier , specialist_visit , form14_operation_identifier , show_creation_date_in_caption , copy_content_from_previous_record_of_same_type , show_date , print_full_text_position , allow_record_date_change , PHR_notification , PHR_hide_record , print_record_date_from_field_date , summary_referecnce_order , print_template_php , auto_lock , advanced_protocols , dont_show_name_in_print_all_records , dont_show_name_in_print_record , show_contract_type_in_head , info , dont_print_treatment , first_hystory_record , minzdrav_code , show_count_in_report , show_time_in_info , force_patient_name_printing , ClinicalDocument/code , Порядок случаев госпитализации или обращения , Место оказания помощи , export_recordTypeGroup , show_in_analise_dynamic , dont_print_recomendations ) VALUES (709, 'Заказ в Хеликс', 0, 80, 0, 0, NULL, NULL, NULL, 'default', 'default', 0, NULL, NULL, 1, 0, NULL, 1, 'procbiomaterialslock', 'procbiomaterials convertplan', 'saveonly', 'classextentionrecord', 'showbill', 'HidePayForHystoryZabor', 'THoutputstd', 'TDoutputstd', 'Tbloutputstd', 'Tbloutputstd', 'THoutputstd', 'TRoutputinp', 'recordbuttonsrow', 'statusstyle', 'recordbuttonsrow', 'stdinfostyle', 'stdfilesstyle', NULL, '/fileoperationsdownload.php', 0, 1, 1, NULL, NULL, NULL, 0, 1, 1, 0, NULL, 1, 0, 1, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, NULL, 0, 1, 0, NULL, NULL, NULL, NULL, 0, 0); UPDATE medisusers.systemglobals SET externallab = 'helix', allow_sister_create_bill_on_all_services = 1; |
В панели 1menufinance.html в секцию настройки добавляем ссылки:
<h3>Лаборатория Хеликс:</h3> <ul> <li><ahref=»/externalservices/income/callback/oAuthRedirect.php»target=«blank»>Подключиться к Helix</a></li> <li><ahref=»/_services/Laboratory/Helix/Invoice.loadContract?template=/laboratory/helix/loadContract.html»>Прогрузить контракт Helix</a></li> </ul> |
И жмем ссылку правой кнопкой мыши и выбираем “открыть в новой вкладке“:
Авторизуемся, используя данные от Хеликс: пользователь на Identity Server (Username, Password). После успешной авторизации на открывшемся экране ничего не меняем и жмем кнопку “Yes, allow“.
Загрузку контракта рекомендуется провести через консоль для проверки работы автоматической загрузки:
curl http://localhost/_services/Laboratory/Helix/Invoice.getAndStoreResult?no_connec
tion=1
Корректный ответ: {«status»:«success»}
Далее необходимо провести тестовый заказ, используя диапазон тестовых кодов, переданных Хеликсом и передать идентификатор заказа службе поддержки. Идентификатор можно узнать в базе данных в epm_records.jsonData, используя recordID заказа, например:
{«taskID»: «5ef19a56-a1c4-44cd-ac05-0362914c9a4e», «LaboratoryTests»: {«02-002»: 108183, «03-003»: 106007, «06-003»: 106019}} |
Копируем и отсылаем «taskID»: «5ef19a56-a1c4-44cd-ac05-0362914c9a4e».
Если cron работает и настроен согласно инструкции, в карте можно будет увидеть результат тестового анализа. Так же можно форсировать импорт в консоли:
curl «http://localhost/_services/Laboratory/Helix/Invoice.getAndStoreResult?no_connection=1»