You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/providers/patients_provider.dart

51 lines
1.9 KiB
Dart

import 'dart:convert';
import 'package:doctor_app_flutter/models/patient_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
class PatientsProvider with ChangeNotifier {
Future<Map> getPatientList(PatientModel patient, patientType) async {
Map<String, String> requestHeaders = {
'Content-type': 'application/json',
'Accept': 'application/json',
};
const url =
'https://hmgwebservices.com/Services/DoctorApplication.svc/REST/GetMyInPatient';
try {
final response = await http.post(url,
headers: requestHeaders,
body: json.encode({
"ProjectID": patient.PatientID,
"ClinicID": patient.ClinicID,
"DoctorID": patient.DoctorID,
"FirstName": patient.FirstName,
"MiddleName": patient.MiddleName,
"LastName": patient.LastName,
"PatientMobileNumber": patient.PatientMobileNumber,
"PatientIdentificationID": patient.PatientIdentificationID,
"PatientID": patient.PatientID,
"From": patient.From,
"To": patient.To,
"LanguageID": patient.LanguageID,
"stamp": patient.stamp,
"IPAdress": patient.IPAdress,
"VersionID": patient.VersionID,
"Channel": patient.Channel,
"TokenID": patient.TokenID,
"SessionID": patient.SessionID,
"IsLoginForDoctorApp": patient.IsLoginForDoctorApp,
"PatientOutSA": patient.PatientOutSA
}));
// var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'});
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');
// notifyListeners();
return Future.value(json.decode(response.body));
} catch (error) {
print(error.toString());
print('error');
}
}
}