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.
diplomatic-quarter/lib/core/service/er/EdOnlineServices.dart

97 lines
3.1 KiB
Dart

import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/er/ErPatientShareModel.dart';
import 'package:diplomaticquarterapp/core/model/er/TriageQuestionsModel.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class EdOnlineServices extends BaseService {
List<TriageQuestionsModel> triageQuestionsModelList = List();
ErPatientShareModel erPatientShareModel;
Future getQuestions() async {
hasError =false;
triageQuestionsModelList.clear();
Map<String, dynamic> body = Map();
body['ProjectID'] = 15;
await baseAppClient.post(ER_GET_VISUAL_TRIAGE_QUESTIONS,
onSuccess: (dynamic response, int statusCode) {
triageQuestionsModelList.clear();
response['ER_TriageQuestionsList'].forEach((questions) {
triageQuestionsModelList.add(TriageQuestionsModel.fromJson(questions));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
Future getPatientPaymentInformation({var id}) async {
hasError =false;
await baseAppClient.post(ER_GetPatientPaymentInformationForERClinic,
onSuccess: (dynamic response, int statusCode) {
erPatientShareModel =
ErPatientShareModel.fromJson(response['ER_PatientShare']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: Map.from({"ProjectID":15,"ClinicID":10}));
}
Future saveQuestionsInformation(
{String notes,
String chiefComplaint,
int projectId,
DateTime selectedTime,
List<TriageQuestionsModel> selectedQuestions}) async {
hasError =false;
Map<String, dynamic> body = Map();
List<Map> checklist = List();
body['ProjectID'] = 15;
body['ProjectId'] = projectId;
int riskScore = 0;
if (user.age > 14) {
selectedQuestions.forEach((element) {
int score = int.parse(element.adultPoints);
riskScore += score;
checklist.add(Map.from({
"IsSelected": 1,
"ParameterCode": element.parameterCode,
"ParameterGroup": element.parameterGroup,
"ParameterType": element.parameterType,
"Score": score
}));
});
} else {
selectedQuestions.forEach((element) {
int score = int.parse(element.pediaPoints);
riskScore += score;
checklist.add(Map.from({
"IsSelected": 1,
"ParameterCode": element.parameterCode,
"ParameterGroup": element.parameterGroup,
"ParameterType": element.parameterType,
"Score": score
}));
});
}
body['ERTriageInformation'] = {
"Notes": notes,
"ChiefComplaint": chiefComplaint,
"PatientId": user.patientID,
"ProjectId": 15,
"RiskScore": riskScore,
"checklist": checklist.map((e) => e).toList()
};
await baseAppClient.post(ER_SAVE_TRIAGE_INFORMATION,
onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}