You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
543 lines
22 KiB
Dart
543 lines
22 KiB
Dart
import '../../models/patient_model.dart';
|
|
import 'package:doctor_app_flutter/routes.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
class PatientSearch extends StatefulWidget {
|
|
@override
|
|
_PatientSearchState createState() => _PatientSearchState();
|
|
}
|
|
|
|
class _PatientSearchState extends State<PatientSearch> {
|
|
final List<Map<String, String>> _patientType = [
|
|
{"text": "outPatiant", "val": "1"},
|
|
{"text": "Tomorrow Patient", "val": "2"},
|
|
{"text": "Referral", "val": "3"},
|
|
{"text": "Discharge", "val": "4"},
|
|
{"text": "InPatiant", "val": "5"},
|
|
{"text": "Referral Discharge", "val": "6"},
|
|
];
|
|
|
|
final List<Map<String, String>> _locations = [
|
|
{"text": "In Sudia Arabia", "val": "1"},
|
|
{"text": "Out Sudia Arabia", "val": "2"},
|
|
];
|
|
String _selectedType = '1';
|
|
String _selectedLocation = '1';
|
|
|
|
final _patientSearchForm = GlobalKey<FormState>();
|
|
var _patientSearchFormValues = PatientModel(
|
|
ProjectID: 12,
|
|
ClinicID: 17,
|
|
DoctorID: 98129,
|
|
FirstName: "0",
|
|
MiddleName: "0",
|
|
LastName: "0",
|
|
PatientMobileNumber: "0",
|
|
PatientIdentificationID: "0",
|
|
PatientID: 0,
|
|
From: "0",
|
|
To: "0",
|
|
LanguageID: 2,
|
|
stamp: "2020-03-02T13:56:39.170Z",
|
|
IPAdress: "11.11.11.11",
|
|
VersionID: 1.2,
|
|
Channel: 9,
|
|
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
|
|
SessionID: "5G0yXn0Jnq",
|
|
IsLoginForDoctorApp: true,
|
|
PatientOutSA: false);
|
|
|
|
void _saveForm() {
|
|
_patientSearchForm.currentState.save();
|
|
// Navigator.pushNamed(context,routeName)
|
|
Navigator.of(context).pushNamed(PATIENTS);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("Search Patient"),
|
|
),
|
|
body: SingleChildScrollView(
|
|
child: LayoutBuilder(builder: (ctx, constraints) {
|
|
var smallScreenSize = 660;
|
|
bool isSmallScreen = constraints.maxWidth <= smallScreenSize;
|
|
return Container(
|
|
padding: EdgeInsets.all(15),
|
|
width: constraints.maxWidth * 0.9,
|
|
child: Form(
|
|
key: _patientSearchForm,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(
|
|
'Patiant Type',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
border:
|
|
Border.all(color: Theme.of(context).primaryColor),
|
|
),
|
|
width: double.infinity,
|
|
child: DropdownButton(
|
|
value: _selectedType,
|
|
iconSize: 24,
|
|
elevation: 16,
|
|
selectedItemBuilder: (BuildContext context) {
|
|
return _patientType.map((item) {
|
|
return Text(item['text'], textAlign: TextAlign.end);
|
|
}).toList();
|
|
},
|
|
onChanged: (String newValue) => {
|
|
setState(() {
|
|
_selectedType = newValue;
|
|
})
|
|
},
|
|
items: _patientType.map((item) {
|
|
return DropdownMenuItem(
|
|
child: Text(
|
|
'${item['text']}',
|
|
textAlign: TextAlign.end,
|
|
),
|
|
value: item['val'],
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'First Name',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
hintText: 'First Name',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.FirstName = value;
|
|
},
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Middle Name',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
hintText: 'Middle Name',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.MiddleName = value;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Last Name',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
hintText: 'Last Name',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.LastName = value;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Phone Number',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
keyboardType: TextInputType.number,
|
|
decoration: InputDecoration(
|
|
hintText: 'Phone Number',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.PatientMobileNumber = value;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
// Container(child: GridView(gridDelegate: null,),)
|
|
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Patiant ID',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
keyboardType: TextInputType.number,
|
|
decoration: InputDecoration(
|
|
hintText: 'Patiant ID',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(20)),
|
|
borderSide:
|
|
BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.PatientID = int.parse(value);
|
|
}),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Patiant File',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
hintText: 'Patiant File',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
// _patientSearchFormValues. = value;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'From',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
hintText: 'From',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.From = value;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'TO',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
TextFormField(
|
|
decoration: InputDecoration(
|
|
hintText: 'To',
|
|
hintStyle: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 14
|
|
: constraints.maxWidth * 0.024),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius:
|
|
BorderRadius.all(Radius.circular(10.0)),
|
|
borderSide: BorderSide(
|
|
color: Theme.of(context).primaryColor),
|
|
)
|
|
//BorderRadius.all(Radius.circular(20));
|
|
),
|
|
validator: (value) {
|
|
if (value.isEmpty) {
|
|
return 'Please enter some text';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: (value) {
|
|
_patientSearchFormValues.To = value;
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
border:
|
|
Border.all(color: Theme.of(context).primaryColor),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
Checkbox(
|
|
value: true,
|
|
activeColor: Theme.of(context).primaryColor,
|
|
onChanged: (bool newValue) {}),
|
|
Text('Only Arrived Patient',
|
|
style: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 18
|
|
: constraints.maxWidth * 0.018)),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Patiant',
|
|
style: TextStyle(fontSize: 16),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
border:
|
|
Border.all(color: Theme.of(context).primaryColor),
|
|
),
|
|
width: double.infinity,
|
|
child: DropdownButton(
|
|
value: _selectedType,
|
|
iconSize: 24,
|
|
elevation: 16,
|
|
selectedItemBuilder: (BuildContext context) {
|
|
return _locations.map((item) {
|
|
return Text(item['text']);
|
|
}).toList();
|
|
},
|
|
onChanged: (String newValue) => {
|
|
setState(() {
|
|
_selectedType = newValue;
|
|
})
|
|
},
|
|
items: _locations.map((item) {
|
|
return DropdownMenuItem(
|
|
child: Text('${item['text']}'),
|
|
value: item['val'],
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
RaisedButton(
|
|
onPressed: () {
|
|
_saveForm();
|
|
},
|
|
textColor: Colors.white,
|
|
elevation: 0.0,
|
|
padding: const EdgeInsets.all(0.0),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
side: BorderSide(
|
|
width: 0.5, color: Hexcolor('#CCCCCC'))),
|
|
child: Container(
|
|
padding: const EdgeInsets.all(10.0),
|
|
height: 50,
|
|
width: 200,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: <Widget>[
|
|
Text('Search',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: isSmallScreen
|
|
? 20
|
|
: constraints.maxWidth * 0.020)),
|
|
Icon(Icons.search)
|
|
],
|
|
),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
));
|
|
}
|
|
}
|