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/models/patient/vital_sign_res_model.dart b/lib/models/patient/vital_sign_res_model.dart new file mode 100644 index 00000000..5d0eabff --- /dev/null +++ b/lib/models/patient/vital_sign_res_model.dart @@ -0,0 +1,257 @@ +class VitalSignResModel { + int transNo; + Null projectID; + int weightKg; + int heightCm; + var temperatureCelcius; + int pulseBeatPerMinute; + int respirationBeatPerMinute; + int bloodPressureLower; + int bloodPressureHigher; + int sAO2; + int fIO2; + Null painScore; + var bodyMassIndex; + int headCircumCm; + int leanBodyWeightLbs; + int idealBodyWeightLbs; + int temperatureCelciusMethod; + int pulseRhythm; + int respirationPattern; + Null bloodPressureCuffLocation; + Null bloodPressureCuffSize; + Null bloodPressurePatientPosition; + String painLocation; + String painDuration; + String painCharacter; + String painFrequency; + bool isPainManagementDone; + int status; + bool isVitalsRequired; + int patientID; + String createdOn; + int doctorID; + int clinicID; + Null triageCategory; + Null gCScore; + Null lineItemNo; + Null vitalSignDate; + Null actualTimeTaken; + Null sugarLevel; + Null fBS; + Null rBS; + Null observationType; + Null heartRate; + Null muscleTone; + Null reflexIrritability; + Null bodyColor; + Null isFirstAssessment; + Null dateofBirth; + Null timeOfBirth; + String bloodPressure; + String bloodPressureCuffLocationDesc; + String bloodPressureCuffSizeDesc; + String bloodPressurePatientPositionDesc; + String clinicName; + String doctorImageURL; + String doctorName; + String painScoreDesc; + String pulseRhythmDesc; + String respirationPatternDesc; + String temperatureCelciusMethodDesc; + Null time; + + VitalSignResModel( + {this.transNo, + this.projectID, + this.weightKg, + this.heightCm, + this.temperatureCelcius, + this.pulseBeatPerMinute, + this.respirationBeatPerMinute, + this.bloodPressureLower, + this.bloodPressureHigher, + this.sAO2, + this.fIO2, + this.painScore, + this.bodyMassIndex, + this.headCircumCm, + this.leanBodyWeightLbs, + this.idealBodyWeightLbs, + this.temperatureCelciusMethod, + this.pulseRhythm, + this.respirationPattern, + this.bloodPressureCuffLocation, + this.bloodPressureCuffSize, + this.bloodPressurePatientPosition, + this.painLocation, + this.painDuration, + this.painCharacter, + this.painFrequency, + this.isPainManagementDone, + this.status, + this.isVitalsRequired, + this.patientID, + this.createdOn, + this.doctorID, + this.clinicID, + this.triageCategory, + this.gCScore, + this.lineItemNo, + this.vitalSignDate, + this.actualTimeTaken, + this.sugarLevel, + this.fBS, + this.rBS, + this.observationType, + this.heartRate, + this.muscleTone, + this.reflexIrritability, + this.bodyColor, + this.isFirstAssessment, + this.dateofBirth, + this.timeOfBirth, + this.bloodPressure, + this.bloodPressureCuffLocationDesc, + this.bloodPressureCuffSizeDesc, + this.bloodPressurePatientPositionDesc, + this.clinicName, + this.doctorImageURL, + this.doctorName, + this.painScoreDesc, + this.pulseRhythmDesc, + this.respirationPatternDesc, + this.temperatureCelciusMethodDesc, + this.time}); + + VitalSignResModel.fromJson(Map json) { + transNo = json['TransNo']; + projectID = json['ProjectID']; + weightKg = json['WeightKg']; + heightCm = json['HeightCm']; + temperatureCelcius = json['TemperatureCelcius']; + pulseBeatPerMinute = json['PulseBeatPerMinute']; + respirationBeatPerMinute = json['RespirationBeatPerMinute']; + bloodPressureLower = json['BloodPressureLower']; + bloodPressureHigher = json['BloodPressureHigher']; + sAO2 = json['SAO2']; + fIO2 = json['FIO2']; + painScore = json['PainScore']; + bodyMassIndex = json['BodyMassIndex']; + headCircumCm = json['HeadCircumCm']; + leanBodyWeightLbs = json['LeanBodyWeightLbs']; + idealBodyWeightLbs = json['IdealBodyWeightLbs']; + temperatureCelciusMethod = json['TemperatureCelciusMethod']; + pulseRhythm = json['PulseRhythm']; + respirationPattern = json['RespirationPattern']; + bloodPressureCuffLocation = json['BloodPressureCuffLocation']; + bloodPressureCuffSize = json['BloodPressureCuffSize']; + bloodPressurePatientPosition = json['BloodPressurePatientPosition']; + painLocation = json['PainLocation']; + painDuration = json['PainDuration']; + painCharacter = json['PainCharacter']; + painFrequency = json['PainFrequency']; + isPainManagementDone = json['IsPainManagementDone']; + status = json['Status']; + isVitalsRequired = json['IsVitalsRequired']; + patientID = json['PatientID']; + createdOn = json['CreatedOn']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + triageCategory = json['TriageCategory']; + gCScore = json['GCScore']; + lineItemNo = json['LineItemNo']; + vitalSignDate = json['VitalSignDate']; + actualTimeTaken = json['ActualTimeTaken']; + sugarLevel = json['SugarLevel']; + fBS = json['FBS']; + rBS = json['RBS']; + observationType = json['ObservationType']; + heartRate = json['HeartRate']; + muscleTone = json['MuscleTone']; + reflexIrritability = json['ReflexIrritability']; + bodyColor = json['BodyColor']; + isFirstAssessment = json['IsFirstAssessment']; + dateofBirth = json['DateofBirth']; + timeOfBirth = json['TimeOfBirth']; + bloodPressure = json['BloodPressure']; + bloodPressureCuffLocationDesc = json['BloodPressureCuffLocationDesc']; + bloodPressureCuffSizeDesc = json['BloodPressureCuffSizeDesc']; + bloodPressurePatientPositionDesc = json['BloodPressurePatientPositionDesc']; + clinicName = json['ClinicName']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + painScoreDesc = json['PainScoreDesc']; + pulseRhythmDesc = json['PulseRhythmDesc']; + respirationPatternDesc = json['RespirationPatternDesc']; + temperatureCelciusMethodDesc = json['TemperatureCelciusMethodDesc']; + time = json['Time']; + } + + Map toJson() { + final Map data = new Map(); + data['TransNo'] = this.transNo; + data['ProjectID'] = this.projectID; + data['WeightKg'] = this.weightKg; + data['HeightCm'] = this.heightCm; + data['TemperatureCelcius'] = this.temperatureCelcius; + data['PulseBeatPerMinute'] = this.pulseBeatPerMinute; + data['RespirationBeatPerMinute'] = this.respirationBeatPerMinute; + data['BloodPressureLower'] = this.bloodPressureLower; + data['BloodPressureHigher'] = this.bloodPressureHigher; + data['SAO2'] = this.sAO2; + data['FIO2'] = this.fIO2; + data['PainScore'] = this.painScore; + data['BodyMassIndex'] = this.bodyMassIndex; + data['HeadCircumCm'] = this.headCircumCm; + data['LeanBodyWeightLbs'] = this.leanBodyWeightLbs; + data['IdealBodyWeightLbs'] = this.idealBodyWeightLbs; + data['TemperatureCelciusMethod'] = this.temperatureCelciusMethod; + data['PulseRhythm'] = this.pulseRhythm; + data['RespirationPattern'] = this.respirationPattern; + data['BloodPressureCuffLocation'] = this.bloodPressureCuffLocation; + data['BloodPressureCuffSize'] = this.bloodPressureCuffSize; + data['BloodPressurePatientPosition'] = this.bloodPressurePatientPosition; + data['PainLocation'] = this.painLocation; + data['PainDuration'] = this.painDuration; + data['PainCharacter'] = this.painCharacter; + data['PainFrequency'] = this.painFrequency; + data['IsPainManagementDone'] = this.isPainManagementDone; + data['Status'] = this.status; + data['IsVitalsRequired'] = this.isVitalsRequired; + data['PatientID'] = this.patientID; + data['CreatedOn'] = this.createdOn; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['TriageCategory'] = this.triageCategory; + data['GCScore'] = this.gCScore; + data['LineItemNo'] = this.lineItemNo; + data['VitalSignDate'] = this.vitalSignDate; + data['ActualTimeTaken'] = this.actualTimeTaken; + data['SugarLevel'] = this.sugarLevel; + data['FBS'] = this.fBS; + data['RBS'] = this.rBS; + data['ObservationType'] = this.observationType; + data['HeartRate'] = this.heartRate; + data['MuscleTone'] = this.muscleTone; + data['ReflexIrritability'] = this.reflexIrritability; + data['BodyColor'] = this.bodyColor; + data['IsFirstAssessment'] = this.isFirstAssessment; + data['DateofBirth'] = this.dateofBirth; + data['TimeOfBirth'] = this.timeOfBirth; + data['BloodPressure'] = this.bloodPressure; + data['BloodPressureCuffLocationDesc'] = this.bloodPressureCuffLocationDesc; + data['BloodPressureCuffSizeDesc'] = this.bloodPressureCuffSizeDesc; + data['BloodPressurePatientPositionDesc'] = + this.bloodPressurePatientPositionDesc; + data['ClinicName'] = this.clinicName; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['PainScoreDesc'] = this.painScoreDesc; + data['PulseRhythmDesc'] = this.pulseRhythmDesc; + data['RespirationPatternDesc'] = this.respirationPatternDesc; + data['TemperatureCelciusMethodDesc'] = this.temperatureCelciusMethodDesc; + data['Time'] = this.time; + return data; + } +} diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index e349e024..1baf7786 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -1,18 +1,29 @@ import 'dart:convert'; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart'; +import '../config/config.dart'; import '../interceptor/http_interceptor.dart'; -import '../models/patient_model.dart'; +import '../models/patient/patient_model.dart'; +import '../models/patient/vital_sign_res_model.dart'; +import '../screens/patients/patiant_info_model.dart'; +import '../util/helpers.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 +74,49 @@ 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'].forEach((v) { + patientVitalSignList + .add(new VitalSignResModel.fromJson(v)); + }); + // patientVitalSignList = res['List_DoctorPatientVitalSign']; + } else { + isError = true; + error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; + } + } + } else { + isLoading = false; + isError = true; + error = 'Please Check The Internet Connection'; + } + notifyListeners(); } catch (error) { throw error; } } + + PatiantInformtion getSelectedPatient() { + return _selectedPatient; + } + + setSelectedPatient(PatiantInformtion patient) { + // return _selectedPatient; + _selectedPatient = patient; + } } diff --git a/lib/providers/schedule_provider.dart b/lib/providers/schedule_provider.dart index 346175ec..6b75556a 100644 --- a/lib/providers/schedule_provider.dart +++ b/lib/providers/schedule_provider.dart @@ -62,6 +62,7 @@ class ScheduleProvider with ChangeNotifier { isError = true; error = 'Please Check The Internet Connection'; } + print('Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer'); notifyListeners(); } catch (error) { throw error; diff --git a/lib/routes.dart b/lib/routes.dart index 356696cb..e887c62e 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -9,7 +9,7 @@ import './screens/dashboard_screen.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import './screens/medicine/medicine_search_screen.dart'; import './screens/my_schedule_screen.dart'; -import './screens/patients/patient_profile_screen.dart'; +import './screens/patients/profile/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'; 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..78b9abea 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'; @@ -66,8 +66,7 @@ class _PatientSearchScreenState extends State { // _formKey.currentState.save(); sharedPref.getString(TOKEN).then((token) { - print(token+"EEEEEE"); - _patientSearchFormValues.TokenID = token; + _patientSearchFormValues.TokenID = '@dm!n'; _patientSearchFormValues.ProjectID= 15; // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); Navigator.of(context).pushNamed(PATIENTS, arguments: { 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 89d9eea7..19901ba9 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'; @@ -31,12 +31,11 @@ class PatientsScreen extends StatefulWidget { } class _PatientsScreenState extends State { - List litems; - //******************* - List responseModelList; - //List> litems2; - //******************* - + List litems; + //******************* + List responseModelList; + //List> litems2; + //******************* bool _isInit = true; @@ -46,21 +45,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); @@ -68,20 +67,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) { @@ -94,70 +93,83 @@ 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( - widget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(item.nationalityName, fontSize: 2.5 *SizeConfig.textMultiplier ,), - SizedBox( - height: 8, - ), - AppText(item.lastName, fontSize: 2.5 *SizeConfig.textMultiplier), - SizedBox( - height: 8, - ), - AppText(item.middleName, fontSize: 2.5 *SizeConfig.textMultiplier), - - ], - ), + Column( + children: + responseModelList.map((PatiantInformtion item) { + return InkWell( + child: CardWithBgWidget( + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + item.nationalityName, + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText(item.lastName, + fontSize: + 2.5 * SizeConfig.textMultiplier), + SizedBox( + height: 8, + ), + AppText(item.middleName, + fontSize: + 2.5 * SizeConfig.textMultiplier), + ], + ), + ), + onTap: () { + Navigator.of(context).pushNamed(PATIENTS_PROFILE, + arguments: {"patient": item}); + }, + ); + }).toList()) + ], ), - onTap: (){ - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {"patient": responseModelList}); - }, - ); - }).toList()) + ), ], - - ), - ), - ], - )) - ); + ))); } //***********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), ),*/ @@ -175,30 +187,4 @@ 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/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart similarity index 72% rename from lib/screens/patients/patient_profile_screen.dart rename to lib/screens/patients/profile/patient_profile_screen.dart index fba86c13..5241f18c 100644 --- a/lib/screens/patients/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import '../../widgets/patients/profile/patient_profile_widget.dart'; -import '../../widgets/shared/app_scaffold_widget.dart'; +import '../../../widgets/patients/profile/patient_profile_widget.dart'; +import '../../../widgets/shared/app_scaffold_widget.dart'; class PatientProfileScreen extends StatelessWidget { const PatientProfileScreen({Key key}) : super(key: key); 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 3d689870..ab36a618 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart @@ -1,15 +1,16 @@ -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_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:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../../../config/shared_pref_kay.dart'; +import '../../../../models/patient/vital_sign_req_model.dart'; +import '../../../../providers/patients_provider.dart'; +import '../../../../screens/patients/patiant_info_model.dart'; +import '../../../../util/dr_app_shared_pref.dart'; import '../../../../widgets/shared/app_scaffold_widget.dart'; import '../../../../widgets/shared/card_with_bg_widget.dart'; +import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -20,103 +21,114 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); *@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; + PatientsProvider patientsProv; var _isInit = true; - @override - void didChangeDependencies() { + /* + *@author: Elham Rababah + *@Date:28/4/2020 + *@param: context + *@return: + *@desc: getVitalSignList Function + */ + getVitalSignList(context) { 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: 1237159, //patient.patientId, + projectID: 12, //patient.projectId, + tokenID: '@dm!n', + patientTypeID: patient.patientType, + inOutpatientType: 2, + languageID: 2, + transNo: 0, + ); + //patient.admissionNo != null ? int.parse(patient.admissionNo) : 0); + patientsProv.getPatientVitalSign(vitalSignReqModel.toJson()); }); + } + @override + void didChangeDependencies() { super.didChangeDependencies(); + if (_isInit) { + patientsProv = Provider.of(context); + getVitalSignList(context); + } + _isInit = false; } @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: "VITAL SIGN", - body: Container( - child: Column( - children: litems.map((item) { - return InkWell( - child: CardWithBgWidget( - widget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Fahad AlSlehm - 324599', - fontSize: 2.5 * SizeConfig.textMultiplier, + 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: ListView.builder( + itemCount: patientsProv.patientVitalSignList.length, + itemBuilder: (BuildContext ctxt, int index) { + return InkWell( + child: CardWithBgWidget( + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'DoctorName - ${patientsProv.patientVitalSignList[index].doctorName}', + fontSize: 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText('painScoreDesc - ${patientsProv.patientVitalSignList[index].painScoreDesc}', + fontSize: + 2.5 * SizeConfig.textMultiplier), + SizedBox( + height: 8, + ), + ], + ), + ), + onTap: () {}, + ); + }), ), - SizedBox( - height: 8, - ), - AppText('12/04/2020 - 02:00 PM', - fontSize: 2.5 * SizeConfig.textMultiplier), - SizedBox( - height: 8, - ), - ], - ), - ), - onTap: () { - Navigator.of(context).pushNamed(VITAL_SIGN); - }, - ); - }).toList(), - ), - ), ); } } + +// patientsProv.patientVitalSignList.map((VitalSignResModel item) { +// return InkWell( +// child: CardWithBgWidget( +// line1Text: 'DoctorName - ${item.doctorName}', +// line2Text: +// 'PainScoreDesc - ${item.painScoreDesc}', +// heightPercentage: 0.15, +// widthPercentage: 0.80), +// onTap: () { +// Navigator.of(context).pushNamed(VITAL_SIGN); +// }, +// ); +// }).toList() 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..e8c97a54 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -200,7 +200,13 @@ class _VerifyAccountState extends State { } return null; } - +/* + *@author: Elham Rababah + *@Date:28/4/2020 + *@param: context + *@return:InputDecoration + *@desc: buildInputDecoration + */ InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( // ts/images/password_icon.png @@ -215,6 +221,13 @@ class _VerifyAccountState extends State { )); } +/* + *@author: Elham Rababah + *@Date:28/4/2020 + *@param: + *@return: RichText + *@desc: buildText + */ RichText buildText() { var text = RichText( text: new TextSpan( @@ -253,7 +266,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/";