gerint 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +259 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gerint.gemspec +34 -0
- data/lib/gerint.rb +15 -0
- data/lib/gerint/comunicacao/comunicacao.rb +129 -0
- data/lib/gerint/servicos/alta.rb +43 -0
- data/lib/gerint/servicos/internacao.rb +41 -0
- data/lib/gerint/servicos/padrao.rb +20 -0
- data/lib/gerint/servicos/solicitacao_internacao.rb +88 -0
- data/lib/gerint/servicos/solicitacao_internacao_psiquiatria.rb +51 -0
- data/lib/gerint/servicos/transferir_leito.rb +36 -0
- data/lib/gerint/version.rb +3 -0
- metadata +105 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4dd70256b75a75392b4f6c95edb9252a180ed0ae662146449bcca43aa852eefc
|
|
4
|
+
data.tar.gz: 918a673ad53616ffc9e2af3648f33f8e36290f84cdd8550a57f2adf2ef9fa960
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 608ec0d3e89b315fd4ead5d202ce7c8dff692bea21e0f8743cc60fd2d791e68a3bef144500a30e0d932e29f7bbe908bb409978636a6a57e919c9f51f1232b245
|
|
7
|
+
data.tar.gz: 30442a010bc31492b589f2d09a4d3908a5f08c62ff8fa71aafe82098dc8bc020212c9caa8d91c9623773e83eb42d1e7dafa1574f6ce0a24dca7d63b788269f7a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at nelson@inovadora.com.br. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nelson Coelho
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Gerint
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gerint`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'gerint'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install gerint
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
## Serviços disponíveis
|
|
26
|
+
|
|
27
|
+
### Conexão com o GERINT
|
|
28
|
+
|
|
29
|
+
Antes de executar qualquer serviço, deve ser criado uma conexão com o GERINT.
|
|
30
|
+
|
|
31
|
+
Exemplo:
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
require 'gerint'
|
|
35
|
+
conexao = Gerint::Comunicacao.new(ambiente='H', apikey="0ecc120b-c3bf-4e71-a5f9-cbaf0e394e34", usuario="integracao.2237180", senha="integracao.2237180", cnes="2237180")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Solicitação de Internação
|
|
39
|
+
|
|
40
|
+
Registra uma solicitação de internação no GERINT.
|
|
41
|
+
|
|
42
|
+
Exemplo:
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
sol = Gerint::SolicitacaoInternacao.new
|
|
46
|
+
sol.cartaoSus = "898004081765334"
|
|
47
|
+
sol.cpfPaciente = "79423914934"
|
|
48
|
+
sol.tipoInternacao = "URGENCIA"
|
|
49
|
+
sol.tipoAcesso = "samuPoa"
|
|
50
|
+
sol.internacaoPropria = "SIM"
|
|
51
|
+
sol.tipoLeito = "OBSTETRICO"
|
|
52
|
+
sol.cidPrincipal = "J180"
|
|
53
|
+
sol.cpfProfissionalSolicitante = "47749504087"
|
|
54
|
+
sol.sinaisSintomas = "Paciente apresenta comprometimento da função hepática"
|
|
55
|
+
sol.justificativaInternacao = "Paciente necessita de cuidados prolongados, necessita internação para esse cuidado"
|
|
56
|
+
sol.cor = "LARANJA"
|
|
57
|
+
sol.frequenciaCardiaca = "80"
|
|
58
|
+
sol.frequenciaRespiratoria = "18"
|
|
59
|
+
sol.pressaoArterialMaxima = "120"
|
|
60
|
+
sol.pressaoArterialMinima = "80"
|
|
61
|
+
sol.temperatura = "37.5"
|
|
62
|
+
sol.saturacaoO2 = "089"
|
|
63
|
+
sol.sensorio = "ALERTA"
|
|
64
|
+
sol.debitoUrinario = "ANURIA"
|
|
65
|
+
sol.procedimento = "0404010415"
|
|
66
|
+
sol.dialise = "NAO"
|
|
67
|
+
sol.suporteO2 = "AR_AMBIENTE"
|
|
68
|
+
sol.codigoEspecialidade = "374974"
|
|
69
|
+
sol.isolamentoNecessario = "NAO"
|
|
70
|
+
sol.possuiComorbidade = "NAO"
|
|
71
|
+
conexao.solicitacao_internacao(sol)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Retorno com sucesso:
|
|
75
|
+
|
|
76
|
+
Quando a solicitação é aceita:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "numeroCERIH": "202000021270",
|
|
80
|
+
"procedimento": "TURBINECTOMIA",
|
|
81
|
+
"situacao": "INTERNACAO_AUTORIZADA",
|
|
82
|
+
"dataSolicitacao":1600978049186,
|
|
83
|
+
"nomeUnidadeEncaminhada":null,
|
|
84
|
+
"cnesUnidadeEncaminhada":null,
|
|
85
|
+
"mensagem":null,
|
|
86
|
+
"cartaoSUS": "708903767492018",
|
|
87
|
+
"inicioInternacao":null,
|
|
88
|
+
"fimInternacao":null
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Quando a solicitação já existe:
|
|
93
|
+
```json
|
|
94
|
+
{ "numeroCERIH": "202000021270",
|
|
95
|
+
"procedimento":null,
|
|
96
|
+
"situacao":null,
|
|
97
|
+
"dataSolicitacao":null,
|
|
98
|
+
"nomeUnidadeEncaminhada": null,
|
|
99
|
+
"cnesUnidadeEncaminhada": null,
|
|
100
|
+
"mensagem": "Já existe solicitação autorizada neste hospital para este paciente.",
|
|
101
|
+
"cartaoSUS": null,
|
|
102
|
+
"inicioInternacao": null,
|
|
103
|
+
"fimInternacao":null
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Solicitação de Internação para Psiquiatria
|
|
108
|
+
|
|
109
|
+
Registra uma solicitação de internação pata o tipo de leito psiquiatria no GERINT.
|
|
110
|
+
|
|
111
|
+
Exemplo:
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
sol = Gerint::SolicitacaoInternacaoPsiquiatria.new
|
|
115
|
+
sol.cpfPaciente = "33960500025"
|
|
116
|
+
sol.tipoInternacao = "URGENCIA"
|
|
117
|
+
sol.tipoAcesso = "samuPoa"
|
|
118
|
+
sol.internacaoPropria = "SIM"
|
|
119
|
+
sol.tipoLeito = "PSIQUIATRICO"
|
|
120
|
+
sol.cidPrincipal = "J180"
|
|
121
|
+
sol.cpfProfissionalSolicitante = "47749504087"
|
|
122
|
+
sol.sinaisSintomas = "Paciente apresenta comprometimento da função hepática"
|
|
123
|
+
sol.justificativaInternacao = "Paciente necessita de cuidados prolongados, necessita internação para esse cuidado"
|
|
124
|
+
sol.cor = "LARANJA"
|
|
125
|
+
sol.frequenciaCardiaca = "80"
|
|
126
|
+
sol.frequenciaRespiratoria = "18"
|
|
127
|
+
sol.pressaoArterialMaxima = "120"
|
|
128
|
+
sol.pressaoArterialMinima = "80"
|
|
129
|
+
sol.temperatura = "37.5"
|
|
130
|
+
sol.saturacaoO2 = "089"
|
|
131
|
+
sol.sensorio = "ALERTA"
|
|
132
|
+
sol.debitoUrinario = "ANURIA"
|
|
133
|
+
sol.procedimento = "0404010415"
|
|
134
|
+
sol.dialise = "NAO"
|
|
135
|
+
sol.suporteO2 = "AR_AMBIENTE"
|
|
136
|
+
sol.codigoEspecialidade = "374974"
|
|
137
|
+
sol.isolamentoNecessario = "NAO"
|
|
138
|
+
sol.possuiComorbidade = "NAO"
|
|
139
|
+
sol.internacaoPsiquiatricaPrevia = "NAO"
|
|
140
|
+
sol.riscoHeteroagressao = "NAO"
|
|
141
|
+
sol.pacienteMotivado = "NA"
|
|
142
|
+
sol.acompanhamentoPsiquiatricoAmbulatorial = "NAO"
|
|
143
|
+
sol.usoSubstanciaPsicoativa = "SIM"
|
|
144
|
+
sol.substanciasPsicoativas = "Cocaina"
|
|
145
|
+
sol.suporteFamiliar = "presente"
|
|
146
|
+
sol.planoSuicida = "NAO"
|
|
147
|
+
sol.usoMedicamentoComorbidadesPsiquiatria = "SIM"
|
|
148
|
+
sol.medicamentoComorbidadePsiquiatria = "Rivotril"
|
|
149
|
+
sol.gravidaPsiquiatria = "NAO"
|
|
150
|
+
conexao.solicitacao_internacao(sol)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Os retornos são iguais à solicitação de internação
|
|
154
|
+
|
|
155
|
+
### Internação
|
|
156
|
+
|
|
157
|
+
Informa a internação de um paciente
|
|
158
|
+
|
|
159
|
+
Exemplo:
|
|
160
|
+
|
|
161
|
+
```ruby
|
|
162
|
+
int=Gerint::Internacao.new
|
|
163
|
+
int.protocoloSolicitacao = "202000020923"
|
|
164
|
+
int.identificacaoLeito = "leito1"
|
|
165
|
+
int.codTipoLeito = "03"
|
|
166
|
+
int.dataInternacao = DateTime.now
|
|
167
|
+
conexao.internacao(int)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Internação em Leito Extra
|
|
171
|
+
|
|
172
|
+
Informa a internação de um paciente em um leito extra
|
|
173
|
+
|
|
174
|
+
Exemplo:
|
|
175
|
+
|
|
176
|
+
```ruby
|
|
177
|
+
int=Gerint::Internacao.new
|
|
178
|
+
int.protocoloSolicitacao = "202000020923"
|
|
179
|
+
int.leitoExtra = true
|
|
180
|
+
int.identificacaoLeito = "leitoextra1"
|
|
181
|
+
int.codTipoLeito = "03"
|
|
182
|
+
int.dataInternacao = DateTime.now
|
|
183
|
+
conexao.internacao(int)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Liberação de Internação / Alta
|
|
187
|
+
|
|
188
|
+
Registra a alta/óbito da internação de um paciente.
|
|
189
|
+
|
|
190
|
+
Exemplo:
|
|
191
|
+
|
|
192
|
+
```ruby
|
|
193
|
+
int=Gerint::Alta.new
|
|
194
|
+
int.protocoloSolicitacao="201700020330"
|
|
195
|
+
int.dataAlta = DateTime.now
|
|
196
|
+
int.identMotivoAlta = "ALTA"
|
|
197
|
+
int.cpfMedicoAlta = "47749504087"
|
|
198
|
+
int.identEncaminhamentoPosAlta = "atencaoBasica"
|
|
199
|
+
int.resumoInternacao = "Descrever o resumo da internação do paciente"
|
|
200
|
+
int.prescricaoAlta = "Descrever a prescrição da alta do paciente"
|
|
201
|
+
int.cidPrincipal = "J180"
|
|
202
|
+
conexao.alta(int)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Transferir paciente de leito
|
|
206
|
+
|
|
207
|
+
Registra a transferencia de leito de um paciente que está no GERINT.
|
|
208
|
+
|
|
209
|
+
Exemplo:
|
|
210
|
+
|
|
211
|
+
```ruby
|
|
212
|
+
int=Gerint::TransferirLeito.new
|
|
213
|
+
int.protocoloSolicitacao="201700020330"
|
|
214
|
+
int.identificacaoLeito="leito1"
|
|
215
|
+
int.codTipoLeito="03"
|
|
216
|
+
int.justifTransferencia = "Justificativa da transferencia(opcional)"
|
|
217
|
+
int.leitoExtra = false
|
|
218
|
+
conexao.transferir_leito(int)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Busca situação das solicitações
|
|
222
|
+
|
|
223
|
+
Busca a situação das solicitações feitas no GERINT
|
|
224
|
+
|
|
225
|
+
Exemplo:
|
|
226
|
+
|
|
227
|
+
```ruby
|
|
228
|
+
conexao.busca_situacao_solicitacoes
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Consulta solicitações do executante
|
|
232
|
+
|
|
233
|
+
Retorna uma lista de objetos com informações de todas as solicitações nas situações ‘INTERNACAO_AUTORIZADA’ e ‘INTERNADA’ de uma unidade executante.
|
|
234
|
+
|
|
235
|
+
Exemplo:
|
|
236
|
+
|
|
237
|
+
```ruby
|
|
238
|
+
conexao.busca_solicitacoes_executante
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
244
|
+
|
|
245
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
246
|
+
|
|
247
|
+
## Contributing
|
|
248
|
+
|
|
249
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gerint. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
254
|
+
|
|
255
|
+
## Code of Conduct
|
|
256
|
+
|
|
257
|
+
Everyone interacting in the Gerint project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gerint/blob/master/CODE_OF_CONDUCT.md).
|
|
258
|
+
|
|
259
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "gerint"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/gerint.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require "gerint/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "gerint"
|
|
7
|
+
spec.version = Gerint::VERSION
|
|
8
|
+
spec.authors = ["Nelson Coelho"]
|
|
9
|
+
spec.email = ["nelson@inovadora.com.br"]
|
|
10
|
+
|
|
11
|
+
spec.summary = %q{Integração com GERINT.}
|
|
12
|
+
spec.description = %q{Integração com GERINT, regulação de leitos de Porto Alegre.}
|
|
13
|
+
spec.homepage = "http://www.inovadora.com.br."
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
|
17
|
+
|
|
18
|
+
#spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
#spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
|
20
|
+
#spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
end
|
|
27
|
+
spec.bindir = "exe"
|
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
29
|
+
spec.require_paths = ["lib"]
|
|
30
|
+
|
|
31
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
34
|
+
end
|
data/lib/gerint.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
require "gerint/version"
|
|
3
|
+
require "gerint/comunicacao/comunicacao"
|
|
4
|
+
|
|
5
|
+
#Servicos
|
|
6
|
+
require "gerint/servicos/padrao"
|
|
7
|
+
require "gerint/servicos/internacao"
|
|
8
|
+
require "gerint/servicos/transferir_leito"
|
|
9
|
+
require "gerint/servicos/alta"
|
|
10
|
+
require "gerint/servicos/solicitacao_internacao"
|
|
11
|
+
require "gerint/servicos/solicitacao_internacao_psiquiatria"
|
|
12
|
+
|
|
13
|
+
module Gerint
|
|
14
|
+
class Error < StandardError; end # Deixado aqui como exemplo, pra criar uma classe de erros
|
|
15
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
require "uri"
|
|
2
|
+
require "net/http"
|
|
3
|
+
|
|
4
|
+
module Gerint
|
|
5
|
+
|
|
6
|
+
class Comunicacao
|
|
7
|
+
attr_accessor :ambiente, :apikey, :usuario, :senha, :cnes
|
|
8
|
+
|
|
9
|
+
def initialize(ambiente, apikey, usuario, senha, cnes)
|
|
10
|
+
@ambiente = ambiente
|
|
11
|
+
@apikey = apikey
|
|
12
|
+
@usuario = usuario
|
|
13
|
+
@senha = senha
|
|
14
|
+
|
|
15
|
+
@cnes = cnes
|
|
16
|
+
if ambiente == 'H' && apikey == '' # Se não informar a apikey, pega os dados de teste do HEPA
|
|
17
|
+
@apikey = "0ecc120b-c3bf-4e71-a5f9-cbaf0e394e34"
|
|
18
|
+
@usuario = "integracao.2237180"
|
|
19
|
+
@senha = "integracao.2237180"
|
|
20
|
+
@cnes = "2237180"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def credenciais # Consulta as credenciais instanciadas
|
|
25
|
+
x = "ambiente = #{@ambiente} \n"
|
|
26
|
+
x += "apikey = #{@apikey} \n"
|
|
27
|
+
x += "usuario = #{@usuario} \n"
|
|
28
|
+
x += "senha = #{@senha} \n"
|
|
29
|
+
x += "cnes = #{@cnes}"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def endereco_url
|
|
33
|
+
if @ambiente == 'P'
|
|
34
|
+
"https://api.procempa.com.br/apiman-gateway/saude/api/1.0/gerint"
|
|
35
|
+
elsif @ambiente == 'H'
|
|
36
|
+
"https://api-hom.procempa.com.br/apiman-gateway/saude/api/1.1/gerint"
|
|
37
|
+
else
|
|
38
|
+
"ERRO: Ambiente inválido, informa P para produção ou H para Homologação"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def executa_get(endereco)
|
|
43
|
+
|
|
44
|
+
ender = endereco_url + endereco
|
|
45
|
+
url = URI("#{ender}")
|
|
46
|
+
|
|
47
|
+
https = Net::HTTP.new(url.host, url.port);
|
|
48
|
+
https.use_ssl = true
|
|
49
|
+
|
|
50
|
+
request = Net::HTTP::Get.new(url)
|
|
51
|
+
request["X-API-Key"] = @apikey
|
|
52
|
+
request["usuario"] = @usuario
|
|
53
|
+
request["senha"] = @senha
|
|
54
|
+
request["cnes"] = @cnes
|
|
55
|
+
request["Cookie"] = "SERVERID=WS4CH"
|
|
56
|
+
|
|
57
|
+
response = https.request(request)
|
|
58
|
+
response.read_body
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def executa_post(endereco, body)
|
|
62
|
+
|
|
63
|
+
ender = endereco_url + endereco
|
|
64
|
+
url = URI("#{ender}")
|
|
65
|
+
|
|
66
|
+
https = Net::HTTP.new(url.host, url.port);
|
|
67
|
+
https.use_ssl = true
|
|
68
|
+
|
|
69
|
+
request = Net::HTTP::Post.new(url)
|
|
70
|
+
request["X-API-Key"] = @apikey
|
|
71
|
+
request["usuario"] = @usuario
|
|
72
|
+
request["senha"] = @senha
|
|
73
|
+
request["cnes"] = @cnes
|
|
74
|
+
request["Content-Type"] = "application/json"
|
|
75
|
+
request["Cookie"] = "SERVERID=WS4CH"
|
|
76
|
+
request.body = body
|
|
77
|
+
|
|
78
|
+
puts "***************************"
|
|
79
|
+
puts request.body
|
|
80
|
+
puts "***************************"
|
|
81
|
+
|
|
82
|
+
response = https.request(request)
|
|
83
|
+
response.read_body
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def busca_situacao_solicitacoes
|
|
88
|
+
ender = "/solicitacoes/buscaSituacaoSolicitacoes"
|
|
89
|
+
retorno = self.executa_get(ender)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def busca_solicitacoes_executante(filtros="")
|
|
93
|
+
ender = "/solicitacoes/buscaSolicitacoesExecutante#{filtros}"
|
|
94
|
+
retorno = self.executa_get(ender)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def solicitacao_internacao(solicitacao_internacao)
|
|
98
|
+
ender = "/solicitacoes"
|
|
99
|
+
body = solicitacao_internacao.to_json
|
|
100
|
+
retorno = self.executa_post(ender, body)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def solicitacao_internacao_psiquiatria(solicitacao_internacao_psiquiatria)
|
|
104
|
+
ender = "/solicitacoes/psiquiatria"
|
|
105
|
+
body = solicitacao_internacao_psiquiatria.to_json
|
|
106
|
+
retorno = self.executa_post(ender, body)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def internacao(internacao)
|
|
110
|
+
ender = "/internacoes" # Usado para internações e internações psiquiatricas
|
|
111
|
+
body = internacao.to_json
|
|
112
|
+
retorno = self.executa_post(ender, body)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def alta(alta)
|
|
116
|
+
ender = "/internacoes/liberar" # No GERINT o serviço é chamado de Liberação de Internação
|
|
117
|
+
body = alta.to_json
|
|
118
|
+
retorno = self.executa_post(ender, body)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def transferir_leito(transf)
|
|
122
|
+
ender = "/internacoes/transferir"
|
|
123
|
+
body = transf.to_json
|
|
124
|
+
retorno = self.executa_post(ender, body)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
module Gerint
|
|
3
|
+
|
|
4
|
+
class Alta < Gerint::Padrao
|
|
5
|
+
attr_accessor :protocoloSolicitacao, :dataAlta, :identMotivoAlta, :cpfMedicoAlta, :identEncaminhamentoPosAlta
|
|
6
|
+
attr_accessor :resumoInternacao, :prescricaoAlta, :cidPrincipal
|
|
7
|
+
|
|
8
|
+
def as_json(options={})
|
|
9
|
+
h = {
|
|
10
|
+
protocoloSolicitacao: @protocoloSolicitacao,
|
|
11
|
+
dataAlta: @dataAlta,
|
|
12
|
+
identMotivoAlta: @identMotivoAlta
|
|
13
|
+
}
|
|
14
|
+
h.store(:cpfMedicoAlta, @cpfMedicoAlta) unless @cpfMedicoAlta.nil?
|
|
15
|
+
h.store(:identEncaminhamentoPosAlta, @identEncaminhamentoPosAlta) unless @identEncaminhamentoPosAlta.nil?
|
|
16
|
+
h.store(:resumoInternacao, @resumoInternacao) unless @resumoInternacao.nil?
|
|
17
|
+
h.store(:prescricaoAlta, @prescricaoAlta) unless @prescricaoAlta.nil?
|
|
18
|
+
h.store(:cidPrincipal, @cidPrincipal) unless @cidPrincipal.nil?
|
|
19
|
+
h
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def all_json # Gera hash com todas as variaveis de instancia
|
|
23
|
+
vinstancia = self.instance_variables
|
|
24
|
+
h = {}
|
|
25
|
+
vinstancia.each do |v|
|
|
26
|
+
h.store(v[1..50], "#{v}") # BUG: v contem o nome da variavel e não o valor int
|
|
27
|
+
end
|
|
28
|
+
h
|
|
29
|
+
h.to_json
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_json(*options)
|
|
33
|
+
as_json(*options).to_json(*options)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def dataAlta=(value)
|
|
37
|
+
@dataAlta=value.iso8601(3)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
module Gerint
|
|
3
|
+
|
|
4
|
+
class Internacao < Gerint::Padrao
|
|
5
|
+
attr_accessor :protocoloSolicitacao, :identificacaoLeito, :codTipoLeito, :dataInternacao, :justificativaDataRetroativa, :leitoExtra
|
|
6
|
+
|
|
7
|
+
def as_json(options={})
|
|
8
|
+
h = {
|
|
9
|
+
protocoloSolicitacao: @protocoloSolicitacao,
|
|
10
|
+
identificacaoLeito: @identificacaoLeito,
|
|
11
|
+
codTipoLeito: @codTipoLeito,
|
|
12
|
+
dataInternacao: @dataInternacao
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
h.store(:justificativaDataRetroativa , @justificativaDataRetroativa) unless @justificativaDataRetroativa.nil?
|
|
16
|
+
h.store(:leitoExtra, @leitoExtra) unless @leitoExtra.nil?
|
|
17
|
+
h
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def all_json # Gera hash com todas as variaveis de instancia
|
|
21
|
+
vinstancia = self.instance_variables
|
|
22
|
+
h = {}
|
|
23
|
+
vinstancia.each do |v|
|
|
24
|
+
h.store(v[1..50], "#{v}") # BUG: v contem o nome da variavel e não o valor int
|
|
25
|
+
end
|
|
26
|
+
h
|
|
27
|
+
h.to_json
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def to_json(*options)
|
|
31
|
+
as_json(*options).to_json(*options)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def dataInternacao=(value)
|
|
35
|
+
@dataInternacao=value.iso8601(3)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'date'
|
|
3
|
+
|
|
4
|
+
module Gerint
|
|
5
|
+
|
|
6
|
+
class Padrao
|
|
7
|
+
|
|
8
|
+
def obj_to_hash(object = self, hash = {})
|
|
9
|
+
object.each_pair do |key, value|
|
|
10
|
+
hash[key] = value
|
|
11
|
+
end
|
|
12
|
+
hash
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def obj_to_json(object = self)
|
|
16
|
+
self.obj_to_hash(object).to_json
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
module Gerint
|
|
3
|
+
|
|
4
|
+
class SolicitacaoInternacao < Gerint::Padrao
|
|
5
|
+
attr_accessor :cartaoSus, :cpfPaciente, :tipoInternacao, :numeroProtocoloOrigem, :tipoProtocoloOrigem, :tipoAcesso
|
|
6
|
+
attr_accessor :internacaoPropria, :tipoLeito, :cidPrincipal, :cpfProfissionalSolicitante, :sinaisSintomas
|
|
7
|
+
attr_accessor :justificativaInternacao, :cor, :frequenciaCardiaca, :frequenciaRespiratoria, :pressaoArterialMaxima
|
|
8
|
+
attr_accessor :pressaoArterialMinima, :temperatura, :saturacaoO2, :sensorio, :debitoUrinario, :procedimento
|
|
9
|
+
attr_accessor :dialise, :suporteO2, :fluxo, :fiO2, :satO2, :peep, :condicao, :nome, :sexo, :idade, :codigoMunicipio
|
|
10
|
+
attr_accessor :endereco, :codigoEspecialidade, :isolamentoNecessario, :germe1, :germe2, :germe3, :germMulriresistente
|
|
11
|
+
attr_accessor :possuiComorbidade, :comorbidade1, :comorbidade2, :comorbidade3, :dataHoraNascimento, :dataSolicitacao
|
|
12
|
+
|
|
13
|
+
def as_json(options={})
|
|
14
|
+
h = { cartaoSus: @cartaoSus,
|
|
15
|
+
cpfPaciente: @cpfPaciente,
|
|
16
|
+
tipoInternacao: @tipoInternacao,
|
|
17
|
+
numeroProtocoloOrigem: @numeroProtocoloOrigem,
|
|
18
|
+
tipoProtocoloOrigem: @tipoProtocoloOrigem,
|
|
19
|
+
internacaoPropria: @internacaoPropria,
|
|
20
|
+
tipoLeito: @tipoLeito,
|
|
21
|
+
cidPrincipal: @cidPrincipal,
|
|
22
|
+
cpfProfissionalSolicitante: @cpfProfissionalSolicitante,
|
|
23
|
+
sinaisSintomas: @sinaisSintomas,
|
|
24
|
+
justificativaInternacao: @justificativaInternacao
|
|
25
|
+
}
|
|
26
|
+
h.store(:tipoAcesso, @tipoAcesso) unless @tipoAcesso.nil?
|
|
27
|
+
h.store(:cor, @cor) unless @cor.nil?
|
|
28
|
+
h.store(:frequenciaCardiaca, @frequenciaCardiaca) unless @frequenciaCardiaca.nil?
|
|
29
|
+
h.store(:frequenciaRespiratoria, @frequenciaRespiratoria) unless @frequenciaRespiratoria.nil?
|
|
30
|
+
h.store(:pressaoArterialMaxima, @pressaoArterialMaxima) unless @pressaoArterialMaxima.nil?
|
|
31
|
+
h.store(:pressaoArterialMinima, @pressaoArterialMinima) unless @pressaoArterialMinima.nil?
|
|
32
|
+
h.store(:temperatura, @temperatura) unless @temperatura.nil?
|
|
33
|
+
h.store(:saturacaoO2, @saturacaoO2) unless @saturacaoO2.nil?
|
|
34
|
+
h.store(:sensorio, @sensorio) unless @sensorio.nil?
|
|
35
|
+
h.store(:debitoUrinario, @debitoUrinario) unless @debitoUrinario.nil?
|
|
36
|
+
h.store(:procedimento, @procedimento) unless @procedimento.nil?
|
|
37
|
+
h.store(:dialise, @dialise) unless @dialise.nil?
|
|
38
|
+
h.store(:suporteO2, @suporteO2) unless @suporteO2.nil?
|
|
39
|
+
h.store(:fluxo, @fluxo) unless @fluxo.nil?
|
|
40
|
+
h.store(:fiO2, @fiO2) unless @fiO2.nil?
|
|
41
|
+
h.store(:satO2, @satO2) unless @satO2.nil?
|
|
42
|
+
h.store(:peep, @peep) unless @peep.nil?
|
|
43
|
+
h.store(:condicao, @condicao) unless @condicao.nil?
|
|
44
|
+
h.store(:nome, @nome) unless @nome.nil?
|
|
45
|
+
h.store(:sexo, @sexo) unless @sexo.nil?
|
|
46
|
+
h.store(:idade, @idade) unless @idade.nil?
|
|
47
|
+
h.store(:condigoMunicipio, @codigoMunicipio) unless @codigoMunicipio.nil?
|
|
48
|
+
h.store(:endereco, @endereco) unless @endereco.nil?
|
|
49
|
+
h.store(:codigoEspecialidade, @codigoEspecialiade) unless @codigoEspecialidade.nil?
|
|
50
|
+
h.store(:isolamentoNecessario, @isolamentoNecessario) unless @isolamentoNecessario.nil?
|
|
51
|
+
h.store(:germe1, @germe1) unless @germe1.nil?
|
|
52
|
+
h.store(:germe2, @germe2) unless @germe2.nil?
|
|
53
|
+
h.store(:germe3, @germe3) unless @germe3.nil?
|
|
54
|
+
h.store(:germeMultiresistente, @germeMultiresistente) unless @germeMultiresistente.nil?
|
|
55
|
+
h.store(:possuiComorbidade, @possuiComorbidade) unless @possuiComorbidade.nil?
|
|
56
|
+
h.store(:comorbidade1, @comorbidade1) unless @comorbidade1.nil?
|
|
57
|
+
h.store(:comorbidade2, @comorbidade2) unless @comorbidade2.nil?
|
|
58
|
+
h.store(:comorbidade3, @comorbidade3) unless @comorbidade3.nil?
|
|
59
|
+
h.store(:dataHoraNascimento, @dataHoraNascimento) unless @dataHoraNascimento.nil?
|
|
60
|
+
h.store(:dataSolicitacao, @dataSolicitacao) unless @dataSolicitacao.nil?
|
|
61
|
+
h
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def all_json # Gera hash com todas as variaveis de instancia
|
|
65
|
+
vinstancia = self.instance_variables
|
|
66
|
+
h = {}
|
|
67
|
+
vinstancia.each do |v|
|
|
68
|
+
h.store(v[1..50], "#{v}") # BUG: v contem o nome da variavel e não o valor int
|
|
69
|
+
end
|
|
70
|
+
h
|
|
71
|
+
h.to_json
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def to_json(*options)
|
|
75
|
+
as_json(*options).to_json(*options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def dataHoraNascimento=(value)
|
|
79
|
+
@dataHoraNascimento=value.iso8601(3)
|
|
80
|
+
end
|
|
81
|
+
def dataSolicitacao=(value)
|
|
82
|
+
@dataSolicitacao=value.iso8601(3)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
module Gerint
|
|
3
|
+
|
|
4
|
+
class SolicitacaoInternacaoPsiquiatria < Gerint::SolicitacaoInternacao
|
|
5
|
+
attr_accessor :internacaoPsiquiatricaPrevia, :riscoHeteroagressao, :pacienteMotivado, :acompanhamentoPsiquiatricoAmbulatorial
|
|
6
|
+
attr_accessor :usoSubstanciaPsicoativa, :substanciasPsicoativas, :suporteFamiliar, :planoSuicida
|
|
7
|
+
attr_accessor :usoMedicamentoComorbidadesPsiquiatria, :medicamentoComorbidadePsiquiatria, :gravidaPsiquiatria
|
|
8
|
+
|
|
9
|
+
# :dataSolicitacao campo que tem na solicitacao de internação mas não tem para psiquiatria
|
|
10
|
+
|
|
11
|
+
def as_json_psiq(h)
|
|
12
|
+
h.store(:internacaoPsiquiatricaPrevia, @internacaoPsiquiatricaPrevia) unless @internacaoPsiquiatricaPrevia.nil?
|
|
13
|
+
h.store(:riscoHeteroagressao, @riscoHeteroagressao) unless @riscoHeteroagressao.nil?
|
|
14
|
+
h.store(:pacienteMotivado, @pacienteMotivado) unless @pacienteMotivado.nil?
|
|
15
|
+
h.store(:acompanhamentoPsiquiatricoAmbulatorial, @acompanhamentoPsiquiatricoAmbulatorial) unless @acompanhamentoPsiquiatricoAmbulatorial.nil?
|
|
16
|
+
h.store(:usoSubstanciaPsicoativa, @usoSubstanciaPsicoativa) unless @usoSubstanciaPsicoativa.nil?
|
|
17
|
+
h.store(:substanciasPsicoativas, @substanciasPsicoativas) unless @substanciasPsicoativas.nil?
|
|
18
|
+
h.store(:suporteFamiliar, @suporteFamiliar) unless @suporteFamiliar.nil?
|
|
19
|
+
h.store(:planoSuicida, @planoSuicida) unless @planoSuicida.nil?
|
|
20
|
+
h.store(:usoMedicamentoComorbidadesPsiquiatria, @usoMedicamentoComorbidadesPsiquiatria) unless @usoMedicamentoComorbidadesPsiquiatria.nil?
|
|
21
|
+
h.store(:medicamentoComorbidadePsiquiatria, @medicamentoComorbidadePsiquiatria) unless @medicamentoComorbidadePsiquiatria.nil?
|
|
22
|
+
h.store(:gravidaPsiquiatria, @gravidaPsiquiatria) unless @gravidaPsiquiatria.nil?
|
|
23
|
+
h
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def all_json # Gera hash com todas as variaveis de instancia
|
|
27
|
+
vinstancia = self.instance_variables
|
|
28
|
+
h = {}
|
|
29
|
+
vinstancia.each do |v|
|
|
30
|
+
h.store(v[1..50], "#{v}") # BUG: v contem o nome da variavel e não o valor int
|
|
31
|
+
end
|
|
32
|
+
h
|
|
33
|
+
h.to_json
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_json(*options)
|
|
37
|
+
h = as_json(*options)
|
|
38
|
+
as_json_psiq(h).to_json(*options)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def dataHoraNascimento=(value)
|
|
42
|
+
@dataHoraNascimento=value.iso8601(3)
|
|
43
|
+
end
|
|
44
|
+
def dataSolicitacao=(value)
|
|
45
|
+
@dataSolicitacao=value.iso8601(3)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
module Gerint
|
|
3
|
+
|
|
4
|
+
class TransferirLeito < Gerint::Padrao
|
|
5
|
+
attr_accessor :protocoloSolicitacao, :identificacaoLeito, :codTipoLeito, :justifTransferencia, :leitoExtra
|
|
6
|
+
|
|
7
|
+
def as_json(options={})
|
|
8
|
+
h = {
|
|
9
|
+
protocoloSolicitacao: @protocoloSolicitacao,
|
|
10
|
+
identificacaoLeito: @identificacaoLeito,
|
|
11
|
+
codTipoLeito: @codTipoLeito,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
h.store(:justifTransferencia , @justifTransferencia) unless @justifTransferencia.nil?
|
|
15
|
+
h.store(:leitoExtra, @leitoExtra) unless @leitoExtra.nil?
|
|
16
|
+
h
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def all_json # Gera hash com todas as variaveis de instancia
|
|
20
|
+
vinstancia = self.instance_variables
|
|
21
|
+
h = {}
|
|
22
|
+
vinstancia.each do |v|
|
|
23
|
+
h.store(v[1..50], "#{v}") # BUG: v contem o nome da variavel e não o valor int
|
|
24
|
+
end
|
|
25
|
+
h
|
|
26
|
+
h.to_json
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_json(*options)
|
|
30
|
+
as_json(*options).to_json(*options)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
metadata
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gerint
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nelson Coelho
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description: Integração com GERINT, regulação de leitos de Porto Alegre.
|
|
56
|
+
email:
|
|
57
|
+
- nelson@inovadora.com.br
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- ".rspec"
|
|
64
|
+
- ".travis.yml"
|
|
65
|
+
- CODE_OF_CONDUCT.md
|
|
66
|
+
- Gemfile
|
|
67
|
+
- LICENSE.txt
|
|
68
|
+
- README.md
|
|
69
|
+
- Rakefile
|
|
70
|
+
- bin/console
|
|
71
|
+
- bin/setup
|
|
72
|
+
- gerint.gemspec
|
|
73
|
+
- lib/gerint.rb
|
|
74
|
+
- lib/gerint/comunicacao/comunicacao.rb
|
|
75
|
+
- lib/gerint/servicos/alta.rb
|
|
76
|
+
- lib/gerint/servicos/internacao.rb
|
|
77
|
+
- lib/gerint/servicos/padrao.rb
|
|
78
|
+
- lib/gerint/servicos/solicitacao_internacao.rb
|
|
79
|
+
- lib/gerint/servicos/solicitacao_internacao_psiquiatria.rb
|
|
80
|
+
- lib/gerint/servicos/transferir_leito.rb
|
|
81
|
+
- lib/gerint/version.rb
|
|
82
|
+
homepage: http://www.inovadora.com.br.
|
|
83
|
+
licenses:
|
|
84
|
+
- MIT
|
|
85
|
+
metadata: {}
|
|
86
|
+
post_install_message:
|
|
87
|
+
rdoc_options: []
|
|
88
|
+
require_paths:
|
|
89
|
+
- lib
|
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - ">="
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '0'
|
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '0'
|
|
100
|
+
requirements: []
|
|
101
|
+
rubygems_version: 3.1.2
|
|
102
|
+
signing_key:
|
|
103
|
+
specification_version: 4
|
|
104
|
+
summary: Integração com GERINT.
|
|
105
|
+
test_files: []
|