Merge branch 'Amjad_search' into 'master'

Patient search

See merge request Cloud_Solution/doctor_app_flutter!30
merge-requests/31/head
amjad nabil amireh 5 years ago
commit 8ca37c6b34

@ -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"];
//******************

@ -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"},
];

@ -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,

@ -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<String, dynamic> json) => PatientModel(
FirstName: json["FirstName"],
LastName: json["LasttName"],
);
}
//***************************

@ -12,8 +12,14 @@ class PatientsProvider with ChangeNotifier {
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
Future<Map> 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;

@ -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(),

@ -0,0 +1,31 @@
/*
*@author: Amjad Amireh
*@Date:27/4/2020
*@param:
*@return:pass a List<dynamic> to a List<MyModel> from a JSON
*@desc:
*/
import 'package:doctor_app_flutter/screens/patients/patiant_info_model.dart';
class TopTenUsersModelResponse {
final List<PatiantInformtion> list;
String firstName;
TopTenUsersModelResponse({
this.list,
this.firstName,
});
factory TopTenUsersModelResponse.fromJson(List<dynamic> parsedJson) {
// List<PatientModel> list = new List<PatientModel>();
List<PatiantInformtion> list = new List<PatiantInformtion>();
//PatiantInformtion
list = parsedJson.map((i) => PatiantInformtion.fromJson(i)).toList();
return new TopTenUsersModelResponse(list: list);
}
}
class PatiantInformtionl {
}

@ -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<PatiantInformtion> 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<String, dynamic> 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"],
);
}

@ -63,13 +63,13 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
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

@ -20,7 +20,6 @@ class _PatientsListScreenState extends State<PatientsListScreen> {
String patientType = routeArgs['selectedType'];
print(patientType);
if (_isInit) {
// setState(() {});
PatientsProvider patientsProv = Provider.of<PatientsProvider>(context);
patientsProv.getPatientList(patient, patientType).then((res) {
// print('MessageStatus${res['MessageStatus']}');
@ -62,3 +61,6 @@ class _PatientsListScreenState extends State<PatientsListScreen> {
);
}
}
/*
{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}
*/

@ -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<String> litems = [
"1",
"1",
"1",
];
import 'package:doctor_app_flutter/config/config.dart';
class PatientsScreen extends StatefulWidget {
@override
_PatientsScreenState createState() => _PatientsScreenState();
}
class _PatientsScreenState extends State<PatientsScreen> {
List<dynamic> litems;
//*******************
List<PatiantInformtion> responseModelList;
//List<PatiantInformtion<dynamic>> 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<PatientsProvider>(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<PatiantInformtion> responseModelList = new PatiantInformtion.fromJson(litems).;//TopTenUsersModelResponse.fromJson(parsed).list;
final List parsed = litems;//json.decode(response.body);
//List<PatientModel> responseModelList = new TopTenUsersModelResponse.fromJson(parsed).list;
// List<PatiantInformtion> 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: <Widget>[
Container(
//child:litems == null?Column():Column(children: <Widget>[
child:litems == null?Column():Column(children: <Widget>[
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<Path> {
@override

Loading…
Cancel
Save