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.
104 lines
3.6 KiB
Dart
104 lines
3.6 KiB
Dart
import 'package:doctor_app_flutter/config/config.dart';
|
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart';
|
|
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart';
|
|
|
|
class VitalSignsService extends BaseService {
|
|
VitalSignData patientVitalSigns;
|
|
List<VitalSignHistory> patientVitalSignsHistory = [];
|
|
|
|
Future getPatientVitalSign(PatiantInformtion patient) async {
|
|
patientVitalSigns = null;
|
|
hasError = false;
|
|
Map<String, dynamic> body = Map();
|
|
body['PatientMRN'] = patient.patientMRN;
|
|
body['AppointmentNo'] = patient.appointmentNo;
|
|
body['EpisodeID'] = patient.episodeNo;
|
|
await baseAppClient.post(
|
|
GET_PATIENT_VITAL_SIGN_DATA,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
if (response['VitalSignsList'] != null) {
|
|
if (response['VitalSignsList']['entityList'] != null &&
|
|
(response['VitalSignsList']['entityList'] as List).length > 0) {
|
|
patientVitalSigns = VitalSignData.fromJson(
|
|
response['VitalSignsList']['entityList'][0]);
|
|
}
|
|
}
|
|
},
|
|
onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error.toString();
|
|
},
|
|
body: body,
|
|
);
|
|
}
|
|
|
|
Future getPatientVitalSignsHistory(
|
|
PatiantInformtion patient, String fromDate, String toDate) async {
|
|
patientVitalSigns = null;
|
|
hasError = false;
|
|
Map<String, dynamic> body = Map();
|
|
body['PatientID'] = patient.patientId; // patient.patientMRN
|
|
body['InOutPatientType'] = 1;
|
|
body['PatientTypeID'] = 1;
|
|
body['PatientType'] = 1;
|
|
body['DeviceTypeID'] = 1;
|
|
body['isDentalAllowedBackend'] = false;
|
|
body['ProjectID'] = patient.projectId;
|
|
// body['From'] = fromDate;
|
|
// body['To'] = toDate;
|
|
|
|
if (patient.appointmentNo != null && patient.projectId != null) {
|
|
body['TransNo'] = patient.appointmentNo;
|
|
body['ProjectID'] = patient.projectId;
|
|
}
|
|
await baseAppClient.post(
|
|
GET_PATIENT_VITAL_SIGN,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
patientVitalSignsHistory.clear();
|
|
if (response['List_DoctorPatientVitalSign'] != null) {
|
|
response['List_DoctorPatientVitalSign'].forEach((v) {
|
|
patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v));
|
|
});
|
|
}
|
|
},
|
|
onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error.toString();
|
|
},
|
|
body: body,
|
|
);
|
|
}
|
|
|
|
Future getOutPatientVitalSignHistory(PatiantInformtion patient, String fromDate, String toDate) async {
|
|
hasError = false;
|
|
Map<String, dynamic> body = Map();
|
|
body['PatientID'] = patient.patientId;
|
|
body['PatientTypeID'] = patient.patientType;
|
|
// if(isInPatient){
|
|
body['InOutPatientType'] = 0;
|
|
// }else {
|
|
// body['InOutPatientType'] = 2;
|
|
// }
|
|
|
|
|
|
await baseAppClient.postPatient(
|
|
GET_PATIENT_VITAL_SIGN,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
patientVitalSignsHistory.clear();
|
|
if (response['List_DoctorPatientVitalSign'] != null) {
|
|
response['List_DoctorPatientVitalSign'].forEach((v) {
|
|
patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v));
|
|
});}
|
|
},
|
|
onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error.toString();
|
|
},
|
|
body: body,
|
|
patient: patient
|
|
);
|
|
}
|
|
}
|