895 lines
37 KiB
Dart
895 lines
37 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:line_icons/line_icons.dart';
|
|
import '../../config/color_palette.dart';
|
|
import '../../config/const_variable.dart';
|
|
import '../../models/check_model.dart';
|
|
import '../../service/db/db_querys.dart';
|
|
import '../../service/db/db_sqlite_load.dart';
|
|
import '../../service/db/db_sqlite_sync.dart';
|
|
import '../../service/shared_preferences/shared_preferences_service.dart';
|
|
import '../../widgets/alert_dialog_default.dart';
|
|
import '../../widgets/appbar_default.dart';
|
|
import '../../widgets/button_default.dart';
|
|
import '../../widgets/check_box_subtitle.dart';
|
|
import '../../widgets/check_box_two_subtitle.dart';
|
|
import '../../widgets/dropdown_with_subtitle.dart';
|
|
import '../../widgets/error_default.dart';
|
|
import '../../widgets/input_with_subtitle.dart';
|
|
import '../../widgets/onbackbutton.dart';
|
|
import '../../widgets/switch_with_subtitle.dart';
|
|
import '../../widgets/text_default.dart';
|
|
import '../../widgets/title_containers.dart';
|
|
|
|
class HomeVisitScreen extends StatefulWidget {
|
|
String name;
|
|
HomeVisitScreen({required this.name});
|
|
|
|
@override
|
|
State<HomeVisitScreen> createState() => _HomeVisitScreenState();
|
|
}
|
|
|
|
class _HomeVisitScreenState extends State<HomeVisitScreen> {
|
|
|
|
var PESO = TextEditingController();
|
|
var ALTURA = TextEditingController();
|
|
var NOME_PROFISSIONAL = TextEditingController();
|
|
var CNES_UNIDADE = TextEditingController();
|
|
var COMPLEMENTO = TextEditingController();
|
|
|
|
bool CNS_VALIDO = false;
|
|
bool showCheckError = false;
|
|
bool mandatory = false;
|
|
|
|
bool VISITA_ACOMPANHADA = false;
|
|
bool CONSULTA = false;
|
|
bool VACINA = false;
|
|
bool EXAME = false;
|
|
bool CONDICIONALIDADES = false;
|
|
bool ACAO_EDUCATIVA = false;
|
|
bool ACAO_MECANICA = false;
|
|
bool IMOVEL_FOCO = false;
|
|
bool TRATAMENTO_FOCAL = false;
|
|
|
|
String? TURNO;
|
|
String? TIPO_IMOVEL;
|
|
String? DESFECHO;
|
|
String? CBO_PROFISSIONAL;
|
|
String? INE_RESP_CADASTRO;
|
|
|
|
int TURNO_COD = 0;
|
|
int TIPO_IMOVEL_COD = 0;
|
|
int DESFECHO_COD = 0;
|
|
int ID_PROFISSIONAL=0;
|
|
int ID_CIDADAO=0;
|
|
int ID_EQUIPE=0;
|
|
|
|
String INE_PROFISSIONAL='';
|
|
String CD_USUARIO_SUS='';
|
|
String idUnidade = '';
|
|
int idUsuario = 0;
|
|
String date = '';
|
|
String dateDB = '';
|
|
List <String> typeTurnService = [];
|
|
List <String> listTypeHome = [];
|
|
List <String> listDesfecho = [];
|
|
List <String>listCBO = [];
|
|
List <String>listINEPROF = [];
|
|
List<String> PROCEDIMENTOS_SIGTAP = [];
|
|
List<CheckModel> tipoVisitaModel = [];
|
|
List<CheckModel> tipoAcompanhamentoModel = [];
|
|
List<CheckModel> outrosModel = [];
|
|
List listProc = [];
|
|
|
|
escolherprazoInicio(BuildContext context) async {
|
|
var pickDate = await showDatePicker(
|
|
context: context,
|
|
initialDate: DateTime.now(),
|
|
firstDate: DateTime(2022),
|
|
lastDate: DateTime(2025));
|
|
if (pickDate != null) {
|
|
setState(() {
|
|
dateDB = '${pickDate.year}-${pickDate.month<10?'0':''}${pickDate.month}-${pickDate.day<10?'0':''}${pickDate.day}';
|
|
date = formatData(year: pickDate.year, month: pickDate.month, day: pickDate.day);
|
|
});
|
|
}
|
|
}
|
|
|
|
String formatData({int? year, int? month, int? day}) {
|
|
DateTime data = DateTime(year!, month!, day!);
|
|
String formattedDate = DateFormat('dd/MM/yyyy').format(data);
|
|
return formattedDate;
|
|
}
|
|
|
|
getUsers()async{
|
|
await DBQuerys().buscaCidadao(widget.name).then((list){
|
|
ID_CIDADAO = list[0]['ID_CIDADAO'];
|
|
CD_USUARIO_SUS = list[0]['CD_USUARIO_SUS'];
|
|
});
|
|
final PrefService _prefService = PrefService();
|
|
_prefService.readCacheIdUsername('idUsuario').then((value){
|
|
if(value != null){
|
|
idUsuario = value;
|
|
loadData();
|
|
}
|
|
});
|
|
_prefService.readCacheUnidade().then((value){
|
|
if(value!=null){
|
|
idUnidade = value[0];
|
|
CNES_UNIDADE.text = value[1];
|
|
}
|
|
});
|
|
await DBQuerys().buscaCBOProfissional(idUsuario).then((list){
|
|
if(list.length!=0){
|
|
for(int i = 0; list.length>i;i++){
|
|
listCBO.add(list[i]['CODIGO_CBO'].toString());
|
|
}
|
|
}
|
|
setState(() {});
|
|
});
|
|
List list = await DBQuerys().buscaDadosProfissional(idUnidade,idUsuario);
|
|
for(int i=0; list.length > i;i++){
|
|
INE_RESP_CADASTRO = 'INE: ${list[i]['INE']} / Área: ${list[i]['AREA']} - Microárea : ${list[i]['MICROAREA']}';
|
|
listINEPROF.add('INE: ${list[i]['INE']} / Área: ${list[i]['AREA']} - Microárea : ${list[i]['MICROAREA']}');
|
|
}
|
|
var db = await DbSqliteLoad().intialDB();
|
|
List listSIGTAP = await db.query('PROCEDIMENTOS_SIGTAP');
|
|
for(int i = 0; listSIGTAP.length>i;i++){
|
|
if(listSIGTAP[i]['COD_PROC_SIGTAP']!=null && listSIGTAP[i]['DESC_PROC_SIGTAP']!=null){
|
|
PROCEDIMENTOS_SIGTAP.add('${listSIGTAP[i]['COD_PROC_SIGTAP']} - ${listSIGTAP[i]['DESC_PROC_SIGTAP']}');
|
|
}
|
|
}
|
|
List listProf = await DBQuerys().buscaDadosProfissional(idUnidade,idUsuario);
|
|
INE_PROFISSIONAL = listProf[0]['INE'];
|
|
ID_EQUIPE = listProf[0]['ID_EQUIPE'];
|
|
setState(() {});
|
|
}
|
|
|
|
loadLists() {
|
|
for (int i = 0; ConstVariable().typeTurnService.length > i; i++) {
|
|
typeTurnService.add(ConstVariable().typeTurnService[i].title);
|
|
}
|
|
for (int i = 0; ConstVariable().listTypeHome.length > i; i++) {
|
|
listTypeHome.add(ConstVariable().listTypeHome[i].title);
|
|
}
|
|
for (int i = 0; ConstVariable().listDesfecho.length > i; i++) {
|
|
listDesfecho.add(ConstVariable().listDesfecho[i].title);
|
|
}
|
|
getUsers();
|
|
}
|
|
|
|
loadData()async{
|
|
print('idUsuario');
|
|
print(idUsuario);
|
|
await DBQuerys().buscaProfissionalCadInd(idUsuario).then((list){
|
|
ID_PROFISSIONAL = list['ID_PROFISSIONAL'];
|
|
NOME_PROFISSIONAL.text = list['NOME_PROFISSIONAL'];
|
|
String CNS_PROFISSIONAL = list['CNS_PROFISSIONAL'];
|
|
if(CNS_PROFISSIONAL == 999999999999999 || CNS_PROFISSIONAL == '999999999999999'){
|
|
CNS_VALIDO = true;
|
|
}
|
|
setState(() {});
|
|
});
|
|
}
|
|
|
|
checkSave()async{
|
|
// adicionar depois e usar um usuário real
|
|
// CBO_RESP_CADASTRO
|
|
//ok
|
|
if(date.isEmpty || dateDB.isEmpty || TIPO_IMOVEL_COD==0 || DESFECHO_COD ==0 || TURNO_COD == 0
|
|
){
|
|
print('erro');
|
|
setState(() {
|
|
showCheckError = true;
|
|
mandatory = true;
|
|
});
|
|
}else{
|
|
print('passou');
|
|
setState(() {
|
|
mandatory = false;
|
|
showCheckError = false;
|
|
//TIPO VISITA
|
|
if(tipoVisitaModel[0].check || tipoVisitaModel[1].check){
|
|
//BUSCA ATIVA
|
|
if(CONSULTA || VACINA || EXAME || CONDICIONALIDADES){
|
|
//CONTROLE AMBIENTAL
|
|
if(ACAO_EDUCATIVA || ACAO_MECANICA || IMOVEL_FOCO || TRATAMENTO_FOCAL){
|
|
bool check1 = false;
|
|
bool check2 = false;
|
|
for(int i=0; tipoAcompanhamentoModel.length>i;i++){
|
|
if(tipoAcompanhamentoModel[i].check){
|
|
print('pegou a $i');
|
|
check1 = true;
|
|
break;
|
|
}
|
|
}
|
|
for(int i=0; outrosModel.length>i;i++){
|
|
if(outrosModel[i].check){
|
|
print('outros $i');
|
|
check2 = true;
|
|
break;
|
|
}
|
|
}
|
|
if(!check1 || !check2){
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'É obrigatória a seleção de pelo menos uma opção dentre os campos Tipo da Visita, Busca ativa, Controle Ambiental, Acompanhamento e Outros.',
|
|
'OK'
|
|
);
|
|
}
|
|
if(check1 && check2){
|
|
print('save');
|
|
saveHomeVisit();
|
|
}
|
|
|
|
}else{
|
|
print('AQUI');
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'É obrigatória a seleção de pelo menos uma opção dentre os campos Tipo da Visita, Busca ativa, Controle Ambiental, Acompanhamento e Outros.',
|
|
'OK'
|
|
);
|
|
}
|
|
}else{
|
|
print('nesse');
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'É obrigatória a seleção de pelo menos uma opção dentre os campos Tipo da Visita, Busca ativa, Controle Ambiental, Acompanhamento e Outros.',
|
|
'OK'
|
|
);
|
|
}
|
|
}else{
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'É obrigatória a seleção de pelo menos uma opção dentre os campos Tipo da Visita, Busca ativa, Controle Ambiental, Acompanhamento e Outros.',
|
|
'OK'
|
|
);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
saveHomeVisit()async{
|
|
Map<String, dynamic> row = {
|
|
'ID_CIDADAO' : ID_CIDADAO,
|
|
'CD_USUARIO_SUS' : CD_USUARIO_SUS,
|
|
'DT_ATENDIMENTO' : dateDB,
|
|
'TURNO' : TURNO_COD,
|
|
'TIPO_IMOVEL' : TIPO_IMOVEL_COD,
|
|
'VISITA_ACOMPANHADA' : VISITA_ACOMPANHADA?1:2,
|
|
'DESFECHO' : DESFECHO_COD,
|
|
'PESO' : PESO.text,
|
|
'ALTURA' : ALTURA.text,
|
|
'ID_PROFISSIONAL' : idUsuario,
|
|
'CBO_PROFISSIONAL' : CBO_PROFISSIONAL,
|
|
'INE_PROFISSIONAL' : INE_PROFISSIONAL,
|
|
'CNES_UNIDADE' : CNES_UNIDADE.text,
|
|
'ID_UNIDADE' : int.parse(idUnidade),
|
|
'ID_EQUIPE' : ID_EQUIPE,
|
|
'COMPLEMENTO' : COMPLEMENTO.text,
|
|
'SINCRONIZADO' : 'N',
|
|
};
|
|
await DbSqliteSync().insertVisitaDomiciliar(row).then((value)async{
|
|
print('value');
|
|
print(value);
|
|
//tipo visita == 1
|
|
for(int i = 0;tipoVisitaModel.length>i;i++){
|
|
if(tipoVisitaModel[i].check){
|
|
//cadastramento = 1
|
|
if(i==0){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,1,1);
|
|
}else if(i == 1){
|
|
//periodica = 29
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,1,29);
|
|
}
|
|
}
|
|
}
|
|
//busca ativa == 2
|
|
//CONSULTA 2
|
|
if(CONSULTA){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,2,2);
|
|
}
|
|
//busca ativa == 2
|
|
//EXAME 3
|
|
if(EXAME){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,2,3);
|
|
}
|
|
//busca ativa == 2
|
|
//VACINA 8
|
|
if(VACINA){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,2,8);
|
|
}
|
|
//busca ativa == 2
|
|
//CONDICIONALIDADES 30
|
|
if(CONDICIONALIDADES){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,2,30);
|
|
}
|
|
//controle ambiental == 5
|
|
// ACAO_EDUCATIVA == 34
|
|
if(ACAO_EDUCATIVA){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,5,34);
|
|
}
|
|
//controle ambiental == 5
|
|
// IMOVEL_FOCO == 35
|
|
if(IMOVEL_FOCO){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,5,35);
|
|
}
|
|
//controle ambiental == 5
|
|
// ACAO_MECANICA == 36
|
|
if(ACAO_MECANICA){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,5,36);
|
|
}
|
|
//controle ambiental == 5
|
|
// TRATAMENTO_FOCAL == 37
|
|
if(TRATAMENTO_FOCAL){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,5,37);
|
|
}
|
|
|
|
//ACOMPANHAMENTO == 3
|
|
for(int i=0; tipoAcompanhamentoModel.length>i;i++){
|
|
if(tipoAcompanhamentoModel[i].check){
|
|
print('pegou a $i');
|
|
print(tipoAcompanhamentoModel[i].subtitle);
|
|
if(i<=13){
|
|
print('CODIGO ${i+5}');
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,3,i+5);
|
|
}else if(i==14){
|
|
//respiratorios == 32
|
|
print('CODIGO ${i}');
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,3,32);
|
|
}else if(i==15){
|
|
print('CODIGO ${i}');
|
|
//tabagista == 33
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,3,33);
|
|
}else if(i>=16){
|
|
print('CODIGO ${i+3}');
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,3,i+3);
|
|
}
|
|
}
|
|
}
|
|
//outros == 4
|
|
for(int i=0; outrosModel.length>i;i++){
|
|
if(outrosModel[i].check){
|
|
print('outros a $i');
|
|
print(outrosModel[i].subtitle);
|
|
//orientacao prevencao == 31
|
|
if(i==3){
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,4,31);
|
|
}else if(i==4){
|
|
print('CODIGO outros ${i+24}');
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,4,i+24);
|
|
}else{
|
|
print('CODIGO outros ${i+25}');
|
|
await DbSqliteSync().insertVisitaDomiciliarCOMPL(value,4,i+25);
|
|
}
|
|
}
|
|
}
|
|
for(int i=0;listProc.length>i;i++){
|
|
List splitted = listProc[i].toString().split(' ');
|
|
await DbSqliteSync().insertVISITAS_DOMICILIARES_PROC(value,splitted[0]);
|
|
}
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'Visita Domiciliar realizada com sucesso!',
|
|
'OK'
|
|
);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
loadLists();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
double heigth = MediaQuery.of(context).size.height;
|
|
double width = MediaQuery.of(context).size.width;
|
|
|
|
return WillPopScope(
|
|
onWillPop: ()async=> await OnBackButton().onBackButton(context),
|
|
child: Scaffold(
|
|
appBar: AppBarDefault().appbar(context, 'RKM AB - Visita Domiciliar'),
|
|
body: Container(
|
|
height: double.infinity,
|
|
width: double.infinity,
|
|
decoration: ConstVariable().backgroundGradient,
|
|
child: ListView(
|
|
children: [
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Atendimento'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.5,
|
|
width: width*0.2,
|
|
child: Icon(LineIcons.edit,size: 80,),
|
|
),
|
|
Column(
|
|
children: [
|
|
Container(
|
|
width: width*0.7,
|
|
child: TextDefault(
|
|
textAlign: TextAlign.start,
|
|
text: 'Data Atendimento',
|
|
color: ColorPalette.black54,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: ()=>escolherprazoInicio(context),
|
|
child: Container(
|
|
height: 50,
|
|
margin: EdgeInsets.symmetric(horizontal: 0),
|
|
padding: EdgeInsets.symmetric(horizontal: 8,vertical: 10),
|
|
decoration: BoxDecoration(
|
|
color: date.isEmpty?ColorPalette.disable:ColorPalette.white,
|
|
border: Border.all(color: ColorPalette.white),
|
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
|
),
|
|
width: width*0.7,
|
|
child: TextDefault(
|
|
text: date,
|
|
color: Colors.black,
|
|
fontSize: 15,
|
|
),
|
|
),
|
|
),
|
|
date.isEmpty&& mandatory?ErrorDefault():Container(),
|
|
DropdownWithSubtitle(
|
|
list: typeTurnService,
|
|
widthSubtitle: width*0.2,
|
|
subtitle: 'Turno',
|
|
hintDropdown: 'Turno',
|
|
select: TURNO,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
TURNO = value;
|
|
for(int i = 0;ConstVariable().typeTurnService.length >i;i++){
|
|
if(ConstVariable().typeTurnService[i].title == TURNO){
|
|
TURNO_COD = ConstVariable().typeTurnService[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
TURNO_COD ==0 && mandatory?ErrorDefault():Container(),
|
|
DropdownWithSubtitle(
|
|
list: listTypeHome,
|
|
widthSubtitle: width*0.2,
|
|
subtitle: 'Tipo de Imóvel',
|
|
hintDropdown: 'Tipo de Imovél',
|
|
select: TIPO_IMOVEL,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
TIPO_IMOVEL = value;
|
|
for(int i = 0;ConstVariable().listTypeHome.length >i;i++){
|
|
if(ConstVariable().listTypeHome[i].title == TIPO_IMOVEL){
|
|
TIPO_IMOVEL_COD = ConstVariable().listTypeHome[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
TIPO_IMOVEL_COD ==0 && mandatory?ErrorDefault():Container(),
|
|
SwitchWithSubtitle(
|
|
width: width*0.7,
|
|
title: 'Visita Acompanhada',
|
|
value: VISITA_ACOMPANHADA,
|
|
onChanged:(value){
|
|
VISITA_ACOMPANHADA = value;
|
|
setState(() {});
|
|
},
|
|
),
|
|
DropdownWithSubtitle(
|
|
list: listDesfecho,
|
|
widthSubtitle: width*0.2,
|
|
subtitle: 'Desfecho',
|
|
hintDropdown: 'Desfecho',
|
|
select: DESFECHO,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
DESFECHO = value;
|
|
for(int i = 0;ConstVariable().listDesfecho.length >i;i++){
|
|
if(ConstVariable().listDesfecho[i].title == DESFECHO){
|
|
DESFECHO_COD = ConstVariable().listDesfecho[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
DESFECHO_COD ==0 && mandatory?ErrorDefault():Container(),
|
|
TitleContainers(title: 'Tipo da Visita',width: width*0.7,textAling: TextAlign.start,fontSize: 15),
|
|
Container(
|
|
width: width*0.7,
|
|
height: heigth*0.1,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: ConstVariable().tipoVisitaModel.length,
|
|
itemBuilder: (context,index){
|
|
tipoVisitaModel.add(
|
|
CheckModel(
|
|
subtitle: ConstVariable().tipoVisitaModel[index],
|
|
check: false
|
|
)
|
|
);
|
|
return CheckBoxSubtitle(
|
|
subtitle: tipoVisitaModel[index].subtitle,
|
|
checkbox:tipoVisitaModel[index].check,
|
|
width: width*0.6,
|
|
onChanged: (value)=>setState(()=>tipoVisitaModel[index].check=value),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
TitleContainers(title: 'Busca Ativa',width: width*0.7,textAling: TextAlign.start,fontSize: 15),
|
|
CheckBoxTwoSubtitle(
|
|
width: width*0.7,
|
|
checkbox1: CONSULTA,
|
|
checkbox2: VACINA,
|
|
subtitle1: 'CONSULTA',
|
|
subtitle2: 'VACINA',
|
|
onChanged1: (value)=>setState(()=>CONSULTA=value),
|
|
onChanged2: (value)=>setState(()=>VACINA=value),
|
|
),
|
|
CheckBoxTwoSubtitle(
|
|
width: width*0.7,
|
|
checkbox1: EXAME,
|
|
checkbox2: CONDICIONALIDADES,
|
|
subtitle1: 'EXAME',
|
|
subtitle2: 'CONDICIONALIDADES',
|
|
onChanged1: (value)=>setState(()=>EXAME=value),
|
|
onChanged2: (value)=>setState(()=>CONDICIONALIDADES=value),
|
|
),
|
|
TitleContainers(title: 'Controle Ambiental',width: width*0.7,textAling: TextAlign.start,fontSize: 15),
|
|
CheckBoxTwoSubtitle(
|
|
width: width*0.7,
|
|
checkbox1: ACAO_EDUCATIVA,
|
|
checkbox2: ACAO_MECANICA,
|
|
subtitle1: 'AÇÃO EDUCATIVA',
|
|
subtitle2: 'AÇÃO MECÂNICA',
|
|
onChanged1: (value)=>setState(()=>ACAO_EDUCATIVA=value),
|
|
onChanged2: (value)=>setState(()=>ACAO_MECANICA=value),
|
|
),
|
|
CheckBoxTwoSubtitle(
|
|
width: width*0.7,
|
|
checkbox1: IMOVEL_FOCO,
|
|
checkbox2: TRATAMENTO_FOCAL,
|
|
subtitle1: 'IMÓVEL COM FOCO',
|
|
subtitle2: 'TRATAMENTO FOCAL',
|
|
onChanged1: (value)=>setState(()=>IMOVEL_FOCO=value),
|
|
onChanged2: (value)=>setState(()=>TRATAMENTO_FOCAL=value),
|
|
),
|
|
TitleContainers(title: 'Acompanhamento',width: width*0.7,textAling: TextAlign.start,fontSize: 15),
|
|
Container(
|
|
width: width*0.7,
|
|
height: heigth*1.15,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: ConstVariable().tipoAcompanhamentoModel.length,
|
|
itemBuilder: (context,index){
|
|
tipoAcompanhamentoModel.add(
|
|
CheckModel(
|
|
subtitle: ConstVariable().tipoAcompanhamentoModel[index],
|
|
check: false
|
|
)
|
|
);
|
|
return CheckBoxSubtitle(
|
|
subtitle: tipoAcompanhamentoModel[index].subtitle,
|
|
checkbox:tipoAcompanhamentoModel[index].check,
|
|
width: width*0.6,
|
|
onChanged: (value)=>setState(()=>tipoAcompanhamentoModel[index].check=value),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
TitleContainers(title: 'Outros',width: width*0.7,textAling: TextAlign.start,fontSize: 15),
|
|
Container(
|
|
width: width*0.7,
|
|
height: heigth*0.22,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: ConstVariable().outrosModel.length,
|
|
itemBuilder: (context,index){
|
|
outrosModel.add(
|
|
CheckModel(
|
|
subtitle: ConstVariable().outrosModel[index],
|
|
check: false
|
|
)
|
|
);
|
|
return CheckBoxSubtitle(
|
|
subtitle: outrosModel[index].subtitle,
|
|
checkbox:outrosModel[index].check,
|
|
width: width*0.6,
|
|
onChanged: (value)=>setState(()=>outrosModel[index].check=value),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Antropometria'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.2,
|
|
width: width*0.2,
|
|
child: Icon(LineIcons.alternateArrows,size: 80,),
|
|
),
|
|
Column(
|
|
children: [
|
|
InputWithSubtitle(
|
|
controller: PESO,
|
|
subtitle: 'Peso (em Kg - 000,000)',
|
|
errorInput: '',
|
|
labelInput: 'Peso (em Kg - 000,000)',
|
|
widthInput: width*0.7,
|
|
widthSubtitle: width*0.7,
|
|
hintInput: 'Escreva aqui',
|
|
mandatory: false,
|
|
enabled: true,
|
|
onChanged: (v)=>setState((){}),
|
|
),
|
|
InputWithSubtitle(
|
|
controller: ALTURA,
|
|
subtitle: 'Altura (em metros - 0,00)',
|
|
errorInput: '',
|
|
labelInput: 'Altura (em metros - 0,00)',
|
|
widthInput: width*0.7,
|
|
widthSubtitle: width*0.7,
|
|
hintInput: 'Escreva aqui',
|
|
mandatory: false,
|
|
enabled: true,
|
|
onChanged: (v)=>setState((){}),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Profissional'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.3,
|
|
width: width*0.2,
|
|
child: Icon(Icons.business_center,size: 80,),
|
|
),
|
|
Column(
|
|
children: [
|
|
InputWithSubtitle(
|
|
controller: NOME_PROFISSIONAL,
|
|
subtitle: 'Profissional',
|
|
errorInput: 'Campo Obrigatório',
|
|
labelInput: 'Profissional',
|
|
widthInput: width*0.7,
|
|
widthSubtitle: width*0.7,
|
|
hintInput: 'Escreva aqui',
|
|
enabled: false,
|
|
onChanged: (v)=>setState((){}),
|
|
),
|
|
InputWithSubtitle(
|
|
controller: CNES_UNIDADE,
|
|
subtitle: 'Unidade',
|
|
errorInput: 'Campo Obrigatório',
|
|
labelInput: 'Unidade',
|
|
widthInput: width*0.7,
|
|
widthSubtitle: width*0.7,
|
|
hintInput: 'Escreva aqui',
|
|
enabled: false,
|
|
onChanged: (v)=>setState((){}),
|
|
),
|
|
DropdownWithSubtitle(
|
|
list: listCBO,
|
|
widthSubtitle: width*0.7,
|
|
subtitle: 'CBO',
|
|
hintDropdown: 'CBO',
|
|
select: CBO_PROFISSIONAL,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
setState(() {
|
|
CBO_PROFISSIONAL = value!;
|
|
});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
CBO_PROFISSIONAL == null && mandatory?ErrorDefault():Container(),
|
|
DropdownWithSubtitle(
|
|
list: listINEPROF,
|
|
widthSubtitle: width*0.3,
|
|
subtitle: 'Código da Equipe',
|
|
hintDropdown: 'Selecione',
|
|
select: INE_RESP_CADASTRO,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.5,
|
|
onChanged: (value){
|
|
setState(() {
|
|
INE_RESP_CADASTRO = value!;
|
|
});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Complemento'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.2,
|
|
width: width*0.2,
|
|
child: Icon(Icons.attach_file,size: 80,),
|
|
),
|
|
Column(
|
|
children: [
|
|
InputWithSubtitle(
|
|
controller: COMPLEMENTO,
|
|
subtitle: 'COMPLEMENTO',
|
|
errorInput: '',
|
|
labelInput: 'COMPLEMENTO',
|
|
widthInput: width*0.7,
|
|
widthSubtitle: width*0.7,
|
|
hintInput: 'Escreva aqui',
|
|
mandatory: false,
|
|
enabled: true,
|
|
maxLines: 5,
|
|
onChanged: (v)=>setState((){}),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Procedimentos'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.2,
|
|
width: width*0.2,
|
|
child: Icon(Icons.info_outlined,size: 80,),
|
|
),
|
|
Column(
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
child: Container(
|
|
width: width*0.7,
|
|
child: Row(
|
|
children: [
|
|
TextDefault(text: 'Procedimento',color: Colors.black,),
|
|
Spacer(),
|
|
IconButton(
|
|
icon: Icon(Icons.add_circle,color: ColorPalette.blackButton),
|
|
onPressed: (){
|
|
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
)
|
|
)
|
|
]
|
|
)
|
|
],
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
CNS_VALIDO?Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Container(
|
|
padding: const EdgeInsets.all(8.0),
|
|
width: width,
|
|
height: heigth*0.1,
|
|
child: Row(
|
|
children: [
|
|
Icon(Icons.warning,color: ColorPalette.red,),
|
|
Container(
|
|
width: width*0.9,
|
|
child: TextDefault(
|
|
text: 'CNS do Profissional inválido. Este cadastro não será exportado para o e-SUS.',
|
|
fontSize: 15,
|
|
maxLines: 2,
|
|
color: ColorPalette.red,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
):Container(),
|
|
showCheckError?Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Container(
|
|
padding: EdgeInsets.all(10),
|
|
child: Row(
|
|
children: [
|
|
Icon(Icons.warning,color: Colors.red,),
|
|
TextDefault(text: 'Existem campos obrigatórios não preenchidos.',color: ColorPalette.red,fontSize: 15,)
|
|
],
|
|
),
|
|
),
|
|
color: ColorPalette.white,
|
|
):Container(),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
children: [
|
|
ButtonDefault(
|
|
onPressed: ()=>checkSave(),
|
|
title: 'Salvar',
|
|
borderColor: ColorPalette.appBar,
|
|
background: ColorPalette.appBar,
|
|
textColor: ColorPalette.white,
|
|
width: double.infinity,
|
|
),
|
|
ButtonDefault(
|
|
onPressed: ()=>Navigator.pop(context),
|
|
title: 'Cancelar',
|
|
borderColor: ColorPalette.blackButton,
|
|
background: ColorPalette.blackButton,
|
|
textColor: ColorPalette.white,
|
|
width: double.infinity,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|