O extrator HAT_SETUP.jar não é preparado para ser executado em ambientes Linux sem interface gráfica, mas é possível utiliza-lo através de linha de comando.
O arquivo será disponibilizado pela equipe do TOTVS Saúde Portal Autorizador.
Para isso aqui está o passo a passo de como realizar a configuração.
IMPORTANTE: TODOS OS COMANDOS DEVE SER EXECUTADOS COM UM USUÁRIO COM PERMISSÃO ROOT
O primeiro passo é criar as views que serão utilizadas na extração de dados, como não é possível executar o HAT_SETUP.jar a criação dessas views deve ser feita manualmente. As views estão contidas na pasta do ETL_LINUX, dentro de bin\agent\scripts.
Dentro da pasta temos os scripts para os bancos de dados MSSQL, Oracle e Postgres. Utilize os scripts referente a base de dados que será utilizado.
As views devem ser criadas no seguinte padrão:
CREATE VIEW NOME_DO_ARQUIVO AS script_do_arquivo -- Exemplo CREATE VIEW HAT_LOAD_BA0 AS SELECT BA0_CODIDE AS CodigoIdentificacaoEmpresa, BA0_CODINT AS CodigoOperadora, BA0_NOMINT AS Operadora, BA0_SUSEP AS NumeroRegistroANS, BA0_END AS Endereco, BA0_LOJA AS CodigoLoja, BA0_CODCLI AS CodigoCliente, BA0_ABRANG AS Abrangencia FROM BA0010 WHERE D_E_L_E_T_ = ' '
O próximo passo é preparar o arquivo config.properties para que ele conecte no banco de dados, realize a extração dos dados e envie para que seja feita a importação pelo Mirth.
O arquivo está na pasta do ETL_LINUX, dentro de bin\agent\.
Para que os dados sejam importados corretamente na base do TOTVS Saúde Portal Autorizador é necessário editar os valores das chaves:
registroAnsOperadora: Preencher com o registro ANS da operadora
jdbc.url: Preencher com os dados de IP, porta e nome do banco de dados
jdbc.username: Preencher com o nome de usuário com acesso as views.
jdbc.password: Preencher com a senha do usuário com acesso as views.
################################################ ### Propriedades da operadora ### ################################################ registroAnsOperadora=REGISTRO_ANS_OPERADORA ################################################ ### Configuracao de conexao mssql ################################################ jdbc.driver_path=jdbc/sqljdbc4.jar jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc.url=jdbc:sqlserver://IPBancoDeDados:1433;DatabaseName=NomeBancoDeDados jdbc.username=UsuarioBD jdbc.password=SenhaBD ################################################ ### Views que serao extraidas ### ################################################ data.HAT_LOAD_B06.sql=select * from HAT_LOAD_B06 data.HAT_LOAD_B26.sql=select * from HAT_LOAD_B26 data.HAT_LOAD_BA0.sql=select * from HAT_LOAD_BA0 data.HAT_LOAD_BA1.sql=select * from HAT_LOAD_BA1 data.HAT_LOAD_BA3.sql=select * from HAT_LOAD_BA3 data.HAT_LOAD_BA6.sql=select * from HAT_LOAD_BA6 data.HAT_LOAD_BA9.sql=select * from HAT_LOAD_BA9 data.HAT_LOAD_BAN.sql=select * from HAT_LOAD_BAN data.HAT_LOAD_BAQ.sql=select * from HAT_LOAD_BAQ data.HAT_LOAD_BAU.sql=select * from HAT_LOAD_BAU data.HAT_LOAD_BAW.sql=select * from HAT_LOAD_BAW data.HAT_LOAD_BAX.sql=select * from HAT_LOAD_BAX data.HAT_LOAD_BB0.sql=select * from HAT_LOAD_BB0 data.HAT_LOAD_BB2.sql=select * from HAT_LOAD_BB2 data.HAT_LOAD_BB6.sql=select * from HAT_LOAD_BB6 data.HAT_LOAD_BB8.sql=select * from HAT_LOAD_BB8 data.HAT_LOAD_BBF.sql=select * from HAT_LOAD_BBF data.HAT_LOAD_BBI.sql=select * from HAT_LOAD_BBI data.HAT_LOAD_BBK.sql=select * from HAT_LOAD_BBK data.HAT_LOAD_BBM.sql=select * from HAT_LOAD_BBM data.HAT_LOAD_BBN.sql=select * from HAT_LOAD_BBN data.HAT_LOAD_BC0.sql=select * from HAT_LOAD_BC0 data.HAT_LOAD_BC1.sql=select * from HAT_LOAD_BC1 data.HAT_LOAD_BCT.sql=select * from HAT_LOAD_BCT data.HAT_LOAD_BDL.sql=select * from HAT_LOAD_BDL data.HAT_LOAD_BE4.sql=select * from HAT_LOAD_BE4 data.HAT_LOAD_BE6.sql=select * from HAT_LOAD_BE6 data.HAT_LOAD_BE9.sql=select * from HAT_LOAD_BE9 data.HAT_LOAD_BEA.sql=select * from HAT_LOAD_BEA data.HAT_LOAD_BF1.sql=select * from HAT_LOAD_BF1 data.HAT_LOAD_BFC.sql=select * from HAT_LOAD_BFC data.HAT_LOAD_BFD.sql=select * from HAT_LOAD_BFD data.HAT_LOAD_BFE.sql=select * from HAT_LOAD_BFE data.HAT_LOAD_BFG.sql=select * from HAT_LOAD_BFG data.HAT_LOAD_BFJ.sql=select * from HAT_LOAD_BFJ data.HAT_LOAD_BFO.sql=select * from HAT_LOAD_BFO data.HAT_LOAD_BFP.sql=select * from HAT_LOAD_BFP data.HAT_LOAD_BG7.sql=select * from HAT_LOAD_BG7 data.HAT_LOAD_BG8.sql=select * from HAT_LOAD_BG8 data.HAT_LOAD_BG9.sql=select * from HAT_LOAD_BG9 data.HAT_LOAD_BI3.sql=select * from HAT_LOAD_BI3 data.HAT_LOAD_BI6.sql=select * from HAT_LOAD_BI6 data.HAT_LOAD_BIA.sql=select * from HAT_LOAD_BIA data.HAT_LOAD_BJ4.sql=select * from HAT_LOAD_BJ4 data.HAT_LOAD_BJE.sql=select * from HAT_LOAD_BJE data.HAT_LOAD_BLD.sql=select * from HAT_LOAD_BLD data.HAT_LOAD_BLE.sql=select * from HAT_LOAD_BLE data.HAT_LOAD_BQC.sql=select * from HAT_LOAD_BQC data.HAT_LOAD_BR4.sql=select * from HAT_LOAD_BR4 data.HAT_LOAD_BR8.sql=select * from HAT_LOAD_BR8 data.HAT_LOAD_BRV.sql=select * from HAT_LOAD_BRV data.HAT_LOAD_BT4.sql=select * from HAT_LOAD_BT4 data.HAT_LOAD_BT5.sql=select * from HAT_LOAD_BT5 data.HAT_LOAD_BT6.sql=select * from HAT_LOAD_BT6 data.HAT_LOAD_BT7.sql=select * from HAT_LOAD_BT7 data.HAT_LOAD_BT8.sql=select * from HAT_LOAD_BT8 data.HAT_LOAD_BTQ.sql=select * from HAT_LOAD_BTQ data.HAT_LOAD_BTS.sql=select * from HAT_LOAD_BTS data.HAT_LOAD_BTU.sql=select * from HAT_LOAD_BTU data.HAT_LOAD_BVI.sql=select * from HAT_LOAD_BVI data.HAT_LOAD_BW3.sql=select * from HAT_LOAD_BW3 data.HAT_LOAD_CidIncompativel_BAA.sql=select * from HAT_LOAD_CidIncompativel_BAA data.HAT_LOAD_CRIT_ATEND_BEG.sql=select * from HAT_LOAD_CRIT_ATEND_BEG data.HAT_LOAD_CRIT_ATEND_BEL.sql=select * from HAT_LOAD_CRIT_ATEND_BEL data.HAT_LOAD_PROC_ATEND_BE2.sql=select * from HAT_LOAD_PROC_ATEND_BE2 data.HAT_LOAD_PROC_ATEND_BEJ.sql=select * from HAT_LOAD_PROC_ATEND_BEJ data.HAT_LOAD_REGRASCOBERTURA.sql=select * from HAT_LOAD_REGRASCOBERTURA data.HAT_LOAD_SE1.sql=select * from HAT_LOAD_SE1 data.HAT_LOAD_VINCULOSODONTO.sql=select * from HAT_LOAD_VINCULOSODONTO data.HAT_STMP_B06.sql=select * from HAT_STMP_B06 data.HAT_STMP_BA0.sql=select * from HAT_STMP_BA0 data.HAT_STMP_BA1.sql=select * from HAT_STMP_BA1 data.HAT_STMP_BA3.sql=select * from HAT_STMP_BA3 data.HAT_STMP_BA6.sql=select * from HAT_STMP_BA6 data.HAT_STMP_BA9.sql=select * from HAT_STMP_BA9 data.HAT_STMP_BAN.sql=select * from HAT_STMP_BAN data.HAT_STMP_BAQ.sql=select * from HAT_STMP_BAQ data.HAT_STMP_BAU.sql=select * from HAT_STMP_BAU data.HAT_STMP_BAW.sql=select * from HAT_STMP_BAW data.HAT_STMP_BAX.sql=select * from HAT_STMP_BAX data.HAT_STMP_BB0.sql=select * from HAT_STMP_BB0 data.HAT_STMP_BB2.sql=select * from HAT_STMP_BB2 data.HAT_STMP_BB6.sql=select * from HAT_STMP_BB6 data.HAT_STMP_BB8.sql=select * from HAT_STMP_BB8 data.HAT_STMP_BBF.sql=select * from HAT_STMP_BBF data.HAT_STMP_BBI.sql=select * from HAT_STMP_BBI data.HAT_STMP_BBK.sql=select * from HAT_STMP_BBK data.HAT_STMP_BBM.sql=select * from HAT_STMP_BBM data.HAT_STMP_BBN.sql=select * from HAT_STMP_BBN data.HAT_STMP_BC0.sql=select * from HAT_STMP_BC0 data.HAT_STMP_BC1.sql=select * from HAT_STMP_BC1 data.HAT_STMP_BCT.sql=select * from HAT_STMP_BCT data.HAT_STMP_BDL.sql=select * from HAT_STMP_BDL data.HAT_STMP_BE4.sql=select * from HAT_STMP_BE4 data.HAT_STMP_BE6.sql=select * from HAT_STMP_BE6 data.HAT_STMP_BE9.sql=select * from HAT_STMP_BE9 data.HAT_STMP_BEA.sql=select * from HAT_STMP_BEA data.HAT_STMP_BF1.sql=select * from HAT_STMP_BF1 data.HAT_STMP_BFC.sql=select * from HAT_STMP_BFC data.HAT_STMP_BFD.sql=select * from HAT_STMP_BFD data.HAT_STMP_BFE.sql=select * from HAT_STMP_BFE data.HAT_STMP_BFG.sql=select * from HAT_STMP_BFG data.HAT_STMP_BFJ.sql=select * from HAT_STMP_BFJ data.HAT_STMP_BFO.sql=select * from HAT_STMP_BFO data.HAT_STMP_BFP.sql=select * from HAT_STMP_BFP data.HAT_STMP_BG7.sql=select * from HAT_STMP_BG7 data.HAT_STMP_BG8.sql=select * from HAT_STMP_BG8 data.HAT_STMP_BG9.sql=select * from HAT_STMP_BG9 data.HAT_STMP_BI3.sql=select * from HAT_STMP_BI3 data.HAT_STMP_BI6.sql=select * from HAT_STMP_BI6 data.HAT_STMP_BIA.sql=select * from HAT_STMP_BIA data.HAT_STMP_BJ4.sql=select * from HAT_STMP_BJ4 data.HAT_STMP_BJE.sql=select * from HAT_STMP_BJE data.HAT_STMP_BLD.sql=select * from HAT_STMP_BLD data.HAT_STMP_BLE.sql=select * from HAT_STMP_BLE data.HAT_STMP_BQC.sql=select * from HAT_STMP_BQC data.HAT_STMP_BR4.sql=select * from HAT_STMP_BR4 data.HAT_STMP_BR8.sql=select * from HAT_STMP_BR8 data.HAT_STMP_BRV.sql=select * from HAT_STMP_BRV data.HAT_STMP_BT4.sql=select * from HAT_STMP_BT4 data.HAT_STMP_BT5.sql=select * from HAT_STMP_BT5 data.HAT_STMP_BT6.sql=select * from HAT_STMP_BT6 data.HAT_STMP_BT7.sql=select * from HAT_STMP_BT7 data.HAT_STMP_BT8.sql=select * from HAT_STMP_BT8 data.HAT_STMP_BTQ.sql=select * from HAT_STMP_BTQ data.HAT_STMP_BTS.sql=select * from HAT_STMP_BTS data.HAT_STMP_BTU.sql=select * from HAT_STMP_BTU data.HAT_STMP_BVI.sql=select * from HAT_STMP_BVI data.HAT_STMP_BW3.sql=select * from HAT_STMP_BW3 data.HAT_STMP_CidIncompativel_BAA.sql=select * from HAT_STMP_CidIncompativel_BAA data.HAT_STMP_CRIT_ATEND_BEG.sql=select * from HAT_STMP_CRIT_ATEND_BEG data.HAT_STMP_CRIT_ATEND_BEL.sql=select * from HAT_STMP_CRIT_ATEND_BEL data.HAT_STMP_PROC_ATEND_BE2.sql=select * from HAT_STMP_PROC_ATEND_BE2 data.HAT_STMP_PROC_ATEND_BEJ.sql=select * from HAT_STMP_PROC_ATEND_BEJ data.HAT_STMP_REGRASCOBERTURA.sql=select * from HAT_STMP_REGRASCOBERTURA data.HAT_STMP_SE1.sql=select * from HAT_STMP_SE1 data.HAT_STMP_VINCULOSODONTO.sql=select * from HAT_STMP_VINCULOSODONTO ################################################ ### Parametros obrigatorios do Agent ### ################################################ # Credenciais do FTP gdc.unlock=FALSE gdc.uploadTrying=1 gdc.uploadSecond=1 gdc.upload_url=https://pagprostorage.blob.core.windows.net/arquivos-integracao gdc.key=P3N2PTIwMTctMTEtMDkmc3M9YiZzcnQ9c2NvJnNwPXJ3ZGxhJnNlPTIwMzAtMTItMDJUMjM6NDQ6MzFaJnN0PTIwMTgtMDgtMjBUMTY6NDQ6MzFaJnNwcj1odHRwcyZzaWc9YXpLR3JITkdGbDBYNWwzd3BGRE1yNnUxV3JGdE5lOElUYkRmVzd2ZmNobyUzRA== gdc.blob_type=BlockBlob gdc.upload_archive=Integracao_HAT-${yyyyMMddHHmmss}.zip gdc.upload_manifest=manifest-${yyyyMMddHHmmss}.txt # Parametro responsavel por verificar se sera utilizado criptografia de senhas. gdc.crypto=FALSE # Backup gdc.backup=TRUE
O próximo passo é extrair os dados da base de dados utilizando o agent-healthcare.jar.
Acesse a pasta bin/agent dentro da pasta ETL_LINUX onde o arquivo agent-healthcare.jar está localizado e execute o comando java -jar agent-healthcare.jar. Ele irá conectar no banco de dados e realizar a extração.
Após realizarmos a extração de dados para a carga inicial precisamos configurar o agendamento para a integração de dados do TOTVS Protheus para o TOTVS Saúde Portal Autorizador. Para isso precisamos editar o arquivo config.properties removendo as views que começam com HAT_LOAD_... da chave Views que serao extraidas, deixando somente as que iniciem com HAT_STMP_...
################################################ ### Propriedades da operadora ### ################################################ registroAnsOperadora=REGISTRO_ANS_OPERADORA ################################################ ### Configuracao de conexao mssql ################################################ jdbc.driver_path=jdbc/sqljdbc4.jar jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc.url=jdbc:sqlserver://IPBancoDeDados:1433;DatabaseName=NomeBancoDeDados jdbc.username=UsuarioBD jdbc.password=SenhaBD ################################################ ### Views que serao extraidas ### ################################################ data.HAT_STMP_B06.sql=select * from HAT_STMP_B06 data.HAT_STMP_BA0.sql=select * from HAT_STMP_BA0 data.HAT_STMP_BA1.sql=select * from HAT_STMP_BA1 data.HAT_STMP_BA3.sql=select * from HAT_STMP_BA3 data.HAT_STMP_BA6.sql=select * from HAT_STMP_BA6 data.HAT_STMP_BA9.sql=select * from HAT_STMP_BA9 data.HAT_STMP_BAN.sql=select * from HAT_STMP_BAN data.HAT_STMP_BAQ.sql=select * from HAT_STMP_BAQ data.HAT_STMP_BAU.sql=select * from HAT_STMP_BAU data.HAT_STMP_BAW.sql=select * from HAT_STMP_BAW data.HAT_STMP_BAX.sql=select * from HAT_STMP_BAX data.HAT_STMP_BB0.sql=select * from HAT_STMP_BB0 data.HAT_STMP_BB2.sql=select * from HAT_STMP_BB2 data.HAT_STMP_BB6.sql=select * from HAT_STMP_BB6 data.HAT_STMP_BB8.sql=select * from HAT_STMP_BB8 data.HAT_STMP_BBF.sql=select * from HAT_STMP_BBF data.HAT_STMP_BBI.sql=select * from HAT_STMP_BBI data.HAT_STMP_BBK.sql=select * from HAT_STMP_BBK data.HAT_STMP_BBM.sql=select * from HAT_STMP_BBM data.HAT_STMP_BBN.sql=select * from HAT_STMP_BBN data.HAT_STMP_BC0.sql=select * from HAT_STMP_BC0 data.HAT_STMP_BC1.sql=select * from HAT_STMP_BC1 data.HAT_STMP_BCT.sql=select * from HAT_STMP_BCT data.HAT_STMP_BDL.sql=select * from HAT_STMP_BDL data.HAT_STMP_BE4.sql=select * from HAT_STMP_BE4 data.HAT_STMP_BE6.sql=select * from HAT_STMP_BE6 data.HAT_STMP_BE9.sql=select * from HAT_STMP_BE9 data.HAT_STMP_BEA.sql=select * from HAT_STMP_BEA data.HAT_STMP_BF1.sql=select * from HAT_STMP_BF1 data.HAT_STMP_BFC.sql=select * from HAT_STMP_BFC data.HAT_STMP_BFD.sql=select * from HAT_STMP_BFD data.HAT_STMP_BFE.sql=select * from HAT_STMP_BFE data.HAT_STMP_BFG.sql=select * from HAT_STMP_BFG data.HAT_STMP_BFJ.sql=select * from HAT_STMP_BFJ data.HAT_STMP_BFO.sql=select * from HAT_STMP_BFO data.HAT_STMP_BFP.sql=select * from HAT_STMP_BFP data.HAT_STMP_BG7.sql=select * from HAT_STMP_BG7 data.HAT_STMP_BG8.sql=select * from HAT_STMP_BG8 data.HAT_STMP_BG9.sql=select * from HAT_STMP_BG9 data.HAT_STMP_BI3.sql=select * from HAT_STMP_BI3 data.HAT_STMP_BI6.sql=select * from HAT_STMP_BI6 data.HAT_STMP_BIA.sql=select * from HAT_STMP_BIA data.HAT_STMP_BJ4.sql=select * from HAT_STMP_BJ4 data.HAT_STMP_BJE.sql=select * from HAT_STMP_BJE data.HAT_STMP_BLD.sql=select * from HAT_STMP_BLD data.HAT_STMP_BLE.sql=select * from HAT_STMP_BLE data.HAT_STMP_BQC.sql=select * from HAT_STMP_BQC data.HAT_STMP_BR4.sql=select * from HAT_STMP_BR4 data.HAT_STMP_BR8.sql=select * from HAT_STMP_BR8 data.HAT_STMP_BRV.sql=select * from HAT_STMP_BRV data.HAT_STMP_BT4.sql=select * from HAT_STMP_BT4 data.HAT_STMP_BT5.sql=select * from HAT_STMP_BT5 data.HAT_STMP_BT6.sql=select * from HAT_STMP_BT6 data.HAT_STMP_BT7.sql=select * from HAT_STMP_BT7 data.HAT_STMP_BT8.sql=select * from HAT_STMP_BT8 data.HAT_STMP_BTQ.sql=select * from HAT_STMP_BTQ data.HAT_STMP_BTS.sql=select * from HAT_STMP_BTS data.HAT_STMP_BTU.sql=select * from HAT_STMP_BTU data.HAT_STMP_BVI.sql=select * from HAT_STMP_BVI data.HAT_STMP_BW3.sql=select * from HAT_STMP_BW3 data.HAT_STMP_CidIncompativel_BAA.sql=select * from HAT_STMP_CidIncompativel_BAA data.HAT_STMP_CRIT_ATEND_BEG.sql=select * from HAT_STMP_CRIT_ATEND_BEG data.HAT_STMP_CRIT_ATEND_BEL.sql=select * from HAT_STMP_CRIT_ATEND_BEL data.HAT_STMP_PROC_ATEND_BE2.sql=select * from HAT_STMP_PROC_ATEND_BE2 data.HAT_STMP_PROC_ATEND_BEJ.sql=select * from HAT_STMP_PROC_ATEND_BEJ data.HAT_STMP_REGRASCOBERTURA.sql=select * from HAT_STMP_REGRASCOBERTURA data.HAT_STMP_SE1.sql=select * from HAT_STMP_SE1 data.HAT_STMP_VINCULOSODONTO.sql=select * from HAT_STMP_VINCULOSODONTO ################################################ ### Parametros obrigatorios do Agent ### ################################################ # Credenciais do FTP gdc.unlock=FALSE gdc.uploadTrying=1 gdc.uploadSecond=1 gdc.upload_url=https://pagprostorage.blob.core.windows.net/arquivos-integracao gdc.key=P3N2PTIwMTctMTEtMDkmc3M9YiZzcnQ9c2NvJnNwPXJ3ZGxhJnNlPTIwMzAtMTItMDJUMjM6NDQ6MzFaJnN0PTIwMTgtMDgtMjBUMTY6NDQ6MzFaJnNwcj1odHRwcyZzaWc9YXpLR3JITkdGbDBYNWwzd3BGRE1yNnUxV3JGdE5lOElUYkRmVzd2ZmNobyUzRA== gdc.blob_type=BlockBlob gdc.upload_archive=Integracao_HAT-${yyyyMMddHHmmss}.zip gdc.upload_manifest=manifest-${yyyyMMddHHmmss}.txt # Parametro responsavel por verificar se sera utilizado criptografia de senhas. gdc.crypto=FALSE # Backup gdc.backup=TRUE
Realizada essa configuração é necessário alterar o arquivo sync_data.sh indicando o endereço onde está localizada a pasta ETL_LINUX.
Abaixo temos um exemplo de como deve ficar o script.
Obs.: O arquivo sync_data.sh deve estar com a codificação UTF-8 e com a sequencia de fim de linha LF
# Localização da pasta ETL_LINUX para o script entrar na pasta onde está o agent-healthcare.jar cd /opt/totvs/ETL_LINUX/bin/agent # Comando para executar o agente de extração e onde gravar o log de execução java -jar agent-healthcare.jar >> /opt/totvs/ETL_LINUX/ETL_LINUX.log