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.
81 lines
2.9 KiB
Dart
81 lines
2.9 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:hmg_nurses/classes/consts.dart';
|
|
import 'package:hmg_nurses/main.dart';
|
|
import 'package:hmg_nurses/model/base/generic_response_model.dart';
|
|
import 'package:hmg_nurses/services/api_client.dart';
|
|
import 'package:injector/injector.dart';
|
|
|
|
abstract class IPatientApiRepo {
|
|
Future<GenericResponseModel> getPatientInfo(int patientID);
|
|
|
|
Future<GenericResponseModel> getVitalSigns({int? patientID, int? patientTypeID, int? inOutPatientType, bool isDentalAllowedBackend, int? doctorID, int setupID, int? patientType});
|
|
}
|
|
|
|
class PatientApiRepo implements IPatientApiRepo {
|
|
@override
|
|
Future<GenericResponseModel> getPatientInfo(int patientID) async {
|
|
String url = "${ApiConsts.baseUrlServices}Patients.svc/REST/GetPatientInformation_PRM";
|
|
Map<String, dynamic> postParams = {};
|
|
|
|
postParams.addAll(appState.postParamsJson);
|
|
postParams["FirstName"] = "0";
|
|
postParams["MiddleName"] = "0";
|
|
postParams["LastName"] = "0";
|
|
postParams["PatientMobileNumber"] = "0";
|
|
postParams["PatientIdentificationID"] = "0";
|
|
postParams["PatientID"] = patientID;
|
|
postParams["From"] = "0";
|
|
postParams["To"] = "0";
|
|
postParams["SearchType"] = 1;
|
|
postParams["MobileNo"] = "";
|
|
postParams["IdentificationNo"] = "0";
|
|
postParams["NursingStationID"] = "0";
|
|
GenericResponseModel response;
|
|
print(jsonEncode(postParams));
|
|
// return GenericResponseModel();
|
|
try {
|
|
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
return response;
|
|
}
|
|
|
|
@override
|
|
Future<GenericResponseModel> getVitalSigns({int? patientID, int? patientTypeID, int? inOutPatientType, bool? isDentalAllowedBackend, int? doctorID, int? setupID, int? patientType}) async {
|
|
String url = "${ApiConsts.baseUrlServices}Doctors.svc/REST/Doctor_GetPatientVitalSign";
|
|
Map<String, dynamic> postParams = {};
|
|
|
|
// {
|
|
// "PatientID": 12,
|
|
// "PatientTypeID": 1,
|
|
// "InOutPatientType": 0,
|
|
// "isDentalAllowedBackend": false,
|
|
// "DoctorID": 2477,
|
|
// "SetupID": "91877",
|
|
// "PatientType": 1,
|
|
// }
|
|
|
|
postParams.addAll(appState.postParamsJson);
|
|
postParams["PatientID"] = patientID;
|
|
postParams["PatientTypeID"] = patientTypeID;
|
|
postParams["InOutPatientType"] = inOutPatientType;
|
|
postParams["isDentalAllowedBackend"] = isDentalAllowedBackend;
|
|
postParams["DoctorID"] = doctorID;
|
|
postParams["SetupID"] = setupID;
|
|
postParams["PatientType"] = patientType;
|
|
postParams.remove("ProjectID");
|
|
postParams.remove("ClinicID");
|
|
|
|
GenericResponseModel response;
|
|
// return GenericResponseModel();
|
|
try {
|
|
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
return response;
|
|
}
|
|
}
|