diff --git a/lib/config/config.dart b/lib/config/config.dart index d85b75cc..0aaaa56d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -395,6 +395,9 @@ const GET_INTERVENTION_MEDICATION = const GET_INTERVENTION_MEDICATION_HISTORY = "Services/DoctorApplication.svc/REST/DoctorApp_GetInterventionHistory"; +const SET_ACCEPTED_OR_REJECTED = + "Services/DoctorApplication.svc/REST/DoctorApp_AcceptOrRejectIntervention"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/service/patient/profile/intervention_medication_service.dart b/lib/core/service/patient/profile/intervention_medication_service.dart index 24d18eef..eab0fcab 100644 --- a/lib/core/service/patient/profile/intervention_medication_service.dart +++ b/lib/core/service/patient/profile/intervention_medication_service.dart @@ -1,14 +1,11 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/model/vte_assessment/vte_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/vte_assessment/vte_assessment_res_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -import 'package:doctor_app_flutter/models/discharge_summary/GetDischargeSummaryReqModel.dart'; -import 'package:doctor_app_flutter/models/discharge_summary/GetDischargeSummaryResModel.dart'; +import '../../../../screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart'; +import '../../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_req_model.dart'; +import '../../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_res_model.dart'; +import '../../../../screens/patients/profile/pharmacy-intervention-model/new_medication_req_model.dart'; +import '../../../../screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart'; -import '../../../../screens/patients/profile/new-medication-model/intervention_medication_history_req_model.dart'; -import '../../../../screens/patients/profile/new-medication-model/intervention_medication_history_res_model.dart'; -import '../../../../screens/patients/profile/new-medication-model/new_medication_req_model.dart'; -import '../../../../screens/patients/profile/new-medication-model/new_medication_res_model.dart'; class InterventionMedicationService extends BaseService { @@ -55,4 +52,17 @@ class InterventionMedicationService extends BaseService { super.error = error; }, body: interventionMedicationHistoryReqModel.toJson()); } + + Future setAcceptedOrRejected( + {AcceptOrRejectReqModel acceptOrRejectReqModel}) async { + hasError = false; + await baseAppClient.post(SET_ACCEPTED_OR_REJECTED, + onSuccess: (dynamic response, int statusCode) { + _allInterventionHistoryList.clear(); + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: acceptOrRejectReqModel.toJson()); + } } diff --git a/lib/core/viewModel/profile/intervention_medication_view_model.dart b/lib/core/viewModel/profile/intervention_medication_view_model.dart index 8494b6d9..343dda42 100644 --- a/lib/core/viewModel/profile/intervention_medication_view_model.dart +++ b/lib/core/viewModel/profile/intervention_medication_view_model.dart @@ -2,11 +2,11 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/new-medication-model/new_medication_res_model.dart'; - -import '../../../screens/patients/profile/new-medication-model/intervention_medication_history_req_model.dart'; -import '../../../screens/patients/profile/new-medication-model/intervention_medication_history_res_model.dart'; -import '../../../screens/patients/profile/new-medication-model/new_medication_req_model.dart'; +import '../../../screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart'; +import '../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_req_model.dart'; +import '../../../screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_res_model.dart'; +import '../../../screens/patients/profile/pharmacy-intervention-model/new_medication_req_model.dart'; +import '../../../screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart'; import '../../service/patient/profile/intervention_medication_service.dart'; class InterventionMedicationViewModel extends BaseViewModel { @@ -68,4 +68,29 @@ class InterventionMedicationViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + + Future setAcceptedOrRejected({ + String remarks, + }) async { + AcceptOrRejectReqModel acceptOrRejectReqModel = + AcceptOrRejectReqModel( + projectID: 15, + patientID: 79941, + admissionNo: 2018013900, + prescriptionNo: 2045165, + orderNo: 1171570, + remarks: remarks + ); + hasError = false; + setState(ViewState.Busy); + await _interventionMedicationService.setAcceptedOrRejected( + acceptOrRejectReqModel: acceptOrRejectReqModel); + if (_interventionMedicationService.hasError) { + error = _interventionMedicationService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart b/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart index b34cced5..1bd1c4d2 100644 --- a/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart +++ b/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart @@ -1,14 +1,8 @@ -import 'package:doctor_app_flutter/core/enum/filter_type.dart'; -import 'package:doctor_app_flutter/core/enum/patient_type.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart'; import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; - import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart b/lib/screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart new file mode 100644 index 00000000..07ef3f99 --- /dev/null +++ b/lib/screens/patients/profile/pharmacy-intervention-model/accept_or_reject_req_model.dart @@ -0,0 +1,56 @@ +class AcceptOrRejectReqModel { + int patientID; + int projectID; + int admissionNo; + int prescriptionNo; + int orderNo; + String remarks; + int memberID; + int accessLevel; + int languageID; + int lineItemNo; + bool patientOutSA; + + AcceptOrRejectReqModel( + {this.patientID, + this.projectID, + this.admissionNo, + this.prescriptionNo, + this.orderNo, + this.remarks, + this.memberID, + this.accessLevel, + this.languageID, + this.lineItemNo, + this.patientOutSA}); + + AcceptOrRejectReqModel.fromJson(Map json) { + patientID = json['PatientID']; + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + prescriptionNo = json['PrescriptionNo']; + orderNo = json['OrderNo']; + remarks = json['Remarks']; + memberID = json['MemberID']; + accessLevel = json['AccessLevel']; + languageID = json['LanguageID']; + lineItemNo = json['LineItemNo']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['PrescriptionNo'] = this.prescriptionNo; + data['OrderNo'] = this.orderNo; + data['Remarks'] = this.remarks; + data['MemberID'] = this.memberID; + data['AccessLevel'] = this.accessLevel; + data['LanguageID'] = this.languageID; + data['LineItemNo'] = this.lineItemNo; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/pharmacy-intervention-model/accept_or_reject_res_model.dart b/lib/screens/patients/profile/pharmacy-intervention-model/accept_or_reject_res_model.dart new file mode 100644 index 00000000..7e2448f6 --- /dev/null +++ b/lib/screens/patients/profile/pharmacy-intervention-model/accept_or_reject_res_model.dart @@ -0,0 +1,4 @@ +class AcceptOrRejectResModel { + + +} \ No newline at end of file diff --git a/lib/screens/patients/profile/new-medication-model/intervention_medication_history_req_model.dart b/lib/screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_req_model.dart similarity index 100% rename from lib/screens/patients/profile/new-medication-model/intervention_medication_history_req_model.dart rename to lib/screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_req_model.dart diff --git a/lib/screens/patients/profile/new-medication-model/intervention_medication_history_res_model.dart b/lib/screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_res_model.dart similarity index 100% rename from lib/screens/patients/profile/new-medication-model/intervention_medication_history_res_model.dart rename to lib/screens/patients/profile/pharmacy-intervention-model/intervention_medication_history_res_model.dart diff --git a/lib/screens/patients/profile/new-medication-model/new_medication_req_model.dart b/lib/screens/patients/profile/pharmacy-intervention-model/new_medication_req_model.dart similarity index 100% rename from lib/screens/patients/profile/new-medication-model/new_medication_req_model.dart rename to lib/screens/patients/profile/pharmacy-intervention-model/new_medication_req_model.dart diff --git a/lib/screens/patients/profile/new-medication-model/new_medication_res_model.dart b/lib/screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart similarity index 100% rename from lib/screens/patients/profile/new-medication-model/new_medication_res_model.dart rename to lib/screens/patients/profile/pharmacy-intervention-model/new_medication_res_model.dart diff --git a/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart b/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart index 25d85c9b..ee24edfa 100644 --- a/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart +++ b/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart @@ -1,8 +1,4 @@ -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/profile/vte_assessment_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -16,13 +12,9 @@ import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - import '../../../../config/config.dart'; -import '../../../../core/service/AnalyticsService.dart'; import '../../../../core/viewModel/profile/intervention_medication_view_model.dart'; -import '../../../../icons_app/doctor_app_icons.dart'; -import '../../../../locator.dart'; -import '../operation_report/update_operation_report.dart'; + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -299,25 +291,7 @@ class _InterventionMedicationHistoryScreenState extends State() - .logEvent( - eventCategory: - "Operation Report Screen", - eventAction: - "Update Operation Report ", - ); - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // UpdateOperationReport( - // reservation: model - // .reservationList[ - // index], - // patient: patient, - // isUpdate: true, - // )), - // ); + model.setAcceptedOrRejected(remarks: "Accepted"); }, child: Container( decoration: BoxDecoration( @@ -349,25 +323,7 @@ class _InterventionMedicationHistoryScreenState extends State() - .logEvent( - eventCategory: - "Operation Report Screen", - eventAction: - "Update Operation Report ", - ); - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // UpdateOperationReport( - // reservation: model - // .reservationList[ - // index], - // patient: patient, - // isUpdate: true, - // )), - // ); + model.setAcceptedOrRejected(remarks: "Rejected"); }, child: Container( decoration: BoxDecoration( diff --git a/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart b/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart index 0713d3be..e7ac7b2c 100644 --- a/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart +++ b/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; + import '../../../../core/viewModel/profile/pharmacy_intervention_view_model.dart'; import '../../../../models/patient/patiant_info_model.dart'; import '../../../base/base_view.dart'; @@ -15,15 +16,18 @@ import 'intervention_medication.dart'; class PharmacyInterventionScreen extends StatefulWidget { final OutPatientFilterType outPatientFilterType; - const PharmacyInterventionScreen( - {Key key, this.outPatientFilterType, }) - : super(key: key); + const PharmacyInterventionScreen({ + Key key, + this.outPatientFilterType, + }) : super(key: key); @override - _PharmacyInterventionScreenState createState() => _PharmacyInterventionScreenState(); + _PharmacyInterventionScreenState createState() => + _PharmacyInterventionScreenState(); } -class _PharmacyInterventionScreenState extends State { +class _PharmacyInterventionScreenState + extends State { @override void initState() { // TODO: implement initState @@ -35,145 +39,161 @@ class _PharmacyInterventionScreenState extends State final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; return BaseView( - builder: (_, model, w) =>AppScaffold( - isShowAppBar: false, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Padding( - padding: EdgeInsets.all(0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BottomSheetTitle( - title: (OutPatientFilterType.Previous == - widget.outPatientFilterType) - ? "" - : " New Medication", - ), - SizedBox( - height: 10.0, - ), - Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Container( - color: Colors.white, - child: InkWell( - onTap: () => selectDate(context,model, - firstDate: - getFirstDate(widget.outPatientFilterType), - lastDate: - getLastDate(widget.outPatientFilterType)), - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).fromDate, - model - .selectedFromDate != - null - ? "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Padding( + padding: EdgeInsets.all(0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetTitle( + title: (OutPatientFilterType.Previous == + widget.outPatientFilterType) + ? "" + : " Pharmacy Intervention", + ), + SizedBox( + height: 10.0, + ), + Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + Container( + color: Colors.white, + child: InkWell( + onTap: () => selectDate( + context, + model, + firstDate: DateTime( + DateTime.now().year - 20, + DateTime.now().month, + DateTime.now().day), + lastDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day + 100), + selectedDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day), + ), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).fromDate, + model.selectedFromDate != null + ? "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), ), ), - ), - SizedBox( - height: 10, - ), - Container( - color: Colors.white, - child: InkWell( - onTap: () => selectDate(context,model, + SizedBox( + height: 10, + ), + Container( + color: Colors.white, + child: InkWell( + onTap: () => selectDate( + context, + model, isFromDate: false, - firstDate: - getFirstDate(widget.outPatientFilterType), - lastDate: - getLastDate(widget.outPatientFilterType)), - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).toDate, - model - .selectedToDate != - null - ? "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, + firstDate: DateTime( + DateTime.now().year - 20, + DateTime.now().month, + DateTime.now().day), + lastDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day + 100), + selectedDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day), + ), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).toDate, + model.selectedToDate != null + ? "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), ), ), - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), ), ), - ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context).search, - padding: 5, - color: Color(0xFF359846), - onPressed: () async { - - Navigator.push( - context, - MaterialPageRoute(builder: (context) => InterventionMedicationScreen(patient)), - ); - - - }, + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: TranslationBase.of(context).search, + padding: 5, + color: Color(0xFF359846), + onPressed: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + InterventionMedicationScreen(patient)), + ); + }, + ), ), ), ), - ), - SizedBox( - height: 5, - ), - ], - ), - )) - ); + SizedBox( + height: 5, + ), + ], + ), + ))); } - selectDate(BuildContext context,PharmacyInterventionViewModel model, - {bool isFromDate = true, DateTime firstDate, lastDate}) async { + selectDate(BuildContext context, PharmacyInterventionViewModel model, + {bool isFromDate = true, + DateTime firstDate, + lastDate, + selectedDate}) async { Helpers.hideKeyboard(context); - DateTime selectedDate = isFromDate - ? model.selectedFromDate ?? firstDate - : model.selectedToDate ?? lastDate; final DateTime picked = await showDatePicker( context: context, initialDate: selectedDate, @@ -199,25 +219,25 @@ class _PharmacyInterventionScreenState extends State } } - getFirstDate(OutPatientFilterType outPatientFilterType) { - if (outPatientFilterType == OutPatientFilterType.Previous) { - return DateTime( - DateTime.now().year - 20, DateTime.now().month, DateTime.now().day); - } else { - return DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day + 1); - } - } + // getFirstDate(OutPatientFilterType outPatientFilterType) { + // if (outPatientFilterType == OutPatientFilterType.Previous) { + // return DateTime(F + // DateTime.now().year - 20, DateTime.now().month, DateTime.now().day); + // } else { + // return DateTime( + // DateTime.now().year, DateTime.now().month, DateTime.now().day + 1); + // } + // } - getLastDate(OutPatientFilterType outPatientFilterType) { - if (outPatientFilterType == OutPatientFilterType.Previous) { - return DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); - } else { - return DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day + 7); - } - } + // getLastDate(OutPatientFilterType outPatientFilterType) { + // if (outPatientFilterType == OutPatientFilterType.Previous) { + // return DateTime( + // DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + // } else { + // return DateTime( + // DateTime.now().year , DateTime.now().month , DateTime.now().day + 100); + // } + // } InputDecoration textFieldSelectorDecoration( String hintText, String selectedText, bool isDropDown, @@ -238,11 +258,11 @@ class _PharmacyInterventionScreenState extends State hintText: selectedText != null ? selectedText : hintText, suffixIcon: isDropDown ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.keyboard_arrow_down_sharp, - color: Color(0xff2E303A), - ) + ? suffixIcon + : Icon( + Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) : null, hintStyle: TextStyle( fontSize: 13,