ajustes na tela de Atendimento Domiliar, nos models e alert dialog
This commit is contained in:
@@ -3,9 +3,16 @@ 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/shared_preferences/shared_preferences_service.dart';
|
||||
import '../../widgets/button_default.dart';
|
||||
import '../../widgets/check_box_subtitle.dart';
|
||||
import '../../widgets/dropdown_with_subtitle.dart';
|
||||
@@ -23,22 +30,55 @@ class ServiceHomeScreen extends StatefulWidget {
|
||||
|
||||
class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
|
||||
var professionalController = TextEditingController(text: 'ADMINISTRADOR');
|
||||
var unitController = TextEditingController(text: 'USF PINHAL - EMILIA STEPHANI SIMIONATO');
|
||||
var NOME_PROFISSIONAL = TextEditingController();
|
||||
var CNES_UNIDADE = TextEditingController();
|
||||
var controllerSearchCondition = TextEditingController();
|
||||
var controllerSearchCID = TextEditingController();
|
||||
String date='Data';
|
||||
|
||||
String date='';
|
||||
String dateDB='';
|
||||
String idUsuario='';
|
||||
String idUnidade='';
|
||||
|
||||
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;
|
||||
String CID_COD='';
|
||||
|
||||
String? selectCBO;
|
||||
String? selectCodTeam;
|
||||
String? selectServicePlace;
|
||||
String? selectTypeService;
|
||||
String? selectModality;
|
||||
String? selectRotation;
|
||||
String? selectCIAP;
|
||||
String? selectCID;
|
||||
String? selectConduct;
|
||||
String? CIAP;
|
||||
String? CID;
|
||||
String? CBO_RESP_CADASTRO;
|
||||
String? INE_RESP_CADASTRO;
|
||||
String? LOCAL_ATENDIMENTO;
|
||||
String? TIPO_ATENDIMENTO;
|
||||
String? MODALIDADE;
|
||||
String? TURNO;
|
||||
String? CONDUTA;
|
||||
String? nameCityApi;
|
||||
String? mode;
|
||||
String? urlAPI;
|
||||
|
||||
List<CheckModel> serviceHomeModel = [];
|
||||
List<CheckModel> proceduresModel = [];
|
||||
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;
|
||||
|
||||
escolherprazoInicio(BuildContext context) async {
|
||||
var pickDate = await showDatePicker(
|
||||
@@ -48,8 +88,8 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
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);
|
||||
date = 'Data $date';
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -60,6 +100,98 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
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.readCacheIdUsuario('idUsuario').then((value){
|
||||
if(value != null){
|
||||
idUsuario = value;
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
_prefService.readCacheUnidade('idUnidade').then((value){
|
||||
if(value!=null){
|
||||
idUnidade = value[0];
|
||||
CNES_UNIDADE.text = value[1];
|
||||
}
|
||||
});
|
||||
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{
|
||||
await ApiDataImportSigtap().loadSIGTAP(urlAPI, mode, nameCityApi).then((value)async{
|
||||
await DbSqliteSigtap().saveProceduresSigtapDB(value).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']);
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
});
|
||||
});
|
||||
});
|
||||
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{
|
||||
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){
|
||||
if(list.length!=0){
|
||||
for(int i = 0; list.length>i;i++){
|
||||
listCBO.add(list[i]['CODIGO_CBO'].toString());
|
||||
}
|
||||
}
|
||||
CBO_RESP_CADASTRO = list.length == 0?null:list[0]['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']}');
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getUser();
|
||||
loadLists();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -93,7 +225,7 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InputWithSubtitle(
|
||||
controller: professionalController,
|
||||
controller: NOME_PROFISSIONAL,
|
||||
subtitle: 'Profissional',
|
||||
errorInput: 'Campo Obrigatório',
|
||||
labelInput: 'Profissional',
|
||||
@@ -104,7 +236,7 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
InputWithSubtitle(
|
||||
controller: unitController,
|
||||
controller: CNES_UNIDADE,
|
||||
subtitle: 'Unidade',
|
||||
errorInput: 'Campo Obrigatório',
|
||||
labelInput: 'Unidade',
|
||||
@@ -115,7 +247,7 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
DropdownWithSubtitle(
|
||||
list: [],
|
||||
list: listCBO,
|
||||
widthSubtitle: width*0.7,
|
||||
subtitle: 'CBO',
|
||||
hintDropdown: 'CBO',
|
||||
@@ -130,20 +262,29 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
colorBorder: ColorPalette.white,
|
||||
),
|
||||
DropdownWithSubtitle(
|
||||
list: ['INE: 0001558536 / Área 4 - Microárea: - '],
|
||||
widthSubtitle: width*0.2,
|
||||
list: listINEPROF,
|
||||
widthSubtitle: width*0.3,
|
||||
subtitle: 'Código da Equipe',
|
||||
hintDropdown: 'Selecione',
|
||||
select: selectCodTeam,
|
||||
select: INE_RESP_CADASTRO,
|
||||
widthDropdown: width*0.7,
|
||||
widthContainerDropdown: width*0.4,
|
||||
widthContainerDropdown: width*0.5,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
selectCodTeam = value!;
|
||||
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(
|
||||
@@ -159,64 +300,84 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
width: width*0.7,
|
||||
child: TextDefault(
|
||||
text: date,
|
||||
color: ColorPalette.black54,
|
||||
fontSize: 18,
|
||||
color: Colors.black,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
DropdownWithSubtitle(
|
||||
list: ConstVariable().listServicePlace,
|
||||
list: listServicePlace,
|
||||
widthSubtitle: width*0.2,
|
||||
subtitle: 'Local de Atendimento',
|
||||
hintDropdown: 'Local de Atendimento',
|
||||
select: selectServicePlace,
|
||||
select: LOCAL_ATENDIMENTO,
|
||||
widthDropdown: width*0.7,
|
||||
widthContainerDropdown: width*0.6,
|
||||
onChanged: (value)=>setState(()=>selectServicePlace = value!),
|
||||
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,
|
||||
),
|
||||
DropdownWithSubtitle(
|
||||
list: ConstVariable().typeService,
|
||||
list: typeService,
|
||||
widthSubtitle: width*0.2,
|
||||
subtitle: 'Tipo de Atendimento',
|
||||
hintDropdown: 'Tipo de Atendimento',
|
||||
select: selectTypeService,
|
||||
select: TIPO_ATENDIMENTO,
|
||||
widthDropdown: width*0.7,
|
||||
widthContainerDropdown: width*0.6,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
selectTypeService = 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,
|
||||
),
|
||||
DropdownWithSubtitle(
|
||||
list: ['AD1','AD2','AD3'],
|
||||
list: typeModelService,
|
||||
widthSubtitle: width*0.2,
|
||||
subtitle: 'Modalidade',
|
||||
hintDropdown: 'Modalidade',
|
||||
select: selectModality,
|
||||
select: MODALIDADE,
|
||||
widthDropdown: width*0.7,
|
||||
widthContainerDropdown: width*0.6,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
selectModality = 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,
|
||||
),
|
||||
DropdownWithSubtitle(
|
||||
list: ['MANHÃ','TARDE','NOITE'],
|
||||
list: typeTurnService,
|
||||
widthSubtitle: width*0.2,
|
||||
subtitle: 'Turno',
|
||||
hintDropdown: 'Turno',
|
||||
select: selectRotation,
|
||||
select: TURNO,
|
||||
widthDropdown: width*0.7,
|
||||
widthContainerDropdown: width*0.6,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
selectRotation = 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,
|
||||
),
|
||||
@@ -274,15 +435,16 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
context,
|
||||
controllerSearchCondition,
|
||||
ListView.separated(
|
||||
itemCount: ConstVariable().CIAP.length,
|
||||
itemCount: listCIAP.length,
|
||||
separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
|
||||
itemBuilder: (context,index){
|
||||
return ListTile(
|
||||
onTap: ()=>setState(() {
|
||||
selectCIAP = ConstVariable().CIAP[index];
|
||||
CIAP_COD = listCIAP[index].cod;
|
||||
CIAP = listCIAP[index].cod.toString() +' - '+ listCIAP[index].title;
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
title: TextDefault(text: ConstVariable().CIAP[index],maxLines: 2,)
|
||||
title: TextDefault(text: listCIAP[index].cod.toString() +' - '+ listCIAP[index].title,maxLines: 2,fontSize: 15,color: Colors.black,)
|
||||
);
|
||||
},
|
||||
)
|
||||
@@ -291,8 +453,9 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
width: width*0.7,
|
||||
child: TextDefault(
|
||||
text: selectCIAP!=null?'CIAP $selectCIAP':'CIAP',
|
||||
color: ColorPalette.black54,
|
||||
text: CIAP!=null?'CIAP $CIAP':'CIAP',
|
||||
color:Colors.black,
|
||||
fontSize: 15,
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -301,15 +464,16 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
context,
|
||||
controllerSearchCID,
|
||||
ListView.separated(
|
||||
itemCount: ConstVariable().CID.length,
|
||||
itemCount: listCID.length,
|
||||
separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54),
|
||||
itemBuilder: (context,index){
|
||||
return ListTile(
|
||||
onTap: ()=>setState(() {
|
||||
selectCID = ConstVariable().CIAP[index];
|
||||
CID_COD =listCID[index].cod;
|
||||
CID = listCID[index].cod +' - '+ listCID[index].title;
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
title: TextDefault(text: ConstVariable().CID[index],maxLines: 2,)
|
||||
title: TextDefault(text: listCID[index].cod +' - '+ listCID[index].title,maxLines: 2,fontSize: 15,color: Colors.black,)
|
||||
);
|
||||
},
|
||||
)
|
||||
@@ -318,8 +482,9 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
width: width*0.7,
|
||||
child: TextDefault(
|
||||
text: selectCID!=null?'CID $selectCIAP':'CID',
|
||||
color: ColorPalette.black54,
|
||||
text: CID!=null?'CID $CIAP':'CID',
|
||||
color:Colors.black,
|
||||
fontSize: 15,
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -347,22 +512,22 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Container(
|
||||
width: width*0.7,
|
||||
height: heigth*1.1,
|
||||
height: heigth*1.2,
|
||||
child: ListView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: ConstVariable().proceduresModel.length,
|
||||
itemCount: ConstVariable().serviceHomeCheckProclist.length,
|
||||
itemBuilder: (context,index){
|
||||
proceduresModel.add(
|
||||
serviceProcModel.add(
|
||||
CheckModel(
|
||||
subtitle: ConstVariable().proceduresModel[index],
|
||||
subtitle: ConstVariable().serviceHomeCheckProclist[index],
|
||||
check: false
|
||||
)
|
||||
);
|
||||
return CheckBoxSubtitle(
|
||||
subtitle: proceduresModel[index].subtitle,
|
||||
checkbox:proceduresModel[index].check,
|
||||
subtitle: serviceProcModel[index].subtitle,
|
||||
checkbox:serviceProcModel[index].check,
|
||||
width: width*0.6,
|
||||
onChanged: (value)=>setState(()=>proceduresModel[index].check=value),
|
||||
onChanged: (value)=>setState(()=>serviceProcModel[index].check=value),
|
||||
);
|
||||
}
|
||||
),
|
||||
@@ -392,9 +557,14 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
width: width*0.7,
|
||||
child: Row(
|
||||
children: [
|
||||
TextDefault(text: 'Procedimento'),
|
||||
TextDefault(text: 'Procedimento',color: Colors.black,),
|
||||
Spacer(),
|
||||
IconButton(onPressed: (){}, icon: Icon(Icons.add_circle,color: ColorPalette.blackButton,))
|
||||
IconButton(
|
||||
icon: Icon(Icons.add_circle,color: ColorPalette.blackButton),
|
||||
onPressed: (){
|
||||
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', selectCBO, selectCBO, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -427,14 +597,22 @@ class _ServiceHomeScreenState extends State<ServiceHomeScreen> {
|
||||
Spacer(),
|
||||
DropdownWithSubtitle(
|
||||
colorBorder: ColorPalette.white,
|
||||
list: ConstVariable().listConduct,
|
||||
list: listConduct,
|
||||
subtitle: 'SELECIONE',
|
||||
select: selectConduct,
|
||||
widthDropdown: width*0.4,
|
||||
widthContainerDropdown: width*0.35,
|
||||
widthSubtitle: width*0.35,
|
||||
select: CONDUTA,
|
||||
widthDropdown: width*0.39,
|
||||
widthContainerDropdown: width*0.3,
|
||||
widthSubtitle: width*0.3,
|
||||
hintDropdown: 'SELECIONE',
|
||||
onChanged: (value)=>setState(()=>selectConduct=value),
|
||||
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(() {});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user