From 5e7526f2c70c54697d42d94ae9ecda1d072f713f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 27 Apr 2020 18:07:03 +0300 Subject: [PATCH] vital sign screen --- lib/models/{ => patient}/patient_model.dart | 0 lib/models/patient/vital_sign_req_model.dart | 77 ++++++++ lib/providers/patients_provider.dart | 52 +++++- lib/screens/auth/login_screen.dart | 2 +- .../patients/patient_search_screen.dart | 2 +- .../patients/patients_list_screen.dart | 5 +- lib/screens/patients/patients_screen.dart | 175 ++++++++---------- .../profile/vital_sign/vital_sign_screen.dart | 82 ++++---- lib/util/helpers.dart | 16 +- lib/widgets/auth/verfiy_account.dart | 2 +- lib/widgets/patients/dynamic_elements.dart | 2 +- .../profile/Profile_general_info_Widget.dart | 19 +- .../profile/patient_profile_widget.dart | 71 +++---- .../profile/profile_header_widget.dart | 15 +- .../profile/profile_medical_info_widget.dart | 3 +- 15 files changed, 320 insertions(+), 203 deletions(-) rename lib/models/{ => patient}/patient_model.dart (100%) create mode 100644 lib/models/patient/vital_sign_req_model.dart diff --git a/lib/models/patient_model.dart b/lib/models/patient/patient_model.dart similarity index 100% rename from lib/models/patient_model.dart rename to lib/models/patient/patient_model.dart diff --git a/lib/models/patient/vital_sign_req_model.dart b/lib/models/patient/vital_sign_req_model.dart new file mode 100644 index 00000000..0c3592b8 --- /dev/null +++ b/lib/models/patient/vital_sign_req_model.dart @@ -0,0 +1,77 @@ + +/* + *@author: Elham Rababah + *@Date:27/4/2020 + *@param: + *@return: + *@desc: VitalSignReqModel + */ +class VitalSignReqModel { + int patientID; + int projectID; + int patientTypeID; + int inOutpatientType; + int transNo; + int languageID; + String stamp ; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + VitalSignReqModel( + {this.patientID, + this.projectID, + this.inOutpatientType, + this.transNo, + this.languageID, + this.tokenID, + this.stamp = '2020-04-26T09:32:18.317Z', + this.iPAdress='11.11.11.11', + this.versionID=1.2, + this.channel=9, + this.sessionID='E2bsEeYEJo', + this.isLoginForDoctorApp=true, + this.patientTypeID, + this.patientOutSA=false}); + + VitalSignReqModel.fromJson(Map json) { + projectID = json['ProjectID']; + patientID = json['PatientID']; + languageID = json['LanguageID']; + inOutpatientType = json['InOutpatientType']; + transNo = json['TransNo']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['InOutpatientType'] = this.inOutpatientType; + data['TransNo'] = this.transNo; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + return data; + } + +} diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index e349e024..3d3d8e05 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -1,18 +1,28 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart'; import '../interceptor/http_interceptor.dart'; -import '../models/patient_model.dart'; -const GET_PATIENT_VITAL_SIGN = 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_VITAL_SIGN = + BASE_URL + 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; class PatientsProvider with ChangeNotifier { + bool isLoading = true; + bool isError = false; + String error = ''; + List patientVitalSignList = []; Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); + + PatiantInformtion _selectedPatient; + Future getPatientList(PatientModel patient, patientType) async { /* const url = BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ @@ -63,13 +73,43 @@ class PatientsProvider with ChangeNotifier { *@return:Future *@desc: getPatientVitalSign */ - Future getPatientVitalSign(patient) async { + getPatientVitalSign(patient) async { try { - final response = - await client.post(GET_PATIENT_VITAL_SIGN, body: json.encode(patient)); - return Future.value(json.decode(response.body)); + if (await Helpers.checkConnection()) { + final response = await client.post(GET_PATIENT_VITAL_SIGN, + body: json.encode(patient)); + final int statusCode = response.statusCode; + isLoading = false; + + if (statusCode < 200 || statusCode >= 400 || json == null) { + isError = true; + error = 'Error While Fetching data'; + } else { + var res = json.decode(response.body); + print('$res'); + if (res['MessageStatus'] == 1) { + patientVitalSignList = res['List_DoctorPatientVitalSign']; + } else { + isError = true; + error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; + } + } + } else { + isLoading = false; + isError = true; + error = 'Please Check The Internet Connection'; + } } catch (error) { throw error; } } + + PatiantInformtion getSelectedPatient() { + return _selectedPatient; + } + + setSelectedPatient(PatiantInformtion patient) { + // return _selectedPatient; + _selectedPatient = patient; + } } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index e21498d5..c203dae9 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -72,7 +72,7 @@ class _LoginsreenState extends State { return Text('Error: ${snapshot.error}'); } else { return Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 30), alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 5e90847c..8966fefc 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/services.dart'; @@ -13,7 +14,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import '../../lookups/patient_lookup.dart'; -import '../../models/patient_model.dart'; import '../../widgets/patients/dynamic_elements.dart'; import '../../config/config.dart'; diff --git a/lib/screens/patients/patients_list_screen.dart b/lib/screens/patients/patients_list_screen.dart index be3b2a86..6d0b97a8 100644 --- a/lib/screens/patients/patients_list_screen.dart +++ b/lib/screens/patients/patients_list_screen.dart @@ -1,8 +1,9 @@ -import '../../models/patient_model.dart'; -import '../../providers/patients_provider.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../providers/patients_provider.dart'; + class PatientsListScreen extends StatefulWidget { @override _PatientsListScreenState createState() => _PatientsListScreenState(); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index f5c2efe2..652b74e9 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -6,7 +6,7 @@ *@desc: */ -import 'package:doctor_app_flutter/models/patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/patients/TopTenUsersModelResponse.dart'; @@ -30,12 +30,11 @@ class PatientsScreen extends StatefulWidget { } class _PatientsScreenState extends State { - List litems; - //******************* - List responseModelList; - //List> litems2; - //******************* - + List litems; + //******************* + List responseModelList; + //List> litems2; + //******************* bool _isInit = true; @@ -45,21 +44,21 @@ class _PatientsScreenState extends State { //*******Amjad add to search box****** final _controller = TextEditingController(); //************** - PatientModel patient; - + PatientModel patient; + @override void didChangeDependencies() { final routeArgs = ModalRoute.of(context).settings.arguments as Map; //PatientModel patient = routeArgs['patientSearchForm']; - patient = routeArgs['patientSearchForm']; - + patient = routeArgs['patientSearchForm']; + //PatiantInformtion patiantInfo = routeArgs['patientSearchForm']; - print(patient.TokenID+"EEEEEE"); + print(patient.TokenID + "EEEEEE"); String patientType = routeArgs['selectedType']; print("**************patiant Type**************"); print(patientType); - print("**************test**************"); + print("**************test**************"); if (_isInit) { // setState(() {}); PatientsProvider patientsProv = Provider.of(context); @@ -67,20 +66,20 @@ class _PatientsScreenState extends State { // print('MessageStatus${res['MessageStatus']}'); print('List_MyInPatient${(res['List_MyInPatient'])}'); setState(() { - int val2=int.parse(patientType); - litems =res[SERVICES_PATIANT2[val2]];//res['List_MyInPatient']; + int val2 = int.parse(patientType); + litems = res[SERVICES_PATIANT2[val2]]; //res['List_MyInPatient']; //******************** - // litems2=res[SERVICES_PATIANT2[val2]]; - //PatiantInformtion - //List responseModelList = new PatiantInformtion.fromJson(litems).;//TopTenUsersModelResponse.fromJson(parsed).list; - final List parsed = litems;//json.decode(response.body); - //List responseModelList = new TopTenUsersModelResponse.fromJson(parsed).list; - // List responseModelList = new TopTenUsersModelResponse.fromJson(parsed).list; - responseModelList = new TopTenUsersModelResponse.fromJson(parsed).list; + // litems2=res[SERVICES_PATIANT2[val2]]; + //PatiantInformtion + //List responseModelList = new PatiantInformtion.fromJson(litems).;//TopTenUsersModelResponse.fromJson(parsed).list; + final List parsed = litems; //json.decode(response.body); + //List responseModelList = new TopTenUsersModelResponse.fromJson(parsed).list; + // List responseModelList = new TopTenUsersModelResponse.fromJson(parsed).list; + responseModelList = + new TopTenUsersModelResponse.fromJson(parsed).list; //******************** _isLoading = false; - _hasError = res['ErrorEndUserMessage']; - + _hasError = res['ErrorEndUserMessage']; }); print(res); }).catchError((error) { @@ -93,60 +92,73 @@ class _PatientsScreenState extends State { @override Widget build(BuildContext context) { + PatientsProvider patientsProv = Provider.of(context); + return AppScaffold( - appBarTitle: 'Patients', - //***********Modify by amjad (create List view to insert all new data webservise in scroll )************* - body: Container(child:ListView( - scrollDirection: Axis.vertical, - children: [ - Container( - //child:litems == null?Column():Column(children: [ - child:litems == null?Column():Column(children: [ - Container( - width: SizeConfig.screenWidth * 0.80, - child: TextField( - controller: _controller, - onSubmitted: (value) { - // fetch all the news related to the keyword - if (value.isNotEmpty) { - // vm.search(value); - } - }, - decoration: buildInputDecoration( - context, 'Search patiant'), + appBarTitle: 'Patients', + //***********Modify by amjad (create List view to insert all new data webservise in scroll )************* + body: Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + //child:litems == null?Column():Column(children: [ + child: litems == null + ? Column() + : Column( + children: [ + Container( + width: SizeConfig.screenWidth * 0.80, + child: TextField( + controller: _controller, + onSubmitted: (value) { + // fetch all the news related to the keyword + if (value.isNotEmpty) { + // vm.search(value); + } + }, + decoration: + buildInputDecoration(context, 'Search patiant'), + ), ), - ), - Column(children: responseModelList.map((PatiantInformtion item) { - return InkWell( - child: CardWithBgWidget( - - line1Text:item.nationalityName,//item['FirstName'],//patient.getFirstName(),//item['FirstName'], - line2Text:item.lastName, //responseModelList['LastName'],//item['LastName'],//'12/04/2020 - 02:00 PM', - // line3Text: item.middleName, - heightPercentage: 0.15, - widthPercentage: 0.80), - onTap: (){ - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {"patient": responseModelList}); - }, - ); - }).toList()) + Column( + children: + responseModelList.map((PatiantInformtion item) { + return InkWell( + child: CardWithBgWidget( + line1Text: item + .nationalityName, //item['FirstName'],//patient.getFirstName(),//item['FirstName'], + line2Text: item + .lastName, //responseModelList['LastName'],//item['LastName'],//'12/04/2020 - 02:00 PM', + // line3Text: item.middleName, + heightPercentage: 0.15, + widthPercentage: 0.80), + onTap: () => + tapOnPatient(context, item, patientsProv), + ); + }).toList()) + ], + ), + ), ], - - ), - ), - ], - )) - ); + ))); + } + + void tapOnPatient(BuildContext context, PatiantInformtion patient, + PatientsProvider patientsProv) { + patientsProv.setSelectedPatient(patient); + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: {"patient": patient}); } //***********amjad update************* - InputDecoration buildInputDecoration(BuildContext context, hint) { + InputDecoration buildInputDecoration(BuildContext context, hint) { return InputDecoration( - prefixIcon:Icon(Icons.search,color: Colors.red), + prefixIcon: Icon(Icons.search, color: Colors.red), filled: true, fillColor: Colors.white, //Image.asset(asset), - /* icon: Padding( + /* icon: Padding( padding: const EdgeInsets.all(8.0), child: Icon(Icons.search), ),*/ @@ -164,30 +176,5 @@ class _PatientsScreenState extends State { } //************* } - //*********************** +//*********************** - -class CustomShapeClipper extends CustomClipper { - @override - Path getClip(Size size) { - final Path path = Path(); - path.lineTo(0.0, size.height); - - var firstEndPoint = Offset(size.width * .5, size.height / 2); - var firstControlpoint = Offset(size.width * 0.25, size.height * 0.95 + 30); - path.quadraticBezierTo(firstControlpoint.dx, firstControlpoint.dy, - firstEndPoint.dx, firstEndPoint.dy); - - var secondEndPoint = Offset(size.width, size.height * 0.10); - var secondControlPoint = Offset(size.width * .75, size.height * .10 - 20); - path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, - secondEndPoint.dx, secondEndPoint.dy); - - path.lineTo(size.width, 0.0); - path.close(); - return path; - } - - @override - bool shouldReclip(CustomClipper oldClipper) => true; -} diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart index bc7cf633..e92abf53 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/models/patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign_req_model.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -30,62 +32,48 @@ class _VitalSignScreenState extends State { "1", ]; - var _isLoading = true; - var _hasError; - var _isInit = true; - - @override - void didChangeDependencies() { + PatientsProvider getVitalSignList(context, PatientsProvider patientsProv) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; - var patient = routeArgs['patient']; - print(patient); - // String patientType = routeArgs['selectedType']; - // print(patientType); + PatiantInformtion patient = routeArgs['patient']; sharedPref.getString(TOKEN).then((token) { - print(token); - var model = { - "PatientID": patient['PatientID'], - "ProjectID": patient['ProjectID'], - "PatientTypeID": patient['PatientType'], - "InOutPatientType": 1, - "TransNo":patient['AdmissionNo'] !=null ? int.parse(patient['AdmissionNo']) : 0, - "LanguageID": 2, - "stamp": "2020-04-26T09:32:18.317Z", - "IPAdress": "11.11.11.11", - "VersionID": 1.2, - "Channel": 9, - "TokenID": token, - "SessionID": "E2bsEeYEJo", - "IsLoginForDoctorApp": true, - "PatientOutSA": false - }; - if (_isInit) { - PatientsProvider patientsProv = Provider.of(context); - patientsProv.getPatientVitalSign(model).then((res) { - print('wwww'); - debugPrint("${res}"); - setState(() { - _isLoading = false; - _hasError = res['ErrorEndUserMessage']; - }); - print(res); - }).catchError((error) { - print(error); - }); - } - _isInit = false; + VitalSignReqModel vitalSignReqModel = VitalSignReqModel( + patientID: patient.patientId, + projectID: patient.projectId, + tokenID: token, + patientTypeID: patient.patientType, + inOutpatientType: 1, + languageID: 2, + transNo: + patient.admissionNo != null ? int.parse(patient.admissionNo) : 0); + patientsProv.getPatientVitalSign(vitalSignReqModel.toJson()); + return patientsProv; }); - - super.didChangeDependencies(); } @override Widget build(BuildContext context) { + PatientsProvider patientsProv = Provider.of(context); + + getVitalSignList(context, patientsProv); return AppScaffold( appBarTitle: "VITAL SIGN", - body: Container( + body: patientsProv.isLoading?DrAppCircularProgressIndeicator():patientsProv.isError + ? Center( + child: Text( + patientsProv.error, + style: TextStyle(color: Theme.of(context).errorColor), + ), + ) + : patientsProv.patientVitalSignList.length == 0 + ? Center( + child: Text( + 'You don\'t have any Schedule', + style: TextStyle(color: Theme.of(context).errorColor), + ), + ) + :Container( child: Column( - children: litems.map((item) { + children: patientsProv.patientVitalSignList.map((item) { return InkWell( child: CardWithBgWidget( line1Text: 'Fahad AlSlehm - 324599', diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index a84ec362..a0a54c72 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -6,8 +6,8 @@ import '../util/dr_app_toast_msg.dart'; import 'package:connectivity/connectivity.dart'; - DrAppToastMsg toastMsg = DrAppToastMsg(); + /* *@author: Elham Rababah *@Date:12/4/2020 @@ -48,8 +48,7 @@ class Helpers { children: items.map((item) { return Text( '${item["$decKey"]}', - style: - TextStyle(color: Theme.of(context).primaryColor, fontSize: 20), + style: TextStyle(fontSize: 20), ); }).toList(), @@ -63,6 +62,13 @@ class Helpers { ); } +/* + *@author: Elham Rababah + *@Date:12/4/2020 + *@param: msg + *@return: + *@desc: showErrorToast +*/ showErrorToast([msg = null]) { String localMsg = 'Something wrong happened, please contact the admin'; @@ -80,9 +86,9 @@ class Helpers { *@return: Boolean *@desc: Check The Internet Connection */ - static Future checkConnection() async { + static Future checkConnection() async { ConnectivityResult connectivityResult = - await (Connectivity().checkConnectivity()); + await (Connectivity().checkConnectivity()); if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) { return true; diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index bf050556..514a284b 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -253,7 +253,7 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit3'] + verifyAccountFormValue['digit4']; print(activationCode); - + print('${_loggedUser}'); Map model = { "activationCode": activationCode, "DoctorID": _loggedUser['DoctorID'], diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index 443c7385..f8e3e6ac 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/models/patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; diff --git a/lib/widgets/patients/profile/Profile_general_info_Widget.dart b/lib/widgets/patients/profile/Profile_general_info_Widget.dart index 5e4b22d7..767e5377 100644 --- a/lib/widgets/patients/profile/Profile_general_info_Widget.dart +++ b/lib/widgets/patients/profile/Profile_general_info_Widget.dart @@ -1,4 +1,7 @@ +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import './profile_general_info_content_widget.dart'; import '../../../config/size_config.dart'; @@ -12,26 +15,28 @@ import '../../shared/rounded_container_widget.dart'; *@desc: Profile General Info Widget class */ class ProfileGeneralInfoWidget extends StatelessWidget { - const ProfileGeneralInfoWidget({ - Key key, - }) : super(key: key); + ProfileGeneralInfoWidget({Key key, this.patient}) : super(key: key); + + PatiantInformtion patient; @override Widget build(BuildContext context) { + // PatientsProvider patientsProv = Provider.of(context); + // patient = patientsProv.getSelectedPatient(); return RoundedContainer( child: ListView( children: [ ProfileGeneralInfoContentWidget( title: "Age", - info: '55 Yr', + info: '${patient.age}', ), ProfileGeneralInfoContentWidget( title: "Contact Number", - info: '00 966 5000000000', + info: '${patient.mobileNumber}', ), ProfileGeneralInfoContentWidget( title: "Email", - info: 'Elham@yahoo.com', + info: '${patient.emailAddress}', ), ], ), @@ -39,4 +44,4 @@ class ProfileGeneralInfoWidget extends StatelessWidget { height: SizeConfig.screenHeight * 0.25, ); } -} \ No newline at end of file +} diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index c0d09210..5dd70fb9 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; import 'package:flutter/material.dart'; import './Profile_general_info_Widget.dart'; @@ -13,42 +14,48 @@ import './profile_status_info_widget.dart'; *@desc: Patient Profile Widget */ class PatientProfileWidget extends StatelessWidget { - Map patient = { - "ProjectID": 15, - "ClinicID": null, - "DoctorID": 70907, - "PatientID": 3315674, - "DoctorName": "MOQBIL ABDULLAH AL HODAITHY", - "DoctorNameN": null, - "FirstName": "WALEED", - "MiddleName": "ALI", - "LastName": "AL-YAZIDI", - "FirstNameN": null, - "MiddleNameN": null, - "LastNameN": null, - "Gender": 1, - "DateofBirth": "/Date(534286800000+0300)/", - "NationalityID": null, - "MobileNumber": "0500014559", - "EmailAddress": "unknown@unknown.com", - "PatientIdentificationNo": "1063236754", - "NationalityName": "Saudi", - "NationalityNameN": null, - "PatientStatusType": null, - "PatientType": 1, - "AppointmentDate": "/Date(1587848400000+0300)/", - "StartTime": "13:00:00", - "Age": "34 Yr", - "ClinicDescription": "INTERNAL MEDICINE CLINIC", - "GenderDescription": "Male", - "AdmissionDate": "/Date(1587848400000+0300)/", - "AdmissionNo": "2020008652" - }; + // Map patient = { + // "ProjectID": 15, + // "ClinicID": null, + // "DoctorID": 70907, + // "PatientID": 3315674, + // "DoctorName": "MOQBIL ABDULLAH AL HODAITHY", + // "DoctorNameN": null, + // "FirstName": "WALEED", + // "MiddleName": "ALI", + // "LastName": "AL-YAZIDI", + // "FirstNameN": null, + // "MiddleNameN": null, + // "LastNameN": null, + // "Gender": 1, + // "DateofBirth": "/Date(534286800000+0300)/", + // "NationalityID": null, + // "MobileNumber": "0500014559", + // "EmailAddress": "unknown@unknown.com", + // "PatientIdentificationNo": "1063236754", + // "NationalityName": "Saudi", + // "NationalityNameN": null, + // "PatientStatusType": null, + // "PatientType": 1, + // "AppointmentDate": "/Date(1587848400000+0300)/", + // "StartTime": "13:00:00", + // "Age": "34 Yr", + // "ClinicDescription": "INTERNAL MEDICINE CLINIC", + // "GenderDescription": "Male", + // "AdmissionDate": "/Date(1587848400000+0300)/", + // "AdmissionNo": "2020008652" + // }; + + PatiantInformtion patient; + + @override Widget build(BuildContext context) { + final routeArgs =ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; return ListView(padding: EdgeInsets.zero, children: [ ProfileHeaderWidget(patient: patient), - ProfileGeneralInfoWidget(), + ProfileGeneralInfoWidget(patient: patient), ProfileMedicalInfoWidget(patient: patient), ProfileStatusInfoWidget() ]); diff --git a/lib/widgets/patients/profile/profile_header_widget.dart b/lib/widgets/patients/profile/profile_header_widget.dart index 6e3d17c3..bceb8bfe 100644 --- a/lib/widgets/patients/profile/profile_header_widget.dart +++ b/lib/widgets/patients/profile/profile_header_widget.dart @@ -1,5 +1,8 @@ +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; import '../../../config/size_config.dart'; import '../../shared/profile_image_widget.dart'; @@ -12,25 +15,27 @@ import '../../shared/profile_image_widget.dart'; *@desc: Profile Header Widget class */ class ProfileHeaderWidget extends StatelessWidget { - const ProfileHeaderWidget({ + ProfileHeaderWidget({ Key key, this.patient }) : super(key: key); - final patient; + + PatiantInformtion patient; @override Widget build(BuildContext context) { + // PatientsProvider patientsProv = Provider.of(context); + // patient = patientsProv.getSelectedPatient(); return Container( height: SizeConfig.heightMultiplier * 30, child: ProfileImageWidget( url: "http://images4.fanpop.com/image/photos/16200000/David-Schwimmer-Ross-Geller-ross-geller-16258927-629-779.jpg", - name: patient['FirstName']+' '+patient['LastName'] , - des: patient['FirstName'], + name: patient.firstName + ' ' + patient.lastName, + des: patient.patientId.toString(), height: SizeConfig.heightMultiplier * 17, width: SizeConfig.heightMultiplier * 17, color: Hexcolor('#58434F')), ); } } - diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index c0c2d0fe..80175001 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -15,7 +16,7 @@ import '../../shared/rounded_container_widget.dart'; */ class ProfileMedicalInfoWidget extends StatelessWidget { ProfileMedicalInfoWidget({Key key, this.patient}) : super(key: key); - Map patient; + PatiantInformtion patient; @override Widget build(BuildContext context) { String url = "assets/images/";