change the checkup item based on service

er_location
Elham Rababah 4 years ago
parent 31b217aa19
commit 9ebc6980dd

@ -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;

@ -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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -0,0 +1,18 @@
class CMCGetItemsResponseModel {
String itemDescription;
String itemName;
CMCGetItemsResponseModel({this.itemDescription, this.itemName});
CMCGetItemsResponseModel.fromJson(Map<String, dynamic> json) {
itemDescription = json['ItemDescription'];
itemName = json['ItemName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ItemDescription'] = this.itemDescription;
data['ItemName'] = this.itemName;
return data;
}
}

@ -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> 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<String, dynamic> 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<PatientERCMCInsertServicesList>();
json['PatientER_CMC_InsertServicesList'].forEach((v) {
patientERCMCInsertServicesList
.add(new PatientERCMCInsertServicesList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
recordID = json['RecordID'];
serviceID = json['ServiceID'];
selectedServiceName = json['selectedServiceName'];
selectedServiceNameAR = json['selectedServiceNameAR'];
price = json['Price'];
vAT = json['VAT'];
totalPrice = json['TotalPrice'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -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,

@ -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<HHCGetAllServicesResponseModel> hhcAllServicesList = List();
List<GetHHCAllPresOrdersResponseModel> hhcAllPresOrdersList = List();
List<GetCMCServicesResponseModel> cmcAllServicesList = List();
List<GetHHCAllPresOrdersResponseModel> cmcAllPresOrdersList = List();
List<GetOrderDetailByOrderIDResponseModel> hhcAllOrderDetail = List();
List<GetOrderDetailByOrderIDResponseModel> cmcAllOrderDetail = List();
List<CMCGetItemsResponseModel> 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,

@ -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<CMCService>();
List<HHCGetAllServicesResponseModel> get hhcAllServicesList =>
_homeHealthCareService.hhcAllServicesList;
List<GetCMCServicesResponseModel> get cmcAllServicesList =>
_cMCService.cmcAllServicesList;
List<GetHHCAllPresOrdersResponseModel> get hhcAllPresOrders =>
_homeHealthCareService.hhcAllPresOrdersList;
List<GetHHCAllPresOrdersResponseModel> get cmcAllPresOrders =>
_cMCService.cmcAllPresOrdersList;
List<GetOrderDetailByOrderIDResponseModel> get hhcAllOrderDetail =>
_homeHealthCareService.hhcAllOrderDetail;
List<GetOrderDetailByOrderIDResponseModel> get cmcAllOrderDetail =>
_cMCService.cmcAllOrderDetail;
List<CMCGetItemsResponseModel> 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);

@ -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<NewCMCPage>
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<NewCMCPage>
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<NewCMCPage>
},
scrollDirection: Axis.horizontal,
children: <Widget>[
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<NewCMCPage>
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<NewCMCPage>
Texts(
DateUtil.getDayMonthYearDateFormatted(
DateUtil.convertStringToDate(
widget.model.hhcAllOrderDetail[0]
widget.model.cmcAllOrderDetail[0]
.createdOn)),
fontSize: 22,
),
@ -230,9 +243,9 @@ class _NewCMCPageState extends State<NewCMCPage>
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<NewCMCPage>
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<NewCMCPage>
)
: NewCMCStepOnePage(
changePageViewIndex: changePageViewIndex,
patientERInsertPresOrderRequestModel:
patientERInsertPresOrderRequestModel,
cMCInsertPresOrderRequestModel:
cMCInsertPresOrderRequestModel,
model: widget.model,
),
// NewEReferralStepTowPage(

@ -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<NewCMCStepOnePage> {
@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> patientERHHCInsertServicesList = widget
.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList
.where((element) => serviceId == element.serviceID);
if(patientERHHCInsertServicesList.length > 0) {
return true;
}
return false;
}
}

@ -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<CMCPage>
Widget build(BuildContext context) {
return BaseView<CMCViewModel>(
onModelReady: (model){
model.getHHCAllServices();
model.getHHCAllPresOrders();
model.getCMCAllServices();
// model.getCheckupItems(cMCGetItemsRequestModel);
model.getCmcAllPresOrders();
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,

@ -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),

Loading…
Cancel
Save