847 lines
37 KiB
Dart
847 lines
37 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:line_icons/line_icons.dart';
|
|
import 'package:rkm/models/check_model.dart';
|
|
import 'package:rkm/config/color_palette.dart';
|
|
import 'package:rkm/models/drop_down_data_model.dart';
|
|
import 'package:rkm/service/db/db_sqlite_Sigtap.dart';
|
|
import 'package:rkm/widgets/alert_dialog_default.dart';
|
|
import 'package:rkm/widgets/appbar_default.dart';
|
|
import 'package:sqflite/sqflite.dart';
|
|
import '../../config/const_variable.dart';
|
|
import '../../models/check_proced_sia_model.dart';
|
|
import '../../models/drop_down_data_string_model.dart';
|
|
import '../../service/api/api_data_import_sigtap.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/button_default.dart';
|
|
import '../../widgets/check_box_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/text_default.dart';
|
|
import '../../widgets/title_containers.dart';
|
|
import '../home_screen.dart';
|
|
|
|
class AtendimentoDomiciliarTela extends StatefulWidget {
|
|
String name;
|
|
String username;
|
|
AtendimentoDomiciliarTela({required this.name,required this.username});
|
|
|
|
@override
|
|
State<AtendimentoDomiciliarTela> createState() => _AtendimentoDomiciliarTelaState();
|
|
}
|
|
|
|
class _AtendimentoDomiciliarTelaState extends State<AtendimentoDomiciliarTela> {
|
|
|
|
var NOME_PROFISSIONAL = TextEditingController();
|
|
var CNES_UNIDADE = TextEditingController();
|
|
var controllerSearchCondition = TextEditingController();
|
|
var controllerSearchCID = TextEditingController();
|
|
|
|
String date='';
|
|
String dateDB='';
|
|
int idUsuario=0;
|
|
String idUnidade='';
|
|
String? nameCityApi;
|
|
String? mode;
|
|
String? urlAPI;
|
|
String CD_USUARIO_SUS = '';
|
|
String INE_PROFISSIONAL = '';
|
|
|
|
int ID_CIDADAO=0;
|
|
int ID_PROFISSIONAL=0;
|
|
int LOCAL_ATENDIMENTO_COD=0;
|
|
int TIPO_ATENDIMENTO_COD=0;
|
|
int MODALIDADE_COD=0;
|
|
int TURNO_COD=0;
|
|
String CIAP_COD='';
|
|
int CONDUTA_COD=0;
|
|
int ID_EQUIPE=0;
|
|
String CID_COD='';
|
|
|
|
String? CBO_PROFISSIONAL;
|
|
String? CBO_PROFISSIONAL_DB;
|
|
String? CIAP;
|
|
String? CID;
|
|
String? CBO_RESP_CADASTRO;
|
|
String? INE_RESP_CADASTRO;
|
|
String? LOCAL_ATENDIMENTO;
|
|
String? TIPO_ATENDIMENTO;
|
|
String? MODALIDADE;
|
|
String? TURNO;
|
|
String? CONDUTA;
|
|
|
|
List<CheckModel> serviceHomeModel = [];
|
|
List<CheckProcedSiaModel> serviceProcModel = [];
|
|
List <String>listCBO = [];
|
|
List <String>listServicePlace = [];
|
|
List <String>typeService = [];
|
|
List <String>typeModelService = [];
|
|
List <String>typeTurnService = [];
|
|
List <String>listINEPROF = [];
|
|
List<DropDownDataStringModel> listCIAP = [];
|
|
List<DropDownDataStringModel> listCID = [];
|
|
List<String> PROCEDIMENTOS_SIGTAP = [];
|
|
List<String> ATENDS_DOM_PROC = [];
|
|
List<String> listConduct = [];
|
|
List listProc = [];
|
|
List CBOS_PROFISSIONAL=[];
|
|
|
|
bool CNS_VALIDO = false;
|
|
bool mandatory = false;
|
|
bool showCheckError = false;
|
|
|
|
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;
|
|
}
|
|
|
|
loadLists() {
|
|
for (int i = 0; ConstVariable().listServicePlace.length > i; i++) {
|
|
listServicePlace.add(ConstVariable().listServicePlace[i].title);
|
|
}
|
|
for (int i = 0; ConstVariable().typeService.length > i; i++) {
|
|
typeService.add(ConstVariable().typeService[i].title);
|
|
}
|
|
for (int i = 0; ConstVariable().typeModelService.length > i; i++) {
|
|
typeModelService.add(ConstVariable().typeModelService[i].title);
|
|
}
|
|
for (int i = 0; ConstVariable().typeTurnService.length > i; i++) {
|
|
typeTurnService.add(ConstVariable().typeTurnService[i].title);
|
|
}
|
|
for (int i = 0; ConstVariable().listConduct.length > i; i++) {
|
|
listConduct.add(ConstVariable().listConduct[i].title);
|
|
}
|
|
}
|
|
|
|
getUser()async{
|
|
final PrefService _prefService = PrefService();
|
|
_prefService.readCacheIDUser().then((value){
|
|
if(value != 0){
|
|
idUsuario = int.parse(value);
|
|
// print('idUsuario get');
|
|
// print(idUsuario);
|
|
loadData();
|
|
getPro();
|
|
// getProcedimentos();
|
|
}
|
|
});
|
|
_prefService.readCacheUnidade().then((value){
|
|
if(value!=null){
|
|
idUnidade = value[0].toString();
|
|
CNES_UNIDADE.text = value[1];
|
|
}
|
|
});
|
|
await DBQuerys().buscaCIAP().then((list){
|
|
for(int i = 0 ; list.length > i ; i++){
|
|
listCIAP.add(DropDownDataStringModel(cod: list[i]['CODIGO_CIAP'], title: list[i]['DESC_CIAP']));
|
|
}
|
|
});
|
|
await DBQuerys().buscaCID().then((list){
|
|
for(int i = 0 ; list.length > i ; i++){
|
|
listCID.add(DropDownDataStringModel(cod: list[i]['CODIGO_CID'], title: list[i]['DESCRICAO_CID']));
|
|
}
|
|
});
|
|
}
|
|
|
|
loadData()async{
|
|
// print('idUsuario');
|
|
// print(idUsuario);
|
|
await DBQuerys().buscaAtendDomProc().then((value){
|
|
|
|
for(int i = 0 ; value.length > i ; i++){
|
|
PROCEDIMENTOS_SIGTAP.add('${value[i]['COD_PROC_SIGTAP']} - ${value[i]['DESC_PROC_SIGTAP']}');
|
|
}
|
|
});
|
|
|
|
|
|
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;
|
|
}
|
|
});
|
|
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']}'}');
|
|
}
|
|
setState(() {});
|
|
}
|
|
|
|
getPro()async{
|
|
Database dbcbo = await DbSqliteLoad().intialDB();
|
|
var query = 'SELECT * FROM PROFISSIONAIS_CBOS WHERE ID_PROFISSIONAL = $idUsuario';
|
|
List listcbo = await dbcbo.rawQuery(query);
|
|
|
|
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());
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
getProcedimentos()async{
|
|
List CBOS = [];
|
|
await DBQuerys().buscaCBOProfissional(idUsuario).then((cbosProfissional){
|
|
if(cbosProfissional.length!=0){
|
|
for(int i = 0; cbosProfissional.length>i;i++){
|
|
CBOS.add(cbosProfissional[i]['CODIGO_CBO'].toString());
|
|
}
|
|
}
|
|
CBO_RESP_CADASTRO = cbosProfissional.length == 0?null:cbosProfissional[0]['CODIGO_CBO'].toString();
|
|
|
|
}).then((value)async{
|
|
|
|
print('CBOS.length');
|
|
print(CBOS.length);
|
|
print(CBOS);
|
|
|
|
for(int i = 0; CBOS.length>i;i++){
|
|
await DBQuerys().buscaPROCEDIMENTOS_SIGTAP_CBO(CBOS[i]).then((dadosCBOS)async{
|
|
print('dadosCBOS.length');
|
|
print(dadosCBOS.length);
|
|
print(dadosCBOS[0]);
|
|
for(int i = 0; dadosCBOS.length>i;i++){
|
|
await DBQuerys().buscaPROCEDIMENTOS_SIGTAP(dadosCBOS[i]['COD_PROC_SIGTAP']).then((dadosSIGTAP){
|
|
PROCEDIMENTOS_SIGTAP.add('${dadosSIGTAP[i]['COD_PROC_SIGTAP']} - ${dadosSIGTAP[i]['DESC_PROC_SIGTAP']}');
|
|
// print('dadosSIGTAP');
|
|
// print(dadosSIGTAP[0]);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
print('PROCEDIMENTOS_SIGTAP');
|
|
print(PROCEDIMENTOS_SIGTAP.length);
|
|
print(PROCEDIMENTOS_SIGTAP);
|
|
});
|
|
}
|
|
|
|
checkSave()async{
|
|
// adicionar depois e usar um usuário real
|
|
// CBO_RESP_CADASTRO
|
|
//ok
|
|
if(date.isEmpty || dateDB.isEmpty || LOCAL_ATENDIMENTO_COD==0 || TIPO_ATENDIMENTO_COD ==0 || MODALIDADE_COD == 0 || TURNO_COD == 0 || CBO_PROFISSIONAL == null || CONDUTA == null
|
|
){
|
|
print('erro');
|
|
setState(() {
|
|
showCheckError = true;
|
|
mandatory = true;
|
|
});
|
|
}else{
|
|
print('teste');
|
|
setState(() {
|
|
mandatory = false;
|
|
showCheckError = false;
|
|
saveServiceHome();
|
|
});
|
|
}
|
|
}
|
|
|
|
saveServiceHome()async{
|
|
Map<String, dynamic> row = {
|
|
'ID_CIDADAO' : ID_CIDADAO,
|
|
'CD_USUARIO_SUS' : CD_USUARIO_SUS,
|
|
'ID_PROFISSIONAL' : idUsuario,
|
|
'CBO_PROFISSIONAL' : CBO_PROFISSIONAL_DB,
|
|
'INE_PROFISSIONAL' : INE_PROFISSIONAL,
|
|
'CNES_UNIDADE' : CNES_UNIDADE.text,
|
|
'ID_UNIDADE' : int.parse(idUnidade),
|
|
'ID_EQUIPE' : ID_EQUIPE,
|
|
'DATA' : dateDB,
|
|
'LOCAL_ATENDIMENTO' : LOCAL_ATENDIMENTO_COD,
|
|
'TIPO_ATENDIMENTO' : TIPO_ATENDIMENTO_COD,
|
|
'MODALIDADE' : MODALIDADE_COD,
|
|
'TURNO' : TURNO_COD,
|
|
'CIAP' : CIAP_COD,
|
|
'CID' : CID_COD,
|
|
'CONDUTA' : CONDUTA_COD,
|
|
'SINCRONIZADO' : 'N',
|
|
};
|
|
await DbSqliteSync().insertAtendimentoDomiciliar(row).then((value){
|
|
for(int i = 0;serviceHomeModel.length>i;i++){
|
|
if(serviceHomeModel[i].check){
|
|
DbSqliteSync().insertCondicoesAvaliadas(value,i+1);
|
|
}
|
|
}
|
|
for(int i = 0;serviceProcModel.length>i;i++){
|
|
if(serviceProcModel[i].check){
|
|
DbSqliteSync().insertProcedimentosDomiciliares(value,serviceProcModel[i].COD_SIA);
|
|
}
|
|
}
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'Atendimento Domiciliar salvo com sucesso!',
|
|
'OK'
|
|
);
|
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>HomeScreen(username: widget.username)), (route) => false);
|
|
});
|
|
}
|
|
|
|
dadosCidadao()async{
|
|
await DBQuerys().buscaCidadao(widget.name).then((list){
|
|
ID_CIDADAO = list[0]['ID_CIDADAO'];
|
|
CD_USUARIO_SUS = list[0]['CD_USUARIO_SUS'];
|
|
});
|
|
List list = await DBQuerys().buscaDadosProfissional(idUnidade,idUsuario);
|
|
|
|
INE_PROFISSIONAL = list[0]['INE']??'';
|
|
ID_EQUIPE = list[0]['ID_EQUIPE']??0;
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
getUser();
|
|
dadosCidadao();
|
|
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 - Atendimento 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: 'Cadastro'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.5,
|
|
width: width*0.2,
|
|
child: Icon(Icons.business_center,size: 80,),
|
|
),
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
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_PROFISSIONAL_DB = list.last;
|
|
print(CBO_PROFISSIONAL_DB);
|
|
});
|
|
},
|
|
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,
|
|
),
|
|
Container(
|
|
width: width*0.7,
|
|
child: TextDefault(
|
|
textAlign: TextAlign.start,
|
|
text: 'Data',
|
|
color: ColorPalette.black54,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: ()=>escolherprazoInicio(context),
|
|
child: Container(
|
|
height: 50,
|
|
margin: EdgeInsets.symmetric(horizontal: 10),
|
|
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: listServicePlace,
|
|
widthSubtitle: width*0.2,
|
|
subtitle: 'Local de Atendimento',
|
|
hintDropdown: 'Local de Atendimento',
|
|
select: LOCAL_ATENDIMENTO,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
LOCAL_ATENDIMENTO = value;
|
|
for(int i = 0;ConstVariable().listServicePlace.length >i;i++){
|
|
if(ConstVariable().listServicePlace[i].title == LOCAL_ATENDIMENTO){
|
|
LOCAL_ATENDIMENTO_COD = ConstVariable().listServicePlace[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
LOCAL_ATENDIMENTO_COD ==0 && mandatory?ErrorDefault():Container(),
|
|
DropdownWithSubtitle(
|
|
list: typeService,
|
|
widthSubtitle: width*0.2,
|
|
subtitle: 'Tipo de Atendimento',
|
|
hintDropdown: 'Tipo de Atendimento',
|
|
select: TIPO_ATENDIMENTO,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
TIPO_ATENDIMENTO = value;
|
|
for(int i = 0;ConstVariable().typeService.length >i;i++){
|
|
if(ConstVariable().typeService[i].title == TIPO_ATENDIMENTO){
|
|
TIPO_ATENDIMENTO_COD = ConstVariable().typeService[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
TIPO_ATENDIMENTO_COD ==0 && mandatory?ErrorDefault():Container(),
|
|
DropdownWithSubtitle(
|
|
list: typeModelService,
|
|
widthSubtitle: width*0.2,
|
|
subtitle: 'Modalidade',
|
|
hintDropdown: 'Modalidade',
|
|
select: MODALIDADE,
|
|
widthDropdown: width*0.7,
|
|
widthContainerDropdown: width*0.6,
|
|
onChanged: (value){
|
|
MODALIDADE = value;
|
|
for(int i = 0;ConstVariable().typeModelService.length >i;i++){
|
|
if(ConstVariable().typeModelService[i].title == MODALIDADE){
|
|
MODALIDADE_COD = ConstVariable().typeModelService[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
colorBorder: ColorPalette.white,
|
|
),
|
|
MODALIDADE_COD ==0 && 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(),
|
|
],
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Condições Avaliadas'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.4,
|
|
width: width*0.2,
|
|
child: Icon(LineIcons.edit,size: 80,),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
SizedBox(height: 10,),
|
|
TitleContainers(title: 'Condição Avaliada',width: width * 0.73),
|
|
Container(
|
|
width: width*0.7,
|
|
height: heigth*0.95,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: ConstVariable().serviceHomeCheckConditionlist.length,
|
|
itemBuilder: (context,index){
|
|
serviceHomeModel.add(
|
|
CheckModel(
|
|
subtitle: ConstVariable().serviceHomeCheckConditionlist[index],
|
|
check: false
|
|
)
|
|
);
|
|
return CheckBoxSubtitle(
|
|
subtitle: serviceHomeModel[index].subtitle,
|
|
checkbox:serviceHomeModel[index].check,
|
|
width: width*0.6,
|
|
onChanged: (value)=>setState(()=>serviceHomeModel[index].check=value),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: ()=>AlertDialogDefault().alert_with_search(
|
|
context,
|
|
controllerSearchCondition,
|
|
ListView.separated(
|
|
itemCount: listCIAP.length,
|
|
separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
|
|
itemBuilder: (context,index){
|
|
return ListTile(
|
|
onTap: ()=>setState(() {
|
|
CIAP_COD = listCIAP[index].cod;
|
|
CIAP = listCIAP[index].cod.toString() +' - '+ listCIAP[index].title;
|
|
Navigator.pop(context);
|
|
}),
|
|
title: TextDefault(text: listCIAP[index].cod.toString() +' - '+ listCIAP[index].title,maxLines: 2,fontSize: 15,color: Colors.black,)
|
|
);
|
|
},
|
|
)
|
|
),
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
width: width*0.7,
|
|
child: TextDefault(
|
|
text: CIAP!=null?'CIAP $CIAP':'CIAP',
|
|
color:Colors.black,
|
|
fontSize: 15,
|
|
)
|
|
)
|
|
),
|
|
GestureDetector(
|
|
onTap: ()=>AlertDialogDefault().alert_with_search(
|
|
context,
|
|
controllerSearchCID,
|
|
ListView.separated(
|
|
itemCount: listCID.length,
|
|
separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
|
|
itemBuilder: (context,index){
|
|
return ListTile(
|
|
onTap: ()=>setState(() {
|
|
CID_COD =listCID[index].cod;
|
|
CID = listCID[index].cod +' - '+ listCID[index].title;
|
|
Navigator.pop(context);
|
|
}),
|
|
title: TextDefault(text: listCID[index].cod +' - '+ listCID[index].title,maxLines: 2,fontSize: 15,color: Colors.black,)
|
|
);
|
|
},
|
|
)
|
|
),
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
width: width*0.7,
|
|
child: TextDefault(
|
|
text: CID!=null?'CID $CID':'CID',
|
|
color:Colors.black,
|
|
fontSize: 15,
|
|
)
|
|
)
|
|
),
|
|
],
|
|
),
|
|
),
|
|
]
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Procedimentos'),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: heigth*0.4,
|
|
width: width*0.2,
|
|
child: Icon(Icons.info_outlined,size: 80,),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
child: Container(
|
|
width: width*0.7,
|
|
height: heigth*0.9,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: ConstVariable().serviceHomeCheckProclist.length,
|
|
itemBuilder: (context,index){
|
|
|
|
serviceProcModel.add(
|
|
CheckProcedSiaModel(
|
|
COD_SIA: ConstVariable().serviceHomeCheckProclist[index].COD_SIA,
|
|
DESCRICAO_PROCEDIMENTO: ConstVariable().serviceHomeCheckProclist[index].DESCRICAO_PROCEDIMENTO,
|
|
)
|
|
);
|
|
|
|
// print(serviceProcModel[index].subtitle);
|
|
|
|
return CheckBoxSubtitle(
|
|
subtitle: serviceProcModel[index].DESCRICAO_PROCEDIMENTO,
|
|
checkbox:serviceProcModel[index].check,
|
|
width: width*0.6,
|
|
onChanged: (value)=>setState((){
|
|
serviceProcModel[index].check=value;
|
|
print(serviceProcModel[index].COD_SIA);
|
|
print(serviceProcModel[index].DESCRICAO_PROCEDIMENTO);
|
|
print(serviceProcModel[index].check);
|
|
}),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
),
|
|
]
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Procedimentos'),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
height: heigth*0.2,
|
|
width: width*0.2,
|
|
child: Icon(Icons.add,size: 130,),
|
|
),
|
|
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);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
)
|
|
)
|
|
]
|
|
)
|
|
]
|
|
)
|
|
),
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
child: Column(
|
|
children: [
|
|
TitleContainers(title: 'Outros'),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
height: heigth*0.2,
|
|
width: width*0.2,
|
|
child: Icon(Icons.tag,size: 130,),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
width: width*0.7,
|
|
child: Row(
|
|
children: [
|
|
TextDefault(text: 'Conduta / Desfecho',fontSize: 15),
|
|
Spacer(),
|
|
DropdownWithSubtitle(
|
|
colorBorder: ColorPalette.white,
|
|
list: listConduct,
|
|
subtitle: 'SELECIONE',
|
|
select: CONDUTA,
|
|
widthDropdown: width*0.39,
|
|
widthContainerDropdown: width*0.3,
|
|
widthSubtitle: width*0.3,
|
|
hintDropdown: 'SELECIONE',
|
|
onChanged: (value){
|
|
CONDUTA = value;
|
|
for(int i = 0;ConstVariable().listConduct.length >i;i++){
|
|
if(ConstVariable().listConduct[i].title == CONDUTA){
|
|
CONDUTA_COD = ConstVariable().listConduct[i].cod;
|
|
}
|
|
}
|
|
setState(() {});
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
CONDUTA_COD ==0 && mandatory?ErrorDefault():Container(),
|
|
],
|
|
)
|
|
),
|
|
]
|
|
),
|
|
]
|
|
)
|
|
),
|
|
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,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|