|
|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
import 'package:barcode_scan/platform_wrapper.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patient_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/patients_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_button.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
@ -20,11 +22,13 @@ class QrReaderScreen extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
|
|
|
|
|
|
bool isLoading = false;
|
|
|
|
|
PatientModel patient = PatientModel(
|
|
|
|
|
ProjectID: 15,
|
|
|
|
|
ClinicID: 0,
|
|
|
|
|
DoctorID: 4709,
|
|
|
|
|
DoctorID: 1485,
|
|
|
|
|
FirstName: "0",
|
|
|
|
|
MiddleName: "0",
|
|
|
|
|
LastName: "0",
|
|
|
|
|
@ -103,24 +107,28 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
|
),
|
|
|
|
|
):Container(),
|
|
|
|
|
Column(
|
|
|
|
|
children: patientList.map((item) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: (){
|
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
|
|
|
|
|
"patient": item,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: CardWithBgWidget(
|
|
|
|
|
widget: Container(
|
|
|
|
|
child: AppText(
|
|
|
|
|
'${item.firstName} ${item.lastName}',
|
|
|
|
|
fontSize: 2.5 * SizeConfig.textMultiplier,
|
|
|
|
|
children: patientList.map((item) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: (){
|
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
|
|
|
|
|
"patient": item,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: AnimatedContainer(
|
|
|
|
|
duration: Duration(milliseconds: 200),
|
|
|
|
|
child: CardWithBgWidget(
|
|
|
|
|
widget: Container(
|
|
|
|
|
child: AppText(
|
|
|
|
|
'${item.firstName} ${item.lastName}',
|
|
|
|
|
fontSize: 2.5 * SizeConfig.textMultiplier,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}).toList()
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -134,51 +142,59 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
|
/// When give qr we will change this method to get data
|
|
|
|
|
/// var result = await BarcodeScanner.scan();
|
|
|
|
|
/// int patientID = get from qr result
|
|
|
|
|
String patientType = "1";
|
|
|
|
|
setState(() {
|
|
|
|
|
isLoading = true;
|
|
|
|
|
patientList = [];
|
|
|
|
|
});
|
|
|
|
|
patient.PatientID = 3120144;
|
|
|
|
|
Provider.of<PatientsProvider>(context, listen: false)
|
|
|
|
|
.getPatientList(patient, "1")
|
|
|
|
|
.then((response) {
|
|
|
|
|
if (response['MessageStatus'] == 1) {
|
|
|
|
|
switch (patientType) {
|
|
|
|
|
case "0":
|
|
|
|
|
if (response['List_MyOutPatient'] != null) {
|
|
|
|
|
setState(() {
|
|
|
|
|
patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list;
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
error = 'No patient';
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "1":
|
|
|
|
|
if (response['List_MyInPatient'] != null) {
|
|
|
|
|
setState(() {
|
|
|
|
|
patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
|
|
|
|
|
isLoading = false;
|
|
|
|
|
error="";
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
error = 'No patient';
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
var result = await BarcodeScanner.scan();
|
|
|
|
|
// if (result.rawContent == "") {
|
|
|
|
|
List<String> listOfParams = result.rawContent.split(',');
|
|
|
|
|
String patientType = "1";
|
|
|
|
|
setState(() {
|
|
|
|
|
isLoading = true;
|
|
|
|
|
patientList = [];
|
|
|
|
|
});
|
|
|
|
|
String token = await sharedPref.getString(TOKEN);
|
|
|
|
|
patient.PatientID = 3120269;
|
|
|
|
|
patient.TokenID = token;
|
|
|
|
|
Provider.of<PatientsProvider>(context, listen: false)
|
|
|
|
|
.getPatientList(patient, "1")
|
|
|
|
|
.then((response) {
|
|
|
|
|
if (response['MessageStatus'] == 1) {
|
|
|
|
|
switch (patientType) {
|
|
|
|
|
case "0":
|
|
|
|
|
if (response['List_MyOutPatient'] != null) {
|
|
|
|
|
setState(() {
|
|
|
|
|
patientList = ModelResponse
|
|
|
|
|
.fromJson(response['List_MyOutPatient'])
|
|
|
|
|
.list;
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
error = 'No patient';
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "1":
|
|
|
|
|
if (response['List_MyInPatient'] != null) {
|
|
|
|
|
setState(() {
|
|
|
|
|
patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
|
|
|
|
|
isLoading = false;
|
|
|
|
|
error = "";
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
error = 'No patient';
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
error = response['ErrorMessage'] ?? response['ErrorEndUserMessage'];
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
error = response['ErrorMessage'] ?? response['ErrorEndUserMessage'];
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|