-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Estrutura form definida para app pacientes
- Loading branch information
1 parent
2f6547d
commit 4ffedc8
Showing
7 changed files
with
222 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# <strong>Estados</strong> | ||
# <strong>Capitais</strong> | ||
# <strong>Siglas</strong> | ||
|
||
|
||
estados = [ | ||
{"AC": {1: {"Acre": [{1: ("Rio Branco", 0)}, {}]}}}, | ||
{"AL": ["Alagoas", "Maceió"]}, | ||
{"AP": ["Amapá", "Macapá"]}, | ||
{"AM": ["Amazonas", "Manaus"]}, | ||
{"BA": ["Bahia", "Salvador"]}, | ||
{"CE": ["Ceará", "Fortaleza"]}, | ||
{"DF": ["Distrito Federal", "Brasília", (61,)]}, | ||
{"ES": ["Espírito Santo", "Vitória"]}, | ||
{"GO": ["Goiás", "Goiânia", (62, 64)]}, | ||
{"MA": ["Maranhão", "São Luís"]}, | ||
{"MT": ["Mato Grosso", "Cuiabá", (65, 66)]}, | ||
{"MS": ["Mato Grosso do Sul", "Campo Grande", (67,)]}, | ||
{"MG": ["Minas Gerais", "Belo Horizonte"]}, | ||
{"PA": ["Pará", "Belém"]}, | ||
{"PB": ["Paraíba", "João Pessoa"]}, | ||
{"PR": ["Paraná", "Curitiba"]}, | ||
{"PE": ["Pernambuco", "Recife"]}, | ||
{"PI": ["Piauí", "Teresina"]}, | ||
{"RJ": ["Rio de Janeiro", "Rio de Janeiro"]}, | ||
{"RN": ["Rio Grande do Norte", "Natal"]}, | ||
{"RS": ["Rio Grande do Sul", "Porto Alegre"]}, | ||
{"RO": ["Rondônia", "Porto Velho"]}, | ||
{"RR": ["Roraima", "Boa Vista"]}, | ||
{"SC": ["Santa Catarina", "Florianópolis"]}, | ||
{"SP": ["São Paulo", "São Paulo"]}, | ||
{"SE": ["Sergipe", "Aracaju"]}, | ||
{"TO": ["Tocantins", "Palmas"]}, | ||
] | ||
|
||
|
||
def listar_estados() -> list: | ||
return [] | ||
|
||
|
||
def listar_municipios() -> list: | ||
return [] | ||
|
||
|
||
def listar_ddd(municipio: str) -> list: | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,97 @@ | ||
from typing import Any | ||
from django import forms | ||
from .models import Paciente | ||
from django.core.validators import MinValueValidator, MaxValueValidator, RegexValidator | ||
|
||
|
||
class PacienteForm(forms.Form): | ||
class PacienteForm(forms.ModelForm): | ||
|
||
nome = forms.CharField(label="Nome", max_length=100) | ||
email = forms.CharField(label="Email", max_length=100) | ||
telefone = forms.CharField(label="Telefone", max_length=100) | ||
dataNascimento = forms.CharField(label="Data Nascimento", max_length=100) | ||
estadoCivil = forms.CharField(label="Estado Civil", max_length=100) | ||
genero = forms.CharField(label="Genero", max_length=100) | ||
bairro = forms.CharField(label="Bairro", max_length=100) | ||
uf = forms.CharField(label="UF", max_length=100) | ||
municipio = forms.CharField(label="Município", max_length=100) | ||
nascionalidade = forms.CharField(label="Nascionalidade", max_length=100) | ||
class Genero(models.IntegerChoices): | ||
FEMININO = 1 | ||
MASCULINO = 2 | ||
OUTROS = 3 | ||
|
||
nome = ( | ||
forms.CharField( | ||
validators=[ | ||
MinValueValidator( | ||
3, "Limite mínimo de 3 caracteres permitido para campo Nome" | ||
), | ||
MaxValueValidator( | ||
30, | ||
message="Limite máximo de 30 caracteres permitido para campo Nome", | ||
), | ||
RegexValidator( | ||
regex=r"[^a-zA-Z_-\\s]+", | ||
message="Informe apenas texto para campo Nome", | ||
), | ||
], | ||
required=True, | ||
max_length=30, | ||
widget=forms.TextInput( | ||
attrs={ | ||
"placeholder": "Nome", | ||
"class": "form-text-input", | ||
"name": "name", | ||
"id": "nome", | ||
} | ||
), | ||
), | ||
) | ||
|
||
sobre_nome = ( | ||
forms.CharField( | ||
validators=[ | ||
MinValueValidator( | ||
3, "Limite mínimo de 3 caracteres permitido para 'Sobre nome'" | ||
), | ||
MaxValueValidator( | ||
60, | ||
message="Limite máximo de 30 caracteres permitido para campo 'Sobre nome'", | ||
), | ||
RegexValidator( | ||
regex=r"[^a-zA-Z_-\\s]+", | ||
message="Informe apenas texto para campo Sobre 'Sobre nome'", | ||
), | ||
], | ||
required=True, | ||
widget=forms.TextInput( | ||
attrs={ | ||
"placeholder": "Sobre nome", | ||
"class": "form-text-input", | ||
"name": "sobreNome", | ||
"id": "sobreNome", | ||
} | ||
), | ||
), | ||
) | ||
|
||
genero = forms.ChoiceField(choices=Genero, widget=forms.RadioSelect()) | ||
|
||
def clean(self): | ||
|
||
super(PacienteForm, self).clean() | ||
|
||
class Meta: | ||
model = Paciente | ||
fields = ( | ||
"nome", | ||
"email", | ||
"telefone", | ||
"dataNascimento", | ||
"genero", | ||
"bairro", | ||
"numero", | ||
"complemento", | ||
"ponto_de_refencia", | ||
) | ||
|
||
# nome = forms.CharField(label="Nome", max_length=100) | ||
# email = forms.CharField(label="Email", max_length=100) | ||
# telefone = forms.CharField(label="Telefone", max_length=100) | ||
# dataNascimento = forms.CharField(label="Data Nascimento", max_length=100) | ||
# genero = forms.CharField(label="Genero", max_length=100) | ||
# bairro = forms.CharField(label="Bairro", max_length=100) | ||
# numero = forms.CharField(label="Número", max_length=100) | ||
# complemento = forms.CharField(label="Complemento", max_length=100) | ||
# ponto_de_refencia = forms.CharField(label="Ponto de refencia", max_length=100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
from enum import IntEnum | ||
from django.db import models | ||
|
||
# Create your models here. | ||
|
||
class Paciente(models.Model): | ||
|
||
class Status(models.IntegerChoices): | ||
ATIVO = 1 | ||
INATIVO = 2 | ||
|
||
nome = models.CharField(max_length=30) | ||
sobre_nome = models.CharField(max_length=60) | ||
data_de_nascimento = models.DateTimeField() | ||
genero = models.IntegerField() | ||
cartao_sus = models.CharField(max_length=15, unique=True) | ||
telefone = models.CharField(max_length=14) | ||
rua = models.CharField(max_length=60) | ||
numero = models.IntegerField() | ||
complemento = models.CharField(max_length=60) | ||
ponto_referencia = models.CharField(max_length=50) | ||
|
||
status = models.IntegerField(default=Status.ATIVO) | ||
|
||
data_criacao = models.DateTimeField() | ||
data_alteracao = models.DateTimeField() | ||
|
||
def __str__(self): | ||
return f"{self.nome} {self.sobre_nome}" | ||
|
||
class Meta: | ||
db_table = "pacientes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,19 @@ | ||
{% extends "base.html" %} | ||
{% block title %} | ||
Cadastro Paciente | ||
Cadastro Paciente | ||
{% endblock title %} | ||
{% block content %} | ||
<div class="form"> | ||
|
||
<form action="{% url 'cadastra_paciente' %}" method="POST"> | ||
<form class="form" action="{% url 'cadastra_paciente' %}" method="post"> | ||
{% csrf_token %} | ||
|
||
<div class="form-header"> | ||
<div class="title"> | ||
<h1>Novo Paciente</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="input-group"> | ||
<div class="input-box"> | ||
<label for="nome">Primeiro Nome</label> | ||
<input id="nome" type="text" name="nome" placeholder="Digite seu primeiro nome" required=""> | ||
</div> | ||
|
||
<div class="input-box"> | ||
<label for="sobreNome">Sobrenome</label> | ||
<input id="sobreNome" type="text" name="sobreNome" placeholder="Digite seu sobrenome" required=""> | ||
</div> | ||
<div class="input-box"> | ||
<label for="email">SUS</label> | ||
<input id="email" type="text" name="email" placeholder="Digite seu SUS" required=""> | ||
</div> | ||
|
||
<div class="input-box"> | ||
<label for="telefone">Telefone</label> | ||
<input id="telefone" type="tel" name="telefone" placeholder="(xx) xxxx-xxxx" required=""> | ||
</div> | ||
|
||
<div class="input-box"> | ||
<label for="senha">Endereço</label> | ||
<input id="senha" type="password" name="senha" placeholder="Digite seu Endereço" required=""> | ||
</div> | ||
|
||
|
||
<div class="input-box"> | ||
<label for="confirmaSenha">Data do transporte</label> | ||
<input id="confirmaSenha" type="password" name="confirmaSenha" placeholder="Data do transporte" | ||
required=""> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="gender-inputs"> | ||
<div class="gender-title"> | ||
<h6>Gênero</h6> | ||
</div> | ||
|
||
<div class="gender-group"> | ||
<div class="gender-input"> | ||
<input id="feminimo" type="radio" name="genero"> | ||
<label for="feminimo">Feminino</label> | ||
</div> | ||
|
||
<div class="gender-input"> | ||
<input id="masculino" type="radio" name="genero"> | ||
<label for="masculino">Masculino</label> | ||
</div> | ||
|
||
<div class="gender-input"> | ||
<input id="outro" type="radio" name="genero"> | ||
<label for="outro">Outros</label> | ||
</div> | ||
|
||
<div class="gender-input"> | ||
<input id="semGenero" type="radio" name="genero"> | ||
<label for="semGenero">Prefiro não dizer</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% if status == '1' %}<div class="message-success">{{ message }}</div>{% endif %} | ||
{{ form.as_p }} | ||
<div class="continue-button"> | ||
<button type="submit">Confirmar</button> | ||
</div> | ||
</form> | ||
</div> | ||
{% endblock content %} | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters