Nova alteração no formulario do paciente
This commit is contained in:
parent
34826df314
commit
954a97acb8
13
package-lock.json
generated
13
package-lock.json
generated
@ -25,6 +25,7 @@
|
||||
"react": "^18.2.0",
|
||||
"react-apexcharts": "^1.7.0",
|
||||
"react-bootstrap": "^2.10.10",
|
||||
"react-bootstrap-icons": "^1.11.6",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-flatpickr": "^4.0.11",
|
||||
"react-input-mask": "^2.0.4",
|
||||
@ -30401,6 +30402,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-bootstrap-icons": {
|
||||
"version": "1.11.6",
|
||||
"resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.11.6.tgz",
|
||||
"integrity": "sha512-ycXiyeSyzbS1C4+MlPTYe0riB+UlZ7LV7YZQYqlERV2cxDiKtntI0huHmP/3VVvzPt4tGxqK0K+Y6g7We3U6tQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prop-types": "^15.7.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dev-utils": {
|
||||
"version": "12.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
"react": "^18.2.0",
|
||||
"react-apexcharts": "^1.7.0",
|
||||
"react-bootstrap": "^2.10.10",
|
||||
"react-bootstrap-icons": "^1.11.6",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-flatpickr": "^4.0.11",
|
||||
"react-input-mask": "^2.0.4",
|
||||
|
||||
@ -57,24 +57,47 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
estadoCivil: '',
|
||||
rnConvenio: false,
|
||||
|
||||
//CAMPOS: INFORMAÇÕES MÉDICAS
|
||||
// INFORMAÇÕES MÉDICAS
|
||||
tipoSanguineo: '',
|
||||
peso: '',
|
||||
altura: '',
|
||||
imc: '',
|
||||
alergias: '',
|
||||
|
||||
// CAMPOS: INFORMAÇÕES DE CONVÊNIO
|
||||
// INFORMAÇÕES DE CONVÊNIO
|
||||
convenio: '',
|
||||
plano: '',
|
||||
numeroMatricula: '',
|
||||
validadeCarteira: '',
|
||||
validadeIndeterminada: false,
|
||||
pacienteVip: false, // NOVO CAMPO ADICIONADO
|
||||
|
||||
// CAMPO: ANEXOS
|
||||
// ANEXO
|
||||
anexos: null,
|
||||
});
|
||||
|
||||
// Estado para armazenar a URL da foto do avatar
|
||||
const [avatarUrl, setAvatarUrl] = useState(null);
|
||||
|
||||
// Estado para controlar quais seções estão colapsadas
|
||||
const [collapsedSections, setCollapsedSections] = useState({
|
||||
dadosPessoais: true, // Alterado para true para a seção ficar aberta por padrão
|
||||
infoMedicas: false,
|
||||
infoConvenio: false,
|
||||
endereco: false,
|
||||
contato: false,
|
||||
infoAdicionais: false,
|
||||
anexos: false,
|
||||
});
|
||||
|
||||
// Função para alternar o estado de colapso de uma seção
|
||||
const handleToggleCollapse = (section) => {
|
||||
setCollapsedSections(prevState => ({
|
||||
...prevState,
|
||||
[section]: !prevState[section]
|
||||
}));
|
||||
};
|
||||
|
||||
// Lógica para calcular o IMC
|
||||
useEffect(() => {
|
||||
const peso = parseFloat(formData.peso);
|
||||
@ -95,6 +118,18 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
setFormData({ ...formData, [name]: checked });
|
||||
} else if (type === 'file') {
|
||||
setFormData({ ...formData, [name]: files[0] });
|
||||
|
||||
// Lógica para pré-visualizar a imagem no avatar
|
||||
if (name === 'foto' && files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => {
|
||||
setAvatarUrl(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(files[0]);
|
||||
} else if (name === 'foto' && !files[0]) {
|
||||
setAvatarUrl(null); // Limpa o avatar se nenhum arquivo for selecionado
|
||||
}
|
||||
|
||||
} else {
|
||||
setFormData({ ...formData, [name]: value });
|
||||
}
|
||||
@ -167,6 +202,7 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
numeroMatricula: formData.numeroMatricula,
|
||||
validadeCarteira: formData.validadeCarteira,
|
||||
validadeIndeterminada: formData.validadeIndeterminada,
|
||||
pacienteVip: formData.pacienteVip, // Adicionando o novo campo
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -175,15 +211,59 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
<div className="card p-3">
|
||||
<h3 className="mb-3 text-center">MedicoConnect</h3>
|
||||
|
||||
{/* ------------------ DADOS PESSOAIS ------------------ */}
|
||||
<h5 className="mb-3">Dados Pessoais</h5>
|
||||
<div className="row">
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Foto:</label>
|
||||
<input type="file" className="form-control" name="foto" onChange={handleChange} />
|
||||
{/* DADOS PESSOAIS */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('dadosPessoais')}>
|
||||
Dados Pessoais
|
||||
<span className="fs-5">
|
||||
{collapsedSections.dadosPessoais ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.dadosPessoais ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
{/* AVATAR E INPUT DE FOTO */}
|
||||
<div className="col-md-6 mb-3 d-flex align-items-center">
|
||||
<div className="me-3">
|
||||
{avatarUrl ? (
|
||||
<img
|
||||
src={avatarUrl}
|
||||
alt="Avatar do Paciente"
|
||||
style={{ width: '80px', height: '80px', borderRadius: '50%', objectFit: 'cover' }}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
style={{
|
||||
width: '80px',
|
||||
height: '80px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor: '#e0e0e0',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
fontSize: '3rem',
|
||||
color: '#9e9e9e'
|
||||
}}
|
||||
>
|
||||
☤
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="foto-input" className="btn btn-primary">Carregar Foto</label>
|
||||
<input
|
||||
type="file"
|
||||
className="form-control d-none"
|
||||
name="foto"
|
||||
id="foto-input"
|
||||
onChange={handleChange}
|
||||
accept="image/*"
|
||||
/>
|
||||
{formData.foto && <span className="ms-2">{formData.foto.name}</span>}
|
||||
</div>
|
||||
</div>
|
||||
{/* CADASTRO */}
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Nome:</label>
|
||||
<label>Nome: *</label>
|
||||
<input type="text" className="form-control" name="nome" value={formData.nome} onChange={handleChange} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
@ -191,11 +271,11 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
<input type="text" className="form-control" name="nomeSocial" value={formData.nomeSocial} onChange={handleChange} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Data de nascimento:</label>
|
||||
<label>Data de nascimento: *</label>
|
||||
<input type="date" className="form-control" name="dataNascimento" value={formData.dataNascimento} onChange={handleChange} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Gênero:</label>
|
||||
<label>Gênero: *</label>
|
||||
<select className="form-control" name="genero" value={formData.genero} onChange={handleChange}>
|
||||
<option value="">Selecione</option>
|
||||
<option value="Masculino">Masculino</option>
|
||||
@ -204,7 +284,7 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>CPF:</label>
|
||||
<label>CPF: *</label>
|
||||
<input type="text" className="form-control" name="cpf" value={formData.cpf} onChange={ handleChange} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
@ -297,10 +377,19 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ------------------ INFORMAÇÕES MÉDICAS ------------------ */}
|
||||
<h5 className="mt-3">Informações Médicas</h5>
|
||||
<div className="row">
|
||||
{/* INFORMAÇÕES MÉDICAS */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('infoMedicas')}>
|
||||
Informações Médicas
|
||||
<span className="fs-5">
|
||||
{collapsedSections.infoMedicas ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.infoMedicas ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Tipo Sanguíneo:</label>
|
||||
<select className="form-control" name="tipoSanguineo" value={formData.tipoSanguineo} onChange={handleChange}>
|
||||
@ -332,10 +421,19 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
<textarea className="form-control" name="alergias" value={formData.alergias} onChange={handleChange} placeholder="Ex: AAS, Dipirona, etc"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ------------------ INFORMAÇÕES DE CONVÊNIO ------------------ */}
|
||||
<h5 className="mt-3">Informações de convênio</h5>
|
||||
<div className="row">
|
||||
{/* INFORMAÇÕES DE CONVÊNIO */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('infoConvenio')}>
|
||||
Informações de convênio
|
||||
<span className="fs-5">
|
||||
{collapsedSections.infoConvenio ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.infoConvenio ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Convênio:</label>
|
||||
<select className="form-control" name="convenio" value={formData.convenio} onChange={handleChange}>
|
||||
@ -366,11 +464,29 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{/* NOVO CAMPO: PACIENTE VIP */}
|
||||
<div className="col-md-12 mb-3 mt-3">
|
||||
<div className="form-check">
|
||||
<input className="form-check-input" type="checkbox" name="pacienteVip" checked={formData.pacienteVip} onChange={handleChange} id="pacienteVip" />
|
||||
<label className="form-check-label" htmlFor="pacienteVip">
|
||||
Paciente VIP
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ------------------ ENDEREÇO ------------------ */}
|
||||
<h5>Endereço</h5>
|
||||
<div className="row">
|
||||
{/* ENDEREÇO */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('endereco')}>
|
||||
Endereço
|
||||
<span className="fs-5">
|
||||
{collapsedSections.endereco ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.endereco ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
<div className="col-md-4 mb-3">
|
||||
<label>CEP:</label>
|
||||
<input type="text" className="form-control" name="cep" value={formData.cep} onChange={handleChange} onBlur={handleCepBlur} />
|
||||
@ -400,16 +516,25 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
<input type="text" className="form-control" name="complemento" value={formData.complemento} onChange={handleChange} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ------------------ CONTATO ------------------ */}
|
||||
<h5>Contato</h5>
|
||||
<div className="row">
|
||||
{/* CONTATO */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('contato')}>
|
||||
Contato
|
||||
<span className="fs-5">
|
||||
{collapsedSections.contato ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.contato ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Email:</label>
|
||||
<label>Email: *</label>
|
||||
<input type="email" className="form-control" name="email" value={formData.email} onChange={handleChange} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
<label>Telefone:</label>
|
||||
<label>Telefone: *</label>
|
||||
<input type="text" className="form-control" name="telefone1" value={formData.telefone1} onChange={handleChange} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
@ -421,21 +546,45 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
<input type="text" className="form-control" name="telefone3" value={formData.telefone3} onChange={handleChange} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ------------------ INFORMAÇÕES ADICIONAIS ------------------ */}
|
||||
<h5 className="mt-3">Informações Adicionais</h5>
|
||||
{/* INFORMAÇÕES ADICIONAIS */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('infoAdicionais')}>
|
||||
Informações Adicionais
|
||||
<span className="fs-5">
|
||||
{collapsedSections.infoAdicionais ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.infoAdicionais ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
<div className="mb-3">
|
||||
<label>Observações:</label>
|
||||
<textarea className="form-control" name="observacoes" value={formData.observacoes} onChange={handleChange}></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ------------------ ANEXOS DO PACIENTE ------------------ */}
|
||||
<h5 className="mt-3">Anexos do Paciente</h5>
|
||||
{/* ANEXOS DO PACIENTE */}
|
||||
<div className="mb-3">
|
||||
<h5 className="mb-0 cursor-pointer d-flex justify-content-between align-items-center" onClick={() => handleToggleCollapse('anexos')}>
|
||||
Anexos do Paciente
|
||||
<span className="fs-5">
|
||||
{collapsedSections.anexos ? '▲' : '▼'}
|
||||
</span>
|
||||
</h5>
|
||||
<div className={`collapse${collapsedSections.anexos ? ' show' : ''}`}>
|
||||
<div className="row mt-3">
|
||||
<div className="mb-3">
|
||||
<label htmlFor="anexos-input" className="btn btn-secondary">Escolher arquivo</label>
|
||||
<input type="file" className="form-control d-none" name="anexos" id="anexos-input" onChange={handleChange} />
|
||||
<span className="ms-2">{formData.anexos ? formData.anexos.name : 'Nenhum arquivo escolhido'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Botões */}
|
||||
<div className="mt-3">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user