diff --git a/lib/config/config.dart b/lib/config/config.dart index 2db3184a..ad9ab173 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -3,3 +3,7 @@ const BASE_URL = 'https://hmgwebservices.com/Services/'; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z]"; const ONLY_DATE = "[0-9/]"; +//*********change value to decode json from Dropdown ************ + var SERVICES_PATIANT = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; +var SERVICES_PATIANT2 = ["List_MyOutPatient", "List_MyInPatient", "List_MyReferredPatient","List_MyReferredPatient","List_MyDischargeReferredPatient","List_MyTomorrowPatient","List_MyReferralPatient"]; +//****************** \ No newline at end of file diff --git a/lib/lookups/patient_lookup.dart b/lib/lookups/patient_lookup.dart index 3770b7ea..fbb382c2 100644 --- a/lib/lookups/patient_lookup.dart +++ b/lib/lookups/patient_lookup.dart @@ -1,11 +1,16 @@ const PATIENT_TYPE = const [ - {"text": "outPatiant", "val": "1"}, - {"text": "Tomorrow Patient", "val": "2"}, + {"text": "outPatiant", "val": "0"}, + {"text": "InPatiant", "val": "1"}, + {"text": "Discharge", "val": "2"}, {"text": "Referrd", "val": "3"}, - {"text": "Discharge", "val": "4"}, - {"text": "InPatiant", "val": "5"}, - {"text": "Referral Discharge", "val": "6"}, + {"text": "Referral Discharge", "val": "4"}, + {"text": "Tomorrow Patient", "val": "5"}, + {"text": "Referral", "val": "6"}, + + + + ]; diff --git a/lib/main.dart b/lib/main.dart index 251bea26..4710b91c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,6 +25,9 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider.value(value: ProjectsProvider()), ], child: MaterialApp( + //******amjad*****To remove debug app******************* + showSemanticsDebugger: false, + //******************************** title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, diff --git a/lib/models/patient_model.dart b/lib/models/patient_model.dart index eb1b3016..e49f64ea 100644 --- a/lib/models/patient_model.dart +++ b/lib/models/patient_model.dart @@ -20,6 +20,17 @@ class PatientModel { bool IsLoginForDoctorApp; bool PatientOutSA; + + getFirstName() { + return this.FirstName; + } + + setFirstName( FirstName) { + this.FirstName = FirstName; + } + + + PatientModel( {this.ProjectID, this.ClinicID, @@ -41,4 +52,14 @@ class PatientModel { this.SessionID, this.IsLoginForDoctorApp, this.PatientOutSA}); + + + factory PatientModel.fromJson(Map json) => PatientModel( + + FirstName: json["FirstName"], + LastName: json["LasttName"], + + ); } +//*************************** + \ No newline at end of file diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 7ab8abf7..942685da 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -12,8 +12,14 @@ class PatientsProvider with ChangeNotifier { Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); Future getPatientList(PatientModel patient, patientType) async { - const url = - BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient'; + /* 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"); + try { final response = await client.post(url, @@ -39,6 +45,9 @@ class PatientsProvider with ChangeNotifier { "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, "PatientOutSA": patient.PatientOutSA })); +//********************** +//*********************** + return Future.value(json.decode(response.body)); } catch (error) { throw error; diff --git a/lib/routes.dart b/lib/routes.dart index be11ee52..0ee97b2f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,4 +1,6 @@ +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'; @@ -16,7 +18,7 @@ import './screens/profile_screen.dart'; import './screens/settings/settings_screen.dart'; -const String INIT_ROUTE = LOGIN; +const String INIT_ROUTE = LOGIN;//PATIENT_SEARCH; const String HOME = '/'; const String LOGIN = 'login'; const String PROFILE = 'profile'; @@ -39,7 +41,7 @@ var routes = { PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), - PATIENTS: (_) => PatientsScreen(), + PATIENTS: (_) =>PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), DOCTOR_REPLY: (_) => DoctorReplyScreen(), diff --git a/lib/screens/patients/TopTenUsersModelResponse.dart b/lib/screens/patients/TopTenUsersModelResponse.dart new file mode 100644 index 00000000..ba4a5d97 --- /dev/null +++ b/lib/screens/patients/TopTenUsersModelResponse.dart @@ -0,0 +1,31 @@ + +/* + *@author: Amjad Amireh + *@Date:27/4/2020 + *@param: + *@return:pass a List to a List from a JSON + + *@desc: + */ +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; +class TopTenUsersModelResponse { + final List list; + String firstName; + TopTenUsersModelResponse({ + this.list, + this.firstName, + }); + + factory TopTenUsersModelResponse.fromJson(List parsedJson) { + + // List list = new List(); + List list = new List(); + //PatiantInformtion + list = parsedJson.map((i) => PatiantInformtion.fromJson(i)).toList(); + + return new TopTenUsersModelResponse(list: list); + } +} + +class PatiantInformtionl { +} \ No newline at end of file diff --git a/lib/screens/patients/patiant_info_model.dart b/lib/screens/patients/patiant_info_model.dart new file mode 100644 index 00000000..94a5c09d --- /dev/null +++ b/lib/screens/patients/patiant_info_model.dart @@ -0,0 +1,131 @@ +import 'dart:convert'; + +//PatiantInformtion patiantInformtionFromJson(String str) => PatiantInformtion.fromJson(json.decode(str)); + +////String patiantInformtionToJson(PatiantInformtion data) => json.encode(data.toJson()); +//****************************** */ + +/* + *@author: Amjad Amireh + *@Date:27/4/2020 + *@param: + *@return:Patian information Model + + *@desc: + */ + + + +class PatiantInformtion { + final List list; + int projectId; + int clinicId; + int doctorId; + int patientId; + String doctorName; + String doctorNameN; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + int gender; + String dateofBirth; + String nationalityId; + String mobileNumber; + String emailAddress; + String patientIdentificationNo; + int patientType; + String admissionNo; + String admissionDate; + String roomId; + String bedId; + String nursingStationId; + String description; + String clinicDescription; + String clinicDescriptionN; + String nationalityName; + String nationalityNameN; + String age; + String genderDescription; + String nursingStationName; + + PatiantInformtion({ + this.list, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.nationalityId, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.clinicDescription, + this.clinicDescriptionN, + this.nationalityName, + this.nationalityNameN, + this.age, + this.genderDescription, + this.nursingStationName, + }); + + factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( + projectId: json["ProjectID"], + clinicId: json["ClinicID"], + doctorId: json["DoctorID"], + patientId: json["PatientID"], + doctorName: json["DoctorName"], + doctorNameN: json["DoctorNameN"], + firstName: json["FirstName"], + middleName: json["MiddleName"], + lastName: json["LastName"], + firstNameN: json["FirstNameN"], + middleNameN: json["MiddleNameN"], + lastNameN: json["LastNameN"], + gender: json["Gender"], + dateofBirth: json["DateofBirth"], + nationalityId: json["NationalityID"], + mobileNumber: json["MobileNumber"], + emailAddress: json["EmailAddress"], + patientIdentificationNo: json["PatientIdentificationNo"], + patientType: json["PatientType"], + admissionNo: json["AdmissionNo"], + admissionDate: json["AdmissionDate"], + roomId: json["RoomID"], + bedId: json["BedID"], + nursingStationId: json["NursingStationID"], + description: json["Description"], + clinicDescription: json["ClinicDescription"], + clinicDescriptionN: json["ClinicDescriptionN"], + nationalityName: json["NationalityName"], + nationalityNameN: json["NationalityNameN"], + age: json["Age"], + genderDescription: json["GenderDescription"], + nursingStationName: json["NursingStationName"], + ); + + + + + + + +} diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 6cd681c7..5e90847c 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -63,13 +63,13 @@ class _PatientSearchScreenState extends State { if (_formKey.currentState.validate()) { // If all data are correct then save data to out variables - _formKey.currentState.save(); + // _formKey.currentState.save(); sharedPref.getString(TOKEN).then((token) { print(token+"EEEEEE"); _patientSearchFormValues.TokenID = token; _patientSearchFormValues.ProjectID= 15; - print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); + // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, "selectedType": _selectedType diff --git a/lib/screens/patients/patients_list_screen.dart b/lib/screens/patients/patients_list_screen.dart index 33d2cad3..be3b2a86 100644 --- a/lib/screens/patients/patients_list_screen.dart +++ b/lib/screens/patients/patients_list_screen.dart @@ -20,7 +20,6 @@ class _PatientsListScreenState extends State { String patientType = routeArgs['selectedType']; print(patientType); if (_isInit) { - // setState(() {}); PatientsProvider patientsProv = Provider.of(context); patientsProv.getPatientList(patient, patientType).then((res) { // print('MessageStatus${res['MessageStatus']}'); @@ -62,3 +61,6 @@ class _PatientsListScreenState extends State { ); } } +/* +{ProjectID: 15, ClinicID: null, DoctorID: 4709, PatientID: 1288076, DoctorName: SHAZIA MAQSOOD, DoctorNameN: null, FirstName: LAMA, MiddleName: ABDULLAH, LastName: AL-SALOOM, FirstNameN: null, MiddleNameN: null, LastNameN: null, Gender: 2, DateofBirth: /Date(522363600000+0300)/, NationalityID: null, MobileNumber: 0543133371, EmailAddress: Lala_as@hotmail.com, PatientIdentificationNo: 1040451369, PatientType: 1, AdmissionNo: 2020008493, AdmissionDate: /Date(1587589200000+0300)/, RoomID: 119, BedID: 119, NursingStationID: null, Description: null, ClinicDescription: OB-GYNE, ClinicDescriptionN: null, NationalityName: Saudi, NationalityNameN: null, Age: 34 Yr, GenderDescription: Female, NursingStationName: Post Natal Ward – A2} +*/ \ No newline at end of file diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index f4b8516f..5365e27e 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,38 +1,171 @@ +/* + *@author: Amjad Amireh Merge to Elham rababah + *@Date:27/4/2020 + *@param: + *@return:PatientsScreen + + *@desc: + */ +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/screens/patients/TopTenUsersModelResponse.dart'; +import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +//************* +import '../../config/size_config.dart'; +import 'package:hexcolor/hexcolor.dart'; +//******** import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/card_with_bg_widget.dart'; -class PatientsScreen extends StatelessWidget { - List litems = [ - "1", - "1", - "1", - ]; +import 'package:doctor_app_flutter/config/config.dart'; + +class PatientsScreen extends StatefulWidget { + @override + _PatientsScreenState createState() => _PatientsScreenState(); +} + +class _PatientsScreenState extends State { + List litems; + //******************* + List responseModelList; + //List> litems2; + //******************* + + + bool _isInit = true; + + var _isLoading = true; + + var _hasError; + //*******Amjad add to search box****** + final _controller = TextEditingController(); + //************** + PatientModel patient; + + @override + void didChangeDependencies() { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + //PatientModel patient = routeArgs['patientSearchForm']; + patient = routeArgs['patientSearchForm']; + + //PatiantInformtion patiantInfo = routeArgs['patientSearchForm']; + + print(patient.TokenID+"EEEEEE"); + String patientType = routeArgs['selectedType']; + print("**************patiant Type**************"); + print(patientType); + print("**************test**************"); + if (_isInit) { + // setState(() {}); + PatientsProvider patientsProv = Provider.of(context); + patientsProv.getPatientList(patient, patientType).then((res) { + // print('MessageStatus${res['MessageStatus']}'); + print('List_MyInPatient${(res['List_MyInPatient'])}'); + setState(() { + 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; + //******************** + _isLoading = false; + _hasError = res['ErrorEndUserMessage']; + + }); + print(res); + }).catchError((error) { + print(error); + }); + } + _isInit = false; + super.didChangeDependencies(); + } + @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: 'Patients', - 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(PATIENTS_PROFILE); - }, - ); - }).toList(), + //***********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()) + ], + + ), ), - ), + ], + )) ); } + + //***********amjad update************* + InputDecoration buildInputDecoration(BuildContext context, hint) { + return InputDecoration( + prefixIcon:Icon(Icons.search,color: Colors.red), + filled: true, + fillColor: Colors.white, + //Image.asset(asset), + /* icon: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(Icons.search), + ),*/ + + hintText: hint, + hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + )); + } + //************* } + //*********************** + class CustomShapeClipper extends CustomClipper { @override