|
|
|
@ -15,6 +15,7 @@ import '../../../util/dr_app_shared_pref.dart';
|
|
|
|
|
import '../../../widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import '../../../widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import '../../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
|
import '../../../util/extenstions.dart';
|
|
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
|
|
|
|
|
@ -37,6 +38,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
final _remarksController = TextEditingController();
|
|
|
|
|
final _extController = TextEditingController();
|
|
|
|
|
var _isInit = true;
|
|
|
|
|
bool isValid;
|
|
|
|
|
|
|
|
|
|
var clinicId;
|
|
|
|
|
var doctorId;
|
|
|
|
@ -49,10 +51,13 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
List<String> _priorities = ['Very Urgent', 'Urgent', 'Routine'];
|
|
|
|
|
int _activePriority = 2;
|
|
|
|
|
|
|
|
|
|
FocusNode myFocusNode;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
if (_isInit) {
|
|
|
|
|
myFocusNode = FocusNode();
|
|
|
|
|
doctorsList = null;
|
|
|
|
|
patientsProv = Provider.of<PatientsProvider>(context);
|
|
|
|
|
patientsProv.getClinicsList();
|
|
|
|
@ -70,8 +75,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
: patientsProv.isError
|
|
|
|
|
? DrAppEmbeddedError(error: patientsProv.error)
|
|
|
|
|
: patientsProv.clinicsList == null
|
|
|
|
|
? DrAppEmbeddedError(
|
|
|
|
|
error: 'Something Wrong!')
|
|
|
|
|
? DrAppEmbeddedError(error: 'Something Wrong!')
|
|
|
|
|
: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
@ -128,13 +132,17 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
_selectedClinic = newValue;
|
|
|
|
|
var clinicInfo = patientsProv.clinicsList.where((i) =>
|
|
|
|
|
var clinicInfo = patientsProv
|
|
|
|
|
.clinicsList
|
|
|
|
|
.where((i) =>
|
|
|
|
|
i['ClinicDescription']
|
|
|
|
|
.toString()
|
|
|
|
|
.contains(_selectedClinic)).toList();
|
|
|
|
|
.contains(
|
|
|
|
|
_selectedClinic))
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
clinicId =
|
|
|
|
|
clinicInfo[0]['ClinicID'].toString();
|
|
|
|
|
clinicId = clinicInfo[0]['ClinicID']
|
|
|
|
|
.toString();
|
|
|
|
|
|
|
|
|
|
patientsProv.getDoctorsList(clinicId);
|
|
|
|
|
})
|
|
|
|
@ -208,15 +216,16 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
onChanged: (newValue) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = newValue;
|
|
|
|
|
doctorsList = patientsProv.doctorsList;
|
|
|
|
|
doctorsList =
|
|
|
|
|
patientsProv.doctorsList;
|
|
|
|
|
|
|
|
|
|
var doctorInfo =
|
|
|
|
|
doctorsList.where((i) =>
|
|
|
|
|
i['DoctorName']
|
|
|
|
|
var doctorInfo = doctorsList
|
|
|
|
|
.where((i) => i['DoctorName']
|
|
|
|
|
.toString()
|
|
|
|
|
.contains(_selectedDoctor)).toList();
|
|
|
|
|
doctorId = doctorInfo[0]['DoctorID'].toString();
|
|
|
|
|
|
|
|
|
|
.contains(_selectedDoctor))
|
|
|
|
|
.toList();
|
|
|
|
|
doctorId = doctorInfo[0]['DoctorID']
|
|
|
|
|
.toString();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: patientsProv
|
|
|
|
@ -320,13 +329,16 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
onChanged: (newValue) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedReferralFrequancy = newValue;
|
|
|
|
|
var freqInfo =
|
|
|
|
|
patientsProv.referalFrequancyList.singleWhere((i) =>
|
|
|
|
|
i['Description']
|
|
|
|
|
var freqInfo = patientsProv
|
|
|
|
|
.referalFrequancyList
|
|
|
|
|
.singleWhere((i) => i[
|
|
|
|
|
'Description']
|
|
|
|
|
.toString()
|
|
|
|
|
.contains(_selectedReferralFrequancy));
|
|
|
|
|
freqId =
|
|
|
|
|
freqInfo['ParameterCode'].toString();
|
|
|
|
|
.contains(
|
|
|
|
|
_selectedReferralFrequancy));
|
|
|
|
|
freqId = freqInfo['ParameterCode']
|
|
|
|
|
.toString();
|
|
|
|
|
myFocusNode.requestFocus();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
items: patientsProv
|
|
|
|
@ -357,6 +369,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
hintText: "Remarks",
|
|
|
|
|
focusNode: myFocusNode,
|
|
|
|
|
controller: _remarksController,
|
|
|
|
|
inputFormatter: ONLY_LETTERS,
|
|
|
|
|
textInputType: TextInputType.text,
|
|
|
|
@ -365,11 +378,24 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(20.0),
|
|
|
|
|
child: AppButton(title: "Send", color: Color(PRIMARY_COLOR),onPressed: ()=>{
|
|
|
|
|
referToDoctor(context)
|
|
|
|
|
},),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
"Please fill all fields..!",
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
margin: 10,
|
|
|
|
|
visibility:
|
|
|
|
|
isValid == null ? false : !isValid,
|
|
|
|
|
),
|
|
|
|
|
AppButton(
|
|
|
|
|
title: "Send",
|
|
|
|
|
color: Color(PRIMARY_COLOR),
|
|
|
|
|
onPressed: () => {referToDoctor(context)},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
@ -456,12 +482,16 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
return time;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void referToDoctor(context){
|
|
|
|
|
void referToDoctor(context) {
|
|
|
|
|
if (!validation()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
|
|
|
patientsProv.referToDoctor(context,
|
|
|
|
|
extension: _extController.value.text,
|
|
|
|
|
admissionNo:int.parse( patient.admissionNo),
|
|
|
|
|
admissionNo: int.parse(patient.admissionNo),
|
|
|
|
|
referringDoctorRemarks: _remarksController.value.text,
|
|
|
|
|
frequency: freqId,
|
|
|
|
|
patientID: patient.patientId,
|
|
|
|
@ -470,7 +500,17 @@ class _ReferPatientState extends State<ReferPatientScreen> {
|
|
|
|
|
roomID: patient.roomId,
|
|
|
|
|
selectedClinicID: clinicId.toString(),
|
|
|
|
|
selectedDoctorID: doctorId.toString(),
|
|
|
|
|
projectID: patient.projectId
|
|
|
|
|
);
|
|
|
|
|
projectID: patient.projectId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool validation() {
|
|
|
|
|
setState(() {
|
|
|
|
|
isValid = !_extController.value.text.isNullOrEmpty() &&
|
|
|
|
|
!_remarksController.value.text.isNullOrEmpty() &&
|
|
|
|
|
freqId != null &&
|
|
|
|
|
clinicId != null &&
|
|
|
|
|
doctorId != null;
|
|
|
|
|
});
|
|
|
|
|
return isValid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|