From 9ebc6980dd514decaada5d85246725e366399892 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 7 Oct 2020 11:32:28 +0300 Subject: [PATCH] change the checkup item based on service --- lib/config/config.dart | 2 + .../cmc_get_items_request_model.dart | 68 ++++++ .../cmc_get_items_response_model.dart | 18 ++ .../cmc_insert_pres_order_request_model.dart | 135 +++++++++++ .../get_cmc_service_request_model.dart | 72 ++++++ .../get_cmc_service_response_model.dart | 6 +- .../AlHabibMedicalService/cmc_service.dart | 57 +++-- .../AlHabibMedicalService/cmc_view_model.dart | 73 +++--- .../NewCMC/new_cmc_page.dart | 44 ++-- .../NewCMC/new_cmc_step_one_page.dart | 223 +++++++++++------- .../ComprehensiveMedicalCheckup/cmc_page.dart | 7 +- .../orders_log_details_page.dart | 9 +- 12 files changed, 560 insertions(+), 154 deletions(-) create mode 100644 lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart create mode 100644 lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart create mode 100644 lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index b2e108a6..0f6bbf10 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -258,9 +258,11 @@ const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; +const HHC_GET_ALL_CMC_SERVICES = "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; const GET_PATIENT_ALL_PRES_ORDERS ="Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders"; const PATIENT_ER_UPDATE_PRES_ORDER ="Services/Patients.svc/REST/PatientER_UpdatePresOrder"; const GET_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; +const GET_CHECK_UP_ITEMS ="Services/Patients.svc/REST/GetCheckUpItems"; const TIMER_MIN = 10; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart new file mode 100644 index 00000000..6880f9f5 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart @@ -0,0 +1,68 @@ +class CMCGetItemsRequestModel { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + int checkupType; + + CMCGetItemsRequestModel( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.checkupType}); + + CMCGetItemsRequestModel.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + checkupType = json['CheckupType']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['CheckupType'] = this.checkupType; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart new file mode 100644 index 00000000..6f362baa --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart @@ -0,0 +1,18 @@ +class CMCGetItemsResponseModel { + String itemDescription; + String itemName; + + CMCGetItemsResponseModel({this.itemDescription, this.itemName}); + + CMCGetItemsResponseModel.fromJson(Map json) { + itemDescription = json['ItemDescription']; + itemName = json['ItemName']; + } + + Map toJson() { + final Map data = new Map(); + data['ItemDescription'] = this.itemDescription; + data['ItemName'] = this.itemName; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart new file mode 100644 index 00000000..534988a7 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart @@ -0,0 +1,135 @@ +class CMCInsertPresOrderRequestModel { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + double latitude; + double longitude; + int createdBy; + int orderServiceID; + List patientERCMCInsertServicesList; + + CMCInsertPresOrderRequestModel( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.latitude, + this.longitude, + this.createdBy, + this.orderServiceID, + this.patientERCMCInsertServicesList}); + + CMCInsertPresOrderRequestModel.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + latitude = json['Latitude']; + longitude = json['Longitude']; + createdBy = json['CreatedBy']; + orderServiceID = json['OrderServiceID']; + if (json['PatientER_CMC_InsertServicesList'] != null) { + patientERCMCInsertServicesList = + new List(); + json['PatientER_CMC_InsertServicesList'].forEach((v) { + patientERCMCInsertServicesList + .add(new PatientERCMCInsertServicesList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['CreatedBy'] = this.createdBy; + data['OrderServiceID'] = this.orderServiceID; + if (this.patientERCMCInsertServicesList != null) { + data['PatientER_CMC_InsertServicesList'] = + this.patientERCMCInsertServicesList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PatientERCMCInsertServicesList { + int recordID; + String serviceID; + String selectedServiceName; + String selectedServiceNameAR; + dynamic price; + dynamic vAT; + dynamic totalPrice; + + PatientERCMCInsertServicesList( + {this.recordID, + this.serviceID, + this.selectedServiceName, + this.selectedServiceNameAR, + this.price, + this.vAT, + this.totalPrice}); + + PatientERCMCInsertServicesList.fromJson(Map json) { + recordID = json['RecordID']; + serviceID = json['ServiceID']; + selectedServiceName = json['selectedServiceName']; + selectedServiceNameAR = json['selectedServiceNameAR']; + price = json['Price']; + vAT = json['VAT']; + totalPrice = json['TotalPrice']; + } + + Map toJson() { + final Map data = new Map(); + data['RecordID'] = this.recordID; + data['ServiceID'] = this.serviceID; + data['selectedServiceName'] = this.selectedServiceName; + data['selectedServiceNameAR'] = this.selectedServiceNameAR; + data['Price'] = this.price; + data['VAT'] = this.vAT; + data['TotalPrice'] = this.totalPrice; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart index e69de29b..e80b656d 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart @@ -0,0 +1,72 @@ +class GetCMCServicesRequestModel { + int channel; + int deviceTypeID; + int genderID; + String generalid; + String identificationNo; + String iPAdress; + bool isDentalAllowedBackend; + int languageID; + int patientID; + int patientOutSA; + int patientType; + int patientTypeID; + String sessionID; + String tokenID; + double versionID; + + GetCMCServicesRequestModel( + {this.channel, + this.deviceTypeID, + this.genderID, + this.generalid, + this.identificationNo, + this.iPAdress, + this.isDentalAllowedBackend, + this.languageID, + this.patientID, + this.patientOutSA, + this.patientType, + this.patientTypeID, + this.sessionID, + this.tokenID, + this.versionID}); + + GetCMCServicesRequestModel.fromJson(Map json) { + channel = json['Channel']; + deviceTypeID = json['DeviceTypeID']; + genderID = json['GenderID']; + generalid = json['generalid']; + identificationNo = json['IdentificationNo']; + iPAdress = json['IPAdress']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + languageID = json['LanguageID']; + patientID = json['PatientID']; + patientOutSA = json['PatientOutSA']; + patientType = json['PatientType']; + patientTypeID = json['PatientTypeID']; + sessionID = json['SessionID']; + tokenID = json['TokenID']; + versionID = json['VersionID']; + } + + Map toJson() { + final Map data = new Map(); + data['Channel'] = this.channel; + data['DeviceTypeID'] = this.deviceTypeID; + data['GenderID'] = this.genderID; + data['generalid'] = this.generalid; + data['IdentificationNo'] = this.identificationNo; + data['IPAdress'] = this.iPAdress; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['LanguageID'] = this.languageID; + data['PatientID'] = this.patientID; + data['PatientOutSA'] = this.patientOutSA; + data['PatientType'] = this.patientType; + data['PatientTypeID'] = this.patientTypeID; + data['SessionID'] = this.sessionID; + data['TokenID'] = this.tokenID; + data['VersionID'] = this.versionID; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart index dbf9e9a3..5f356e2b 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart @@ -3,10 +3,10 @@ class GetCMCServicesResponseModel { String descriptionN; int iD; bool isActive; - int price; + dynamic price; int serviceID; - int totalPrice; - int vAT; + dynamic totalPrice; + dynamic vAT; GetCMCServicesResponseModel( {this.description, diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index 61250c2c..552da6f7 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_request_model.dart'; @@ -10,39 +12,42 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import '../base_service.dart'; class CMCService extends BaseService { - List hhcAllServicesList = List(); - List hhcAllPresOrdersList = List(); + List cmcAllServicesList = List(); + List cmcAllPresOrdersList = List(); - List hhcAllOrderDetail = List(); + List cmcAllOrderDetail = List(); + List checkupItemsList = List(); bool isOrderUpdated; - Future getHHCAllServices( - HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { + Future getCMCAllServices() async { + + + GetCMCServicesRequestModel getCMCServicesRequestModel= new GetCMCServicesRequestModel(genderID: user.gender, identificationNo: user.patientIdentificationNo); hasError = false; - await baseAppClient.post(HHC_GET_ALL_SERVICES, + await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, onSuccess: (dynamic response, int statusCode) { - hhcAllServicesList.clear(); - response['PatientER_HHC_GetAllServicesList'].forEach((data) { - hhcAllServicesList.add(HHCGetAllServicesResponseModel.fromJson(data)); + cmcAllServicesList.clear(); + response['PatientER_CMC_GetAllServicesList'].forEach((data) { + cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: hHCGetAllServicesRequestModel.toJson()); + }, body: getCMCServicesRequestModel.toJson()); } - Future getHHCAllPresOrders() async { + Future getCmcAllPresOrders() async { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel= GetHHCAllPresOrdersRequestModel(); hasError = false; await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { - hhcAllPresOrdersList.clear(); + cmcAllPresOrdersList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + cmcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -55,9 +60,9 @@ class CMCService extends BaseService { hasError = false; await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { - hhcAllOrderDetail.clear(); + cmcAllOrderDetail.clear(); response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) { - hhcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); + cmcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -65,7 +70,23 @@ class CMCService extends BaseService { }, body: getOrderDetailByOrderIDRequestModel.toJson()); } - Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + + Future getCheckupItems(CMCGetItemsRequestModel cMCGetItemsRequestModel) async { + + hasError = false; + await baseAppClient.post(GET_CHECK_UP_ITEMS, + onSuccess: (dynamic response, int statusCode) { + checkupItemsList.clear(); + response['GetCheckUpItemsList'].forEach((data) { + checkupItemsList.add(CMCGetItemsResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: cMCGetItemsRequestModel.toJson()); + } + + Future updateCmcPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index 1d350a03..15bcff9c 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; @@ -11,42 +12,56 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; class CMCViewModel extends BaseViewModel { - CMCService _homeHealthCareService = + CMCService _cMCService = locator(); - List get hhcAllServicesList => - _homeHealthCareService.hhcAllServicesList; + List get cmcAllServicesList => + _cMCService.cmcAllServicesList; - List get hhcAllPresOrders => - _homeHealthCareService.hhcAllPresOrdersList; + List get cmcAllPresOrders => + _cMCService.cmcAllPresOrdersList; - List get hhcAllOrderDetail => - _homeHealthCareService.hhcAllOrderDetail; + List get cmcAllOrderDetail => + _cMCService.cmcAllOrderDetail; + List get checkupItems => + _cMCService.checkupItemsList; - bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; + bool get isOrderUpdated => _cMCService.isOrderUpdated; - Future getHHCAllServices() async { - HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = - new HHCGetAllServicesRequestModel(); + Future getCMCAllServices() async { setState(ViewState.Busy); - await _homeHealthCareService - .getHHCAllServices(hHCGetAllServicesRequestModel); - if (_homeHealthCareService.hasError) { - error = _homeHealthCareService.error; + await _cMCService + .getCMCAllServices(); + CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: cmcAllServicesList[0].iD); + + await getCheckupItems(cMCGetItemsRequestModel); + if (_cMCService.hasError) { + error = _cMCService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + Future getCheckupItems(CMCGetItemsRequestModel cMCGetItemsRequestModel) async { + setState(ViewState.Busy); + await _cMCService + .getCheckupItems(cMCGetItemsRequestModel); + if (_cMCService.hasError) { + error = _cMCService.error; setState(ViewState.Error); } else { setState(ViewState.Idle); } } - Future getHHCAllPresOrders() async { + Future getCmcAllPresOrders() async { setState(ViewState.Busy); - await _homeHealthCareService.getHHCAllPresOrders(); - if (_homeHealthCareService.hasError) { - error = _homeHealthCareService.error; + await _cMCService.getCmcAllPresOrders(); + if (_cMCService.hasError) { + error = _cMCService.error; setState(ViewState.Error); } else { - var pendingOrder = _homeHealthCareService.hhcAllPresOrdersList + var pendingOrder = _cMCService.cmcAllPresOrdersList .firstWhere((element) => element.status == 1 || element.status == 2, orElse: () => null); if (pendingOrder != null) @@ -55,13 +70,13 @@ class CMCViewModel extends BaseViewModel { } } - Future updateHHCPresOrder( + Future updateCmcPresOrder( UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.BusyLocal); - await _homeHealthCareService.updateHHCPresOrder( + await _cMCService.updateCmcPresOrder( updatePresOrderRequestModel); - if (_homeHealthCareService.hasError) { - error = _homeHealthCareService.error; + if (_cMCService.hasError) { + error = _cMCService.error; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); @@ -72,10 +87,10 @@ class CMCViewModel extends BaseViewModel { GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = GetOrderDetailByOrderIDRequestModel( presOrderID: order.iD); setState(ViewState.Busy); - await _homeHealthCareService.getOrderDetailByOrderID( + await _cMCService.getOrderDetailByOrderID( getOrderDetailByOrderIDRequestModel); - if (_homeHealthCareService.hasError) { - error = _homeHealthCareService.error; + if (_cMCService.hasError) { + error = _cMCService.error; setState(ViewState.Error); } else { setState(ViewState.Idle); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index b8003b4f..4ce0035f 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart'; @@ -29,12 +29,25 @@ class _NewCMCPageState extends State int _currentIndex = 1; int pageSelected = 2; - - PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel(); + CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; @override void initState() { super.initState(); + + PatientERCMCInsertServicesList patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: widget.model.cmcAllServicesList[0].price, + serviceID: widget.model.cmcAllServicesList[0].serviceID.toString(), + selectedServiceName: widget.model.cmcAllServicesList[0].description, + selectedServiceNameAR: + widget.model.cmcAllServicesList[0].description, + recordID: 1, + totalPrice: widget.model.cmcAllServicesList[0].totalPrice, + vAT: widget.model.cmcAllServicesList[0].vAT); + cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel( + patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); + print(widget.model); _controller = new PageController(); } @@ -61,13 +74,13 @@ class _NewCMCPageState extends State presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - await model.updateHHCPresOrder(updatePresOrderRequestModel); - if(model.state == ViewState.ErrorLocal) { + await model.updateCmcPresOrder(updatePresOrderRequestModel); + if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { AppToast.showSuccessToast(message: "Done Successfully"); - await model.getHHCAllPresOrders(); - await model.getHHCAllServices(); + await model.getCmcAllPresOrders(); + await model.getCMCAllServices(); } }, )); @@ -87,7 +100,7 @@ class _NewCMCPageState extends State }, scrollDirection: Axis.horizontal, children: [ - widget.model.hhcAllOrderDetail.length != 0 + widget.model.cmcAllOrderDetail.length != 0 ? FractionallySizedBox( heightFactor: 0.8, widthFactor: 0.9, @@ -131,7 +144,7 @@ class _NewCMCPageState extends State height: 4, ), Texts( - widget.model.hhcAllOrderDetail[0].iD.toString(), + widget.model.cmcAllOrderDetail[0].iD.toString(), fontSize: 22, ), ], @@ -197,7 +210,7 @@ class _NewCMCPageState extends State Texts( DateUtil.getDayMonthYearDateFormatted( DateUtil.convertStringToDate( - widget.model.hhcAllOrderDetail[0] + widget.model.cmcAllOrderDetail[0] .createdOn)), fontSize: 22, ), @@ -230,9 +243,9 @@ class _NewCMCPageState extends State height: 4, ), Texts( - widget.model.hhcAllOrderDetail[0].description + widget.model.cmcAllOrderDetail[0].description .toString() ?? - widget.model.hhcAllOrderDetail[0] + widget.model.cmcAllOrderDetail[0] .descriptionN .toString(), fontSize: 22, @@ -253,7 +266,8 @@ class _NewCMCPageState extends State child: SecondaryButton( label: "Cancel".toUpperCase(), onTap: () { - showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + showConfirmMessage(widget.model, + widget.model.cmcAllOrderDetail[0]); } , color: Colors.red[800], @@ -272,8 +286,8 @@ class _NewCMCPageState extends State ) : NewCMCStepOnePage( changePageViewIndex: changePageViewIndex, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, + cMCInsertPresOrderRequestModel: + cMCInsertPresOrderRequestModel, model: widget.model, ), // NewEReferralStepTowPage( diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index b65343f7..77ddb053 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -1,5 +1,5 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -8,14 +8,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class NewCMCStepOnePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; final Function changePageViewIndex; final CMCViewModel model; + const NewCMCStepOnePage( {Key key, - this.patientERInsertPresOrderRequestModel, - this.model, + this.cMCInsertPresOrderRequestModel, + this.model, this.changePageViewIndex}) : super(key: key); @@ -28,10 +28,6 @@ class _NewCMCStepOnePageState extends State { @override void initState() { - - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList =[]; super.initState(); } @@ -45,74 +41,145 @@ class _NewCMCStepOnePageState child: Container( margin: EdgeInsets.all(12), child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - Texts( + child: Column( + children: [ + FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Texts( // TranslationBase.of(context).advancePaymentLabel, - "Select Home Health Care Services", - textAlign: TextAlign.center, - ), - Column( - children: widget.model.hhcAllServicesList.map((service) { - return Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - children: [ - Row( + "Select Home Health Care Services", + textAlign: TextAlign.center, + ), + Column( + children: widget.model.cmcAllServicesList.map(( + service) { + return Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + border: + Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( children: [ - Checkbox( - value: isServiceSelected( - service.serviceID), - activeColor: Colors.black38, - onChanged: (bool newValue) { - setState(() { - this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .add(new PatientERHHCInsertServicesList( - recordID: this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length, - serviceID: - service.serviceID, - serviceName: - service.description)); - // widget.patientERInsertPresOrderRequestModel - // isPatientInsured = newValue; - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Texts( - service.description, - fontSize: 15, + Row( + children: [ + Radio( + value: service.serviceID, + activeColor: Colors.red[800], + onChanged: (newValue) async { + PatientERCMCInsertServicesList patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: service.price, + serviceID: service.serviceID + .toString(), + selectedServiceName: service + .description, + selectedServiceNameAR: + service.description, + recordID: 1, + totalPrice: service.totalPrice, + vAT: service.vAT); + + + print(newValue); + setState(() { + widget + .cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList = + [patientERCMCInsertServicesList]; + }); + CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel (checkupType:newValue ); + await widget.model.getCheckupItems(cMCGetItemsRequestModel); + }, + groupValue: int.parse(widget + .cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList[0] + .serviceID),), + Expanded( + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Texts( + service.description, + fontSize: 15, + ), + ), ), - ), + ], ), ], ), - ], - ), - ); - }).toList(), - ) - ], - ), + ); + }).toList(), + ), + ], + ), + ), + SizedBox(height: 30,), + Container( + color: Colors.white, + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: widget.model.checkupItems.map((item) { + return Center( + child: FractionallySizedBox( + widthFactor: 0.8, + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + border: + Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 5, top: 5), + decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + item.itemName, + fontSize: 15, + ), + ], + ), + ), + + SizedBox( + height: 12, + ), + ], + ), + ), + ), + ); + }).toList()), + ) + ], ), ), ), @@ -129,7 +196,7 @@ class _NewCMCStepOnePageState .width * 0.9, child: SecondaryButton( label: "Next", - disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length ==0, + // disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length ==0, textColor: Theme .of(context) .backgroundColor), @@ -139,13 +206,5 @@ class _NewCMCStepOnePageState )); } - isServiceSelected(int serviceId) { - Iterable patientERHHCInsertServicesList = widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); - if(patientERHHCInsertServicesList.length > 0) { - return true; - } - return false; - } + } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index cf851c45..0613ff80 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -36,8 +37,10 @@ class _CMCPageState extends State Widget build(BuildContext context) { return BaseView( onModelReady: (model){ - model.getHHCAllServices(); - model.getHHCAllPresOrders(); + + model.getCMCAllServices(); + // model.getCheckupItems(cMCGetItemsRequestModel); + model.getCmcAllPresOrders(); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index 814d672c..95f16cf2 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -32,13 +31,13 @@ class OrdersLogDetailsPage extends StatelessWidget { presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - await model.updateHHCPresOrder(updatePresOrderRequestModel); + await model.updateCmcPresOrder(updatePresOrderRequestModel); if(model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { AppToast.showSuccessToast(message: "Done Successfully"); - await model.getHHCAllPresOrders(); - await model.getHHCAllServices(); + await model.getCmcAllPresOrders(); + await model.getCMCAllServices(); } }, )); @@ -62,7 +61,7 @@ class OrdersLogDetailsPage extends StatelessWidget { ), Column( crossAxisAlignment: CrossAxisAlignment.start, - children: model.hhcAllPresOrders.map((order) { + children: model.cmcAllPresOrders.map((order) { return Container( width: double.infinity, margin: EdgeInsets.only(top: 15),