815 lines
35 KiB
Dart
815 lines
35 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 '../../config/const_variable.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';
|
|
|
|
class ServiceHomeScreen extends StatefulWidget {
|
|
String name;
|
|
String username;
|
|
ServiceHomeScreen({required this.name,required this.username});
|
|
|
|
@override
|
|
State<ServiceHomeScreen> createState() => _ServiceHomeScreenState();
|
|
}
|
|
|
|
class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
|
|
|
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;
|
|
int CIAP_COD=0;
|
|
int CONDUTA_COD=0;
|
|
int ID_EQUIPE=0;
|
|
String CID_COD='';
|
|
|
|
String? CBO_PROFISSIONAL;
|
|
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<CheckModel> serviceProcModel = [];
|
|
List <String>listCBO = [];
|
|
List <String>listServicePlace = [];
|
|
List <String>typeService = [];
|
|
List <String>typeModelService = [];
|
|
List <String>typeTurnService = [];
|
|
List <String>listINEPROF = [];
|
|
List<DropDownDataModel> listCIAP = [];
|
|
List<DropDownDataStringModel> listCID = [];
|
|
List<String> PROCEDIMENTOS_SIGTAP = [];
|
|
List<String> ATENDS_DOM_PROC = [];
|
|
List<String> listConduct = [];
|
|
List listProc = [];
|
|
|
|
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();
|
|
}
|
|
});
|
|
_prefService.readCacheUnidade().then((value){
|
|
if(value!=null){
|
|
idUnidade = value[0];
|
|
CNES_UNIDADE.text = value[1];
|
|
}
|
|
});
|
|
await DBQuerys().buscaCIAP().then((list){
|
|
listCIAP.add(DropDownDataModel(cod: int.parse(list['CODIGO_CIAP']), title: list['DESC_CIAP']));
|
|
});
|
|
await DBQuerys().buscaCID().then((list){
|
|
listCID.add(DropDownDataStringModel(cod: list['CODIGO_CID'], title: list['DESCRICAO_CID']));
|
|
});
|
|
}
|
|
|
|
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(() {});
|
|
});
|
|
await DBQuerys().buscaCBOProfissional(idUsuario).then((list)async{
|
|
if(list.length!=0){
|
|
for(int i = 0; list.length>i;i++){
|
|
listCBO.add(list[i]['CODIGO_CBO'].toString());
|
|
}
|
|
}
|
|
if(listCBO.isNotEmpty){
|
|
await DbSqliteLoad().intialDB().then((db)async{
|
|
List list = await db.query('ARGS');
|
|
urlAPI = list[0]['URLAPI'];
|
|
mode = list[0]['MODE'];
|
|
nameCityApi = list[0]['NAME_CITY_API'];
|
|
}).then((value)async{
|
|
|
|
//sigtap
|
|
for(int i = 0; listCBO.length>i;i++){
|
|
print(listCBO[i]);
|
|
await DBQuerys().buscaCBOSProfissional(listCBO[i]).then((sigtap)async{
|
|
print('indice $i');
|
|
print(sigtap);
|
|
if(listCBO[i]==sigtap[0]['CODIGO_CBO']){
|
|
PROCEDIMENTOS_SIGTAP.add(sigtap[0]['CODIGO_CBO']+' - ' + sigtap[0]['DESCRICAO_CBO']);
|
|
List<String> aux = PROCEDIMENTOS_SIGTAP.toSet().toList();
|
|
PROCEDIMENTOS_SIGTAP = aux;
|
|
}
|
|
});
|
|
}
|
|
print(PROCEDIMENTOS_SIGTAP);
|
|
setState(() {});
|
|
// await ApiDataImportSigtap().loadSIGTAP(urlAPI, mode, nameCityApi).then((value)async{
|
|
// List<dynamic> procedimentos = value['procedimentos'];
|
|
// print(procedimentos.length);
|
|
// print(procedimentos);
|
|
// if(procedimentos.isNotEmpty){
|
|
// await DbSqliteSigtap().saveProceduresSigtapDB(procedimentos).then((db)async{
|
|
// List list = await db.query('PROCEDIMENTOS_SIGTAP');
|
|
// for(int i = 0; list.length>i;i++){
|
|
// if(list[i]['COD_PROC_SIGTAP']!=null && list[i]['DESC_PROC_SIGTAP']!=null){
|
|
// PROCEDIMENTOS_SIGTAP.add(list[i]['COD_PROC_SIGTAP']+' - ' + list[i]['DESC_PROC_SIGTAP']);
|
|
// List<String> aux = PROCEDIMENTOS_SIGTAP.toSet().toList();
|
|
// PROCEDIMENTOS_SIGTAP = aux;
|
|
// }
|
|
// }
|
|
// setState(() {
|
|
// loadSIGTAP = false;
|
|
// });
|
|
// });
|
|
// }
|
|
// });
|
|
});
|
|
}
|
|
CBO_RESP_CADASTRO = list.length == 0?null:list[0]['CODIGO_CBO'].toString();
|
|
setState(() {});
|
|
});
|
|
// print('IdUsuario: ${idUsuario}');
|
|
// print('IdUnidade: '+idUnidade);
|
|
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']}');
|
|
}
|
|
setState(() {});
|
|
}
|
|
|
|
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
|
|
){
|
|
print('erro');
|
|
setState(() {
|
|
showCheckError = true;
|
|
mandatory = true;
|
|
});
|
|
}else{
|
|
print('passou');
|
|
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,
|
|
'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,i+1);
|
|
}
|
|
}
|
|
AlertDialogDefault().alert(
|
|
context,
|
|
'Aviso',
|
|
'Atendimento Domiciliar salvo com sucesso!',
|
|
'OK'
|
|
);
|
|
});
|
|
}
|
|
|
|
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: PROCEDIMENTOS_SIGTAP,
|
|
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,
|
|
),
|
|
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*1.3,
|
|
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 $CIAP':'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*1.2,
|
|
child: ListView.builder(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemCount: ConstVariable().serviceHomeCheckProclist.length,
|
|
itemBuilder: (context,index){
|
|
serviceProcModel.add(
|
|
CheckModel(
|
|
subtitle: ConstVariable().serviceHomeCheckProclist[index],
|
|
check: false
|
|
)
|
|
);
|
|
return CheckBoxSubtitle(
|
|
subtitle: serviceProcModel[index].subtitle,
|
|
checkbox:serviceProcModel[index].check,
|
|
width: width*0.6,
|
|
onChanged: (value)=>setState(()=>serviceProcModel[index].check=value),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
),
|
|
]
|
|
),
|
|
],
|
|
),
|
|
),
|
|
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: 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(() {});
|
|
},
|
|
)
|
|
],
|
|
),
|
|
)
|
|
)
|
|
]
|
|
)
|
|
]
|
|
)
|
|
),
|
|
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,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|