From 691e7dbac64fc1fc68e491bdb8fa02836ddcdb66 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 27 Apr 2020 12:21:00 +0300 Subject: [PATCH] first step in vital sign and fix some thing in master --- lib/providers/patients_provider.dart | 35 ++++-- lib/routes.dart | 17 ++- lib/screens/patients/patients_screen.dart | 2 +- .../profile/vital_sign/vital_sign_screen.dart | 104 ++++++++++++++++++ .../profile/patient_profile_widget.dart | 35 +++++- .../profile/profile_header_widget.dart | 6 +- .../profile/profile_medical_info_widget.dart | 32 ++++-- lib/widgets/shared/app_scaffold_widget.dart | 2 +- 8 files changed, 198 insertions(+), 35 deletions(-) create mode 100644 lib/screens/patients/profile/vital_sign/vital_sign_screen.dart diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 942685da..e349e024 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -8,19 +8,21 @@ 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'; + class PatientsProvider with ChangeNotifier { Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); Future getPatientList(PatientModel patient, patientType) async { - /* const url = + /* const url = BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ - // var srvicePatiant = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; - // print("a=SERVICES_PATIANT[patientType]========='=======a"); - int val=int.parse(patientType); - final url = BASE_URL+'DoctorApplication.svc/REST/'+SERVICES_PATIANT[val]; - // print("a===========$url=======a"); - - + // var srvicePatiant = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; + // print("a=SERVICES_PATIANT[patientType]========='=======a"); + int val = int.parse(patientType); + final url = + BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; + // print("a===========$url=======a"); + try { final response = await client.post(url, body: json.encode({ @@ -53,4 +55,21 @@ class PatientsProvider with ChangeNotifier { throw error; } } + +/* + *@author: Elham Rababah + *@Date:27/4/2020 + *@param: + *@return:Future + *@desc: getPatientVitalSign + */ + Future getPatientVitalSign(patient) async { + try { + final response = + await client.post(GET_PATIENT_VITAL_SIGN, body: json.encode(patient)); + return Future.value(json.decode(response.body)); + } catch (error) { + throw error; + } + } } diff --git a/lib/routes.dart b/lib/routes.dart index 0ee97b2f..383a311a 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,6 +1,3 @@ - -import 'package:doctor_app_flutter/screens/patients/patients_list_screen.dart'; - import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; import './screens/auth/login_screen.dart'; @@ -14,17 +11,17 @@ import './screens/my_schedule_screen.dart'; import './screens/patients/patient_profile_screen.dart'; import './screens/patients/patient_search_screen.dart'; import './screens/patients/patients_screen.dart'; +import './screens/patients/profile/vital_sign/vital_sign_screen.dart'; import './screens/profile_screen.dart'; import './screens/settings/settings_screen.dart'; - -const String INIT_ROUTE = LOGIN;//PATIENT_SEARCH; +const String INIT_ROUTE = LOGIN; //PATIENT_SEARCH; const String HOME = '/'; const String LOGIN = 'login'; const String PROFILE = 'profile'; const String CHANGE_PASSWORD = 'change-password'; const String VERIFY_ACCOUNT = 'verify-account'; -const String VERIFICATION_METHODS ='verification-methods'; +const String VERIFICATION_METHODS = 'verification-methods'; const String MY_SCHEDULE = 'my-schedule'; const String QR_READER = 'qr-reader'; const String PATIENT_SEARCH = 'patients/patient-search'; @@ -34,6 +31,7 @@ const String BLOOD_BANK = 'blood-bank'; const String DOCTOR_REPLY = 'doctor-reply'; const String MEDICINE_SEARCH = 'medicine-search'; const String SETTINGS = 'settings'; +const String VITAL_SIGN = 'vital-sign'; var routes = { HOME: (_) => DashboardScreen(), @@ -41,7 +39,7 @@ var routes = { PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), - PATIENTS: (_) =>PatientsScreen(), + PATIENTS: (_) => PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), DOCTOR_REPLY: (_) => DoctorReplyScreen(), @@ -49,6 +47,7 @@ var routes = { SETTINGS: (_) => SettingsScreen(), CHANGE_PASSWORD: (_) => ChangePasswordScreen(), VERIFY_ACCOUNT: (_) => VerifyAccountScreen(), - VERIFICATION_METHODS:(_)=> VerificationMethodsScreen(), - PATIENTS_PROFILE:(_)=> PatientProfileScreen() + VERIFICATION_METHODS: (_) => VerificationMethodsScreen(), + PATIENTS_PROFILE: (_) => PatientProfileScreen(), + VITAL_SIGN: (_) => VitalSignScreen() }; diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 5365e27e..f5c2efe2 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -122,7 +122,7 @@ class _PatientsScreenState extends State { 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, + // line3Text: item.middleName, heightPercentage: 0.15, widthPercentage: 0.80), onTap: (){ diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart new file mode 100644 index 00000000..bc7cf633 --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart @@ -0,0 +1,104 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/patient_model.dart'; +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../widgets/shared/app_scaffold_widget.dart'; +import '../../../../widgets/shared/card_with_bg_widget.dart'; + +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + +/* + *@author: Elham Rababah + *@Date:26/4/2020 + *@param: + *@return:VitalSignScreen + *@desc: VitalSignScreen class + */ +class VitalSignScreen extends StatefulWidget { + @override + _VitalSignScreenState createState() => _VitalSignScreenState(); +} + +class _VitalSignScreenState extends State { + List litems = [ + "1", + "1", + "1", + ]; + + var _isLoading = true; + var _hasError; + var _isInit = true; + + @override + void didChangeDependencies() { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + var patient = routeArgs['patient']; + print(patient); + // String patientType = routeArgs['selectedType']; + // print(patientType); + 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; + }); + + super.didChangeDependencies(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "VITAL SIGN", + body: Container( + child: Column( + children: litems.map((item) { + return InkWell( + child: CardWithBgWidget( + line1Text: 'Fahad AlSlehm - 324599', + line2Text: '12/04/2020 - 02:00 PM', + heightPercentage: 0.15, + widthPercentage: 0.80), + onTap: () { + Navigator.of(context).pushNamed(VITAL_SIGN); + }, + ); + }).toList(), + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 9a1d3437..c0d09210 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -13,12 +13,43 @@ 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" + }; @override Widget build(BuildContext context) { return ListView(padding: EdgeInsets.zero, children: [ - ProfileHeaderWidget(), + ProfileHeaderWidget(patient: patient), ProfileGeneralInfoWidget(), - ProfileMedicalInfoWidget(), + 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 05a132ac..6e3d17c3 100644 --- a/lib/widgets/patients/profile/profile_header_widget.dart +++ b/lib/widgets/patients/profile/profile_header_widget.dart @@ -14,7 +14,9 @@ import '../../shared/profile_image_widget.dart'; class ProfileHeaderWidget extends StatelessWidget { const ProfileHeaderWidget({ Key key, + this.patient }) : super(key: key); + final patient; @override Widget build(BuildContext context) { @@ -23,8 +25,8 @@ class ProfileHeaderWidget extends StatelessWidget { child: ProfileImageWidget( url: "http://images4.fanpop.com/image/photos/16200000/David-Schwimmer-Ross-Geller-ross-geller-16258927-629-779.jpg", - name: "Fahad AlSlehm", - des: "324599", + name: patient['FirstName']+' '+patient['LastName'] , + des: patient['FirstName'], 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 198f6147..c0c2d0fe 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/routes.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -5,7 +6,6 @@ import '../../../config/size_config.dart'; import '../../shared/app_texts_widget.dart'; import '../../shared/rounded_container_widget.dart'; - /* *@author: Elham Rababah *@Date:22/4/2020 @@ -14,14 +14,12 @@ import '../../shared/rounded_container_widget.dart'; *@desc: Profile Medical Info Widget */ class ProfileMedicalInfoWidget extends StatelessWidget { - const ProfileMedicalInfoWidget({ - Key key, - }) : super(key: key); - + ProfileMedicalInfoWidget({Key key, this.patient}) : super(key: key); + Map patient; @override Widget build(BuildContext context) { String url = "assets/images/"; - final double contWidth = SizeConfig.screenWidth * 0.70; + final double contWidth = SizeConfig.realScreenWidth * 0.70; final double contHeight = SizeConfig.screenHeight * 0.30; return RoundedContainer( @@ -44,11 +42,16 @@ class ProfileMedicalInfoWidget extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - CircleAvatarWidget( - des: 'Vital Sign', - url: url + 'heartbeat.png', - width: (contWidth) / 3.5, - height: (contWidth) / 3.5, + InkWell( + onTap: () { + navigator(context,VITAL_SIGN); + }, + child: CircleAvatarWidget( + des: 'Vital Sign', + url: url + 'heartbeat.png', + width: (contWidth) / 3.5, + height: (contWidth) / 3.5, + ), ), CircleAvatarWidget( des: 'Lab Result', @@ -79,6 +82,11 @@ class ProfileMedicalInfoWidget extends StatelessWidget { height: contHeight, ); } + + void navigator(BuildContext context,route) { + Navigator.of(context).pushNamed(VITAL_SIGN, + arguments: {'patient': patient}); + } } class CircleAvatarWidget extends StatelessWidget { @@ -106,7 +114,7 @@ class CircleAvatarWidget extends StatelessWidget { decoration: new BoxDecoration( // color: Colors.green, // border color shape: BoxShape.circle, - border: Border.all(color: Hexcolor('#B7831A'),width: 1.5)), + border: Border.all(color: Hexcolor('#B7831A'), width: 1.5)), child: CircleAvatar( radius: SizeConfig.imageSizeMultiplier * 12, child: Image.asset(url), diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 5fd84067..9410f9bf 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -3,9 +3,9 @@ import 'package:hexcolor/hexcolor.dart'; import '../../config/size_config.dart'; import '../../presentation/doctor_app_icons.dart'; -import '../../screens/patients/patients_screen.dart'; import '../../widgets/shared/app_drawer_widget.dart'; import '../../widgets/shared/app_loader_widget.dart'; +import '../../widgets/shared/custom_shape_clipper.dart'; class AppScaffold extends StatelessWidget { bool pageOnly = false;