InPatient General Consent API implemented

Dev_3.3_InPatient_CR
haroon amjad 2 years ago
parent 157b73c3e9
commit 6310c1c615

@ -631,6 +631,8 @@ var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymoth
var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification';
var INSERT_GENERAL_ADMISSION_CONSENT = 'Services/INPs.svc/REST/Inp_insertAAForGeneralAdmissionConsent';
//Meal Plan APIs
var GET_ADMITTED_PATIENTS = 'Services/MOP.svc/REST/GetAdmittedPatients';
var GET_CURRENT_WEEKID_WEEKDAY = 'Services/MOP.svc/REST/GetCurrentWeekAndDayHMGMP';

@ -1,13 +1,23 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class InPatientGeneralConsent extends StatelessWidget {
const InPatientGeneralConsent();
InPatientGeneralConsent();
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@ -443,9 +453,77 @@ class InPatientGeneralConsent extends StatelessWidget {
),
),
),
)
),
Padding(
padding: const EdgeInsets.only(left: 21.0, right: 21.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
flex: 1,
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
height: 45.0,
child: CustomTextButton(
backgroundColor: Color(0xffc5272d),
elevation: 0,
onPressed: () {
acceptRejectConsent(context, 0);
},
child: Text(TranslationBase.of(context).reject, style: TextStyle(fontSize: 16.0, color: Colors.white)),
),
),
),
mWidth(7),
Expanded(
flex: 1,
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
height: 45.0,
child: CustomTextButton(
backgroundColor: CustomColors.green,
elevation: 0,
onPressed: () {
acceptRejectConsent(context, 1);
},
child: Text(TranslationBase.of(context).acceptLbl, style: TextStyle(fontSize: 16.0, color: Colors.white)),
),
),
),
],
),
),
],
),
);
}
void acceptRejectConsent(BuildContext context, int status) {
ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context);
service
.insertForGeneralAdmissionConsent(
projectViewModel.user.patientID,
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo : projectViewModel.getAdmissionRequestInfoResponseModel.admissionRequestNo,
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.clinicID : projectViewModel.getAdmissionRequestInfoResponseModel.clinicId,
projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.projectID : projectViewModel.getAdmissionRequestInfoResponseModel.projectId,
status,
context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["MessageStatus"] == 1) {
AppToast.showErrorToast(message: res["SuccessMsg"]);
} else {
AppToast.showErrorToast(message: res["endUserMessage"]);
}
Navigator.pop(context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
}

@ -313,6 +313,30 @@ class ClinicListService extends BaseService {
return Future.value(localRes);
}
Future<Map> insertForGeneralAdmissionConsent(num patientID, num admissionReqNo, int clinicID, int projectID, int status, context) async {
Map<String, dynamic> request;
request = {
"AdmissionRequestNo": admissionReqNo,
"ClinicID": clinicID,
"CreatedBy": 102,
"PatientID": patientID,
"ProjectID": projectID,
"status": status,
"searchKey": "",
"pageIndex": 0,
"pageSize": 0,
};
dynamic localRes;
await baseAppClient.post(INSERT_GENERAL_ADMISSION_CONSENT, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request, isAllowAny: true);
return Future.value(localRes);
}
Future<Map> submitBirthNotification(num motherMRN, int projectID, String fatherNameAR, String fatherNameEN, String babyNameAR, String babyNameEN, String contactNum, String idImage, context) async {
Map<String, dynamic> request;
request = {

Loading…
Cancel
Save