949 lines
42 KiB
Dart
949 lines
42 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:line_icons/line_icons.dart';
|
|
import 'package:rkm/screens/home_screen.dart';
|
|
import 'package:sqflite/sqflite.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 VisitaDomiciliarTela extends StatefulWidget {
|
|
String name;
|
|
String username;
|
|
VisitaDomiciliarTela({required this.name, required this.username});
|
|
|
|
@override
|
|
State<VisitaDomiciliarTela> createState() => _VisitaDomiciliarTelaState();
|
|
}
|
|
|
|
class _VisitaDomiciliarTelaState extends State<VisitaDomiciliarTela> {
|
|
|
|
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 CBO_DB ='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 = [];
|
|
List listProf = [];
|
|
|
|
escolherprazoInicio(BuildContext context) async {
|
|
var pickDate = await showDatePicker(
|
|
context: context,
|
|
locale: Locale('pt','BR'),
|
|
initialDate: DateTime.now(),
|
|
firstDate: DateTime(2022),
|
|
lastDate: DateTime.now()
|
|
);
|
|
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.readCacheIDUser().then((value){
|
|
if(value != null){
|
|
idUsuario = int.parse(value);
|
|
loadData();
|
|
}
|
|
});
|
|
_prefService.readCacheUnidade().then((value){
|
|
if(value!=null){
|
|
idUnidade = value[0].toString();
|
|
CNES_UNIDADE.text = value[1];
|
|
}
|
|
});
|
|
Database dbcbo = await DbSqliteLoad().intialDB();
|
|
var querycbo = 'SELECT * FROM PROFISSIONAIS_CBOS WHERE ID_PROFISSIONAL = $idUsuario';
|
|
List listcbo = await dbcbo.rawQuery(querycbo);
|
|
List todosSigtap = [];
|
|
// print('listcbo');
|
|
// print(listcbo.length);
|
|
// print(listcbo);
|
|
|
|
for(int i = 0; listcbo.length > i ; i++){
|
|
var querySigtap = 'SELECT * FROM PROCEDIMENTOS_SIGTAP_CBO WHERE CODIGO_CBO = ${listcbo[i]['CODIGO_CBO']}';
|
|
List listSigtap = await dbcbo.rawQuery(querySigtap);
|
|
|
|
todosSigtap.addAll(listSigtap);
|
|
// print('listSigtap');
|
|
// print(listSigtap.length);
|
|
// print('todosSigtap');
|
|
// print(todosSigtap.length);
|
|
}
|
|
|
|
List aux = todosSigtap.toSet().toList();
|
|
todosSigtap = aux;
|
|
|
|
for(int i = 0; todosSigtap.length > i ; i++){
|
|
var querySigtapDesc = 'SELECT * FROM PROCEDIMENTOS_SIGTAP WHERE COD_PROC_SIGTAP = \'${todosSigtap[i]['COD_PROC_SIGTAP']}\'';
|
|
List listSigtapDesc = await dbcbo.rawQuery(querySigtapDesc);
|
|
if(listSigtapDesc.isNotEmpty){
|
|
PROCEDIMENTOS_SIGTAP.add('${listSigtapDesc[0]['COD_PROC_SIGTAP']} - ${listSigtapDesc[0]['DESC_PROC_SIGTAP']}');
|
|
}
|
|
}
|
|
|
|
print('PROCEDIMENTOS_SIGTAP');
|
|
print(PROCEDIMENTOS_SIGTAP.length);
|
|
print(PROCEDIMENTOS_SIGTAP[0]);
|
|
|
|
|
|
if(listcbo.length!=0){
|
|
for(int i = 0; listcbo.length>i;i++){
|
|
await DBQuerys().buscaCBOSProfissional(listcbo[i]['CODIGO_CBO']).then((cbo)async{
|
|
if(cbo.length!=0){
|
|
listCBO.add(cbo[0]['DESCRICAO_CBO']+' - '+listcbo[i]['CODIGO_CBO'].toString());
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
/*var querycbo = 'SELECT * FROM CBOS WHERE CODIGO_CBO = 223208';
|
|
var query = 'SELECT * FROM PROFISSIONAIS_CBOS';
|
|
List listcbocompleta = await dbcbo.rawQuery(querycbo);
|
|
print(listcbocompleta);*/
|
|
|
|
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']} ${list[i]['MICROAREA']==null?'':'- Microárea : ${list[i]['MICROAREA']}'}';
|
|
listINEPROF.add('INE: ${list[i]['INE']} / Área: ${list[i]['AREA']} ${list[i]['MICROAREA']==null?'':'- 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']}');
|
|
// }
|
|
// }
|
|
listProf = await DBQuerys().buscaDadosProfissional(idUnidade,idUsuario);
|
|
INE_PROFISSIONAL = listProf[0]['INE'];
|
|
ID_EQUIPE = listProf[0]['ID_EQUIPE'];
|
|
setState(() {});
|
|
}
|
|
|
|
loadLists()async {
|
|
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*/
|
|
//salvar
|
|
|
|
if(date.isEmpty || dateDB.isEmpty || TIPO_IMOVEL_COD==0 || DESFECHO_COD ==0 || TURNO_COD == 0 || CBO_PROFISSIONAL == null
|
|
){
|
|
print('erro principal');
|
|
setState(() {
|
|
showCheckError = true;
|
|
mandatory = true;
|
|
});
|
|
}else{
|
|
setState(() {
|
|
mandatory = false;
|
|
showCheckError = false;
|
|
/*TIPO VISITA*/
|
|
print('save');
|
|
saveHomeVisit();
|
|
});
|
|
}
|
|
}
|
|
saveHomeVisit()async{
|
|
int ID_UNIDADE = 0;
|
|
for (int i = 0; listProf.length > i; i++) {
|
|
if (listProf[i]['INE'] == INE_PROFISSIONAL) {
|
|
ID_EQUIPE = listProf[i]['ID_EQUIPE'];
|
|
// INE_DB = listProf[i]['INE'];
|
|
ID_UNIDADE = listProf[i]['ID_UNIDADE'];
|
|
// print('lista');
|
|
// print(listProf[i]);
|
|
}
|
|
}
|
|
|
|
var CNES_UNIDADE = await DBQuerys().cnesUnidade(ID_UNIDADE);
|
|
|
|
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_DB,
|
|
'INE_PROFISSIONAL' : INE_PROFISSIONAL,
|
|
'CNES_UNIDADE' : CNES_UNIDADE,
|
|
'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().sucess(
|
|
context,
|
|
'Aviso',
|
|
'Visita Domiciliar realizada com sucesso!',
|
|
'OK',
|
|
(){
|
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>HomeScreen(username: widget.username)), (route) => false);
|
|
}
|
|
);
|
|
// Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>HomeScreen(username: widget.username)), (route) => false);
|
|
});
|
|
}
|
|
|
|
@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, widget.username),
|
|
child: Scaffold(
|
|
appBar: AppBarDefault().appbar(context, 'RKM AB - Visita Domiciliar',widget.username),
|
|
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(
|
|
ontap:DESFECHO != 'VISITA REALIZADA'?null: (){
|
|
setState((){
|
|
tipoVisitaModel[index].check?tipoVisitaModel[index].check=false:tipoVisitaModel[index].check=true;
|
|
});
|
|
},
|
|
subtitle: tipoVisitaModel[index].subtitle,
|
|
checkbox:tipoVisitaModel[index].check,
|
|
width: width*0.6,
|
|
onChanged:DESFECHO != 'VISITA REALIZADA'?null: (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: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>CONSULTA=value),
|
|
onChanged2: DESFECHO != 'VISITA REALIZADA'?null: (value)=>setState(()=>VACINA=value),
|
|
ontap1: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>CONSULTA?CONSULTA=false:CONSULTA=true),
|
|
ontap2: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>VACINA?VACINA=false:VACINA=true),
|
|
),
|
|
CheckBoxTwoSubtitle(
|
|
width: width*0.7,
|
|
checkbox1: EXAME,
|
|
checkbox2: CONDICIONALIDADES,
|
|
subtitle1: 'EXAME',
|
|
subtitle2: 'CONDICIONALIDADES',
|
|
onChanged1: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>EXAME=value),
|
|
onChanged2: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>CONDICIONALIDADES=value),
|
|
ontap1: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>EXAME?EXAME=false:EXAME=true),
|
|
ontap2: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>CONDICIONALIDADES?CONDICIONALIDADES=false:CONDICIONALIDADES=true),
|
|
),
|
|
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: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>ACAO_EDUCATIVA=value),
|
|
onChanged2: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>ACAO_MECANICA=value),
|
|
ontap1: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>ACAO_EDUCATIVA?ACAO_EDUCATIVA=false:ACAO_EDUCATIVA=true),
|
|
ontap2: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>ACAO_MECANICA?ACAO_MECANICA=false:ACAO_MECANICA=true),
|
|
),
|
|
CheckBoxTwoSubtitle(
|
|
width: width*0.7,
|
|
checkbox1: IMOVEL_FOCO,
|
|
checkbox2: TRATAMENTO_FOCAL,
|
|
subtitle1: 'IMÓVEL COM FOCO',
|
|
subtitle2: 'TRATAMENTO FOCAL',
|
|
onChanged1: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>IMOVEL_FOCO=value),
|
|
onChanged2: DESFECHO != 'VISITA REALIZADA'?null:(value)=>setState(()=>TRATAMENTO_FOCAL=value),
|
|
ontap1: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>IMOVEL_FOCO?IMOVEL_FOCO=false:IMOVEL_FOCO=true),
|
|
ontap2: DESFECHO != 'VISITA REALIZADA'?null: ()=>setState(()=>TRATAMENTO_FOCAL?TRATAMENTO_FOCAL=false:TRATAMENTO_FOCAL=true),
|
|
),
|
|
TitleContainers(title: 'Acompanhamento',width: width*0.7,textAling: TextAlign.start,fontSize: 15),
|
|
Container(
|
|
width: width*0.7,
|
|
height: heigth*0.9,
|
|
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:DESFECHO != 'VISITA REALIZADA'?null: (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,
|
|
maxLength: 7,
|
|
textInputType: TextInputType.number,
|
|
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,
|
|
maxLength: 4,
|
|
textInputType: TextInputType.number,
|
|
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!;
|
|
List list = CBO_PROFISSIONAL.toString().split(' - ');
|
|
CBO_DB = list[1];
|
|
});
|
|
},
|
|
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: [
|
|
GestureDetector(
|
|
onTap: ()=>setState(() {
|
|
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
|
}),
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
child: Container(
|
|
height: 200,
|
|
width: width*0.7,
|
|
child: Column(
|
|
mainAxisAlignment:MainAxisAlignment.center ,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
TextDefault(text: 'Procedimento',color: Colors.black,),
|
|
Spacer(),
|
|
IconButton(
|
|
icon: Icon(Icons.add_circle,color: ColorPalette.blackButton),
|
|
onPressed: ()=>setState(() {
|
|
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
|
}),
|
|
)
|
|
],
|
|
),
|
|
GestureDetector(
|
|
onTap: ()=>setState(() {
|
|
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
|
}),
|
|
child: Container(
|
|
height: listProc.isEmpty?0:150,
|
|
child: ListView.builder(
|
|
itemCount: listProc.length,
|
|
itemBuilder: (context,i){
|
|
return Text(listProc[i]);
|
|
},
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
),
|
|
)
|
|
]
|
|
)
|
|
],
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
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,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|